// Generated by scripts/generate.mjs from bindings/api.mjs. Do not edit.
///|
#external
pub type Path
///|
#module("@mizchi/three-mbt/constructors")
pub extern "js" fn Path::Path() -> Path = "path"
///|
#module("@mizchi/three-mbt/constructors")
pub extern "js" fn Path::from_points(points : FixedArray[Vector2]) -> Path = "Path_from_points"
///|
pub fn Path::as_curve2(self : Path) -> Curve2 = "%identity"
///|
pub fn Path::as_curve_path2(self : Path) -> CurvePath2 = "%identity"
///|
pub extern "js" fn Path::move_to(self : Path, x : Double, y : Double) -> Path =
#| (self, x, y) => self.moveTo(x, y)
///|
pub extern "js" fn Path::line_to(self : Path, x : Double, y : Double) -> Path =
#| (self, x, y) => self.lineTo(x, y)
///|
pub extern "js" fn Path::quadratic_curve_to(
self : Path,
cx : Double,
cy : Double,
x : Double,
y : Double,
) -> Path =
#| (self, cx, cy, x, y) => self.quadraticCurveTo(cx, cy, x, y)
///|
pub extern "js" fn Path::bezier_curve_to(
self : Path,
cx1 : Double,
cy1 : Double,
cx2 : Double,
cy2 : Double,
x : Double,
y : Double,
) -> Path =
#| (self, cx1, cy1, cx2, cy2, x, y) => self.bezierCurveTo(cx1, cy1, cx2, cy2, x, y)
///|
pub extern "js" fn Path::absarc(
self : Path,
x : Double,
y : Double,
radius : Double,
start_angle : Double,
end_angle : Double,
clockwise : Bool,
) -> Path =
#| (self, x, y, radius, start_angle, end_angle, clockwise) => self.absarc(x, y, radius, start_angle, end_angle, clockwise)
///|
pub extern "js" fn Path::absellipse(
self : Path,
x : Double,
y : Double,
radius_x : Double,
radius_y : Double,
start_angle : Double,
end_angle : Double,
clockwise : Bool,
rotation : Double,
) -> Path =
#| (self, x, y, radius_x, radius_y, start_angle, end_angle, clockwise, rotation) => self.absellipse(x, y, radius_x, radius_y, start_angle, end_angle, clockwise, rotation)
///|
pub extern "js" fn Path::close_path(self : Path) -> Path =
#| (self) => self.closePath()
///|
pub extern "js" fn Path::current_point(self : Path) -> Vector2 =
#| (self) => self.currentPoint
///|
pub extern "js" fn Path::set_from_points(
self : Path,
points : FixedArray[Vector2],
) -> Path =
#| (self, points) => self.setFromPoints(points)
///|
pub extern "js" fn Path::spline_thru(
self : Path,
points : FixedArray[Vector2],
) -> Path =
#| (self, points) => self.splineThru(points)
///|
pub extern "js" fn Path::arc(
self : Path,
x : Double,
y : Double,
radius : Double,
start_angle : Double,
end_angle : Double,
clockwise : Bool,
) -> Path =
#| (self, x, y, radius, start_angle, end_angle, clockwise) => self.arc(x, y, radius, start_angle, end_angle, clockwise)
///|
pub extern "js" fn Path::ellipse(
self : Path,
x : Double,
y : Double,
radius_x : Double,
radius_y : Double,
start_angle : Double,
end_angle : Double,
clockwise : Bool,
rotation : Double,
) -> Path =
#| (self, x, y, radius_x, radius_y, start_angle, end_angle, clockwise, rotation) => self.ellipse(x, y, radius_x, radius_y, start_angle, end_angle, clockwise, rotation)
///|
pub extern "js" fn Path::clone(self : Path) -> Path =
#| (self) => self.clone()
///|
pub extern "js" fn Path::copy(self : Path, source : Path) -> Path =
#| (self, source) => self.copy(source)
///|
extern "js" fn Path::ffi_to_json(self : Path) -> JsResult[String] =
#| (self) => { try { return { ok: true, value: (() => JSON.stringify(self.toJSON()))() }; } catch (error) { return { ok: false, error: String(error) }; } }
///|
pub fn Path::to_json(self : Path) -> 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 Path::ffi_to_json_string(self : Path) -> JsResult[String] =
#| (self) => { try { return { ok: true, value: (() => JSON.stringify(self.toJSON()))() }; } catch (error) { return { ok: false, error: String(error) }; } }
///|
pub fn Path::to_json_string(self : Path) -> String raise SerializationError {
match self.ffi_to_json_string().into_result() {
Ok(value) => value
Err(message) => raise SerializationError(message)
}
}
///|
extern "js" fn Path::ffi_from_json(
self : Path,
json : String,
) -> JsResult[Path] =
#| (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 Path::from_json(
self : Path,
json : Json,
) -> Path raise SerializationError {
match self.ffi_from_json(json.stringify()).into_result() {
Ok(value) => value
Err(message) => raise SerializationError(message)
}
}
///|
extern "js" fn Path::ffi_from_json_string(
self : Path,
text : String,
) -> JsResult[Path] =
#| (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 Path::from_json_string(
self : Path,
text : String,
) -> Path raise SerializationError {
match self.ffi_from_json_string(text).into_result() {
Ok(value) => value
Err(message) => raise SerializationError(message)
}
}
///|
extern "js" fn Path::ffi_get_point(
self : Path,
t : Double,
target : Vector2,
) -> Vector2 =
#| (self, t, target) => self.getPoint(t, target)
///|
/// Passes target to the native method and preserves its return value. An omitted target is allocated per call.
pub fn Path::get_point(
self : Path,
t : Double,
target? : Vector2 = Vector2(0, 0),
) -> Vector2 {
self.ffi_get_point(t, target)
}
///|
extern "js" fn Path::ffi_get_point_at(
self : Path,
u : Double,
target : Vector2,
) -> Vector2 =
#| (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 Path::get_point_at(
self : Path,
u : Double,
target? : Vector2 = Vector2(0, 0),
) -> Vector2 {
self.ffi_get_point_at(u, target)
}
///|
extern "js" fn Path::ffi_get_tangent(
self : Path,
t : Double,
target : Vector2,
) -> Vector2 =
#| (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 Path::get_tangent(
self : Path,
t : Double,
target? : Vector2 = Vector2(0, 0),
) -> Vector2 {
self.ffi_get_tangent(t, target)
}
///|
extern "js" fn Path::ffi_get_tangent_at(
self : Path,
u : Double,
target : Vector2,
) -> Vector2 =
#| (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 Path::get_tangent_at(
self : Path,
u : Double,
target? : Vector2 = Vector2(0, 0),
) -> Vector2 {
self.ffi_get_tangent_at(u, target)
}
///|
pub extern "js" fn Path::get_points(
self : Path,
divisions : Int,
) -> FixedArray[Vector2] =
#| (self, divisions) => self.getPoints(divisions)
///|
pub extern "js" fn Path::get_spaced_points(
self : Path,
divisions : Int,
) -> FixedArray[Vector2] =
#| (self, divisions) => self.getSpacedPoints(divisions)
///|
pub extern "js" fn Path::get_length(self : Path) -> Double =
#| (self) => self.getLength()
///|
pub extern "js" fn Path::update_arc_lengths(self : Path) -> Unit =
#| (self) => self.updateArcLengths()