// Generated by scripts/generate.mjs from bindings/api.mjs. Do not edit.
///|
#external
pub type CurvePath3
///|
#module("@mizchi/three-mbt/geometry")
pub extern "js" fn CurvePath3::CurvePath3() -> CurvePath3 = "curvePath3"
///|
pub fn CurvePath3::as_curve3(self : CurvePath3) -> Curve3 = "%identity"
///|
pub extern "js" fn CurvePath3::add(self : CurvePath3, curve : Curve3) -> Unit =
#| (self, curve) => self.add(curve)
///|
pub extern "js" fn CurvePath3::close_path(self : CurvePath3) -> CurvePath3 =
#| (self) => self.closePath()
///|
pub extern "js" fn CurvePath3::curves(self : CurvePath3) -> FixedArray[Curve3] =
#| (self) => self.curves.slice()
///|
pub extern "js" fn CurvePath3::auto_close(self : CurvePath3) -> Bool =
#| (self) => self.autoClose
///|
pub extern "js" fn CurvePath3::set_auto_close(
self : CurvePath3,
value : Bool,
) -> Unit =
#| (self, value) => { self.autoClose = value; }
///|
pub extern "js" fn CurvePath3::get_curve_lengths(
self : CurvePath3,
) -> FixedArray[Double] =
#| (self) => self.getCurveLengths().slice()
///|
extern "js" fn CurvePath3::ffi_get_point(
self : CurvePath3,
t : Double,
target : Vector3,
) -> Nullable[Vector3] =
#| (self, t, target) => self.getPoint(t, target)
///|
pub fn CurvePath3::get_point(
self : CurvePath3,
t : Double,
target : Vector3,
) -> Vector3? {
self.ffi_get_point(t, target).to_option()
}
///|
pub extern "js" fn CurvePath3::clone(self : CurvePath3) -> CurvePath3 =
#| (self) => self.clone()
///|
pub extern "js" fn CurvePath3::copy(
self : CurvePath3,
source : CurvePath3,
) -> CurvePath3 =
#| (self, source) => self.copy(source)
///|
extern "js" fn CurvePath3::ffi_to_json(self : CurvePath3) -> JsResult[String] =
#| (self) => { try { return { ok: true, value: (() => JSON.stringify(self.toJSON()))() }; } catch (error) { return { ok: false, error: String(error) }; } }
///|
pub fn CurvePath3::to_json(self : CurvePath3) -> Json raise SerializationError {
match self.ffi_to_json().into_result() {
Ok(value) =>
@json.parse(value) catch {
error => raise SerializationError((error : Error).to_string())
}
Err(message) => raise SerializationError(message)
}
}
///|
extern "js" fn CurvePath3::ffi_to_json_string(
self : CurvePath3,
) -> JsResult[String] =
#| (self) => { try { return { ok: true, value: (() => JSON.stringify(self.toJSON()))() }; } catch (error) { return { ok: false, error: String(error) }; } }
///|
pub fn CurvePath3::to_json_string(
self : CurvePath3,
) -> String raise SerializationError {
match self.ffi_to_json_string().into_result() {
Ok(value) => value
Err(message) => raise SerializationError(message)
}
}
///|
extern "js" fn CurvePath3::ffi_from_json(
self : CurvePath3,
json : String,
) -> JsResult[CurvePath3] =
#| (self, json) => { try { return { ok: true, value: (() => { self.fromJSON(JSON.parse(json)); self.updateArcLengths(); return self; })() }; } catch (error) { return { ok: false, error: String(error) }; } }
///|
pub fn CurvePath3::from_json(
self : CurvePath3,
json : Json,
) -> CurvePath3 raise SerializationError {
match self.ffi_from_json(json.stringify()).into_result() {
Ok(value) => value
Err(message) => raise SerializationError(message)
}
}
///|
extern "js" fn CurvePath3::ffi_from_json_string(
self : CurvePath3,
text : String,
) -> JsResult[CurvePath3] =
#| (self, text) => { try { return { ok: true, value: (() => { self.fromJSON(JSON.parse(text)); self.updateArcLengths(); return self; })() }; } catch (error) { return { ok: false, error: String(error) }; } }
///|
pub fn CurvePath3::from_json_string(
self : CurvePath3,
text : String,
) -> CurvePath3 raise SerializationError {
match self.ffi_from_json_string(text).into_result() {
Ok(value) => value
Err(message) => raise SerializationError(message)
}
}
///|
extern "js" fn CurvePath3::ffi_get_point_at(
self : CurvePath3,
u : Double,
target : Vector3,
) -> Vector3 =
#| (self, u, target) => self.getPointAt(u, target)
///|
/// Passes target to the native method and preserves its return value. An omitted target is allocated per call.
pub fn CurvePath3::get_point_at(
self : CurvePath3,
u : Double,
target? : Vector3 = Vector3(0, 0, 0),
) -> Vector3 {
self.ffi_get_point_at(u, target)
}
///|
extern "js" fn CurvePath3::ffi_get_tangent(
self : CurvePath3,
t : Double,
target : Vector3,
) -> Vector3 =
#| (self, t, target) => self.getTangent(t, target)
///|
/// Passes target to the native method and preserves its return value. An omitted target is allocated per call.
pub fn CurvePath3::get_tangent(
self : CurvePath3,
t : Double,
target? : Vector3 = Vector3(0, 0, 0),
) -> Vector3 {
self.ffi_get_tangent(t, target)
}
///|
extern "js" fn CurvePath3::ffi_get_tangent_at(
self : CurvePath3,
u : Double,
target : Vector3,
) -> Vector3 =
#| (self, u, target) => self.getTangentAt(u, target)
///|
/// Passes target to the native method and preserves its return value. An omitted target is allocated per call.
pub fn CurvePath3::get_tangent_at(
self : CurvePath3,
u : Double,
target? : Vector3 = Vector3(0, 0, 0),
) -> Vector3 {
self.ffi_get_tangent_at(u, target)
}
///|
pub extern "js" fn CurvePath3::get_points(
self : CurvePath3,
divisions : Int,
) -> FixedArray[Vector3] =
#| (self, divisions) => self.getPoints(divisions)
///|
pub extern "js" fn CurvePath3::get_spaced_points(
self : CurvePath3,
divisions : Int,
) -> FixedArray[Vector3] =
#| (self, divisions) => self.getSpacedPoints(divisions)
///|
pub extern "js" fn CurvePath3::get_length(self : CurvePath3) -> Double =
#| (self) => self.getLength()
///|
pub extern "js" fn CurvePath3::update_arc_lengths(self : CurvePath3) -> Unit =
#| (self) => self.updateArcLengths()
///|
pub extern "js" fn CurvePath3::compute_frenet_frames(
self : CurvePath3,
segments : Int,
closed : Bool,
) -> FrenetFrames =
#| (self, segments, closed) => self.computeFrenetFrames(segments, closed)