@huukhanhnguyen/geometry / catalog/axis2d
catalog/axis2d
Axis2d
constAxis2d: {angle: (px,py,dx,dy,other_px,other_py,other_dx,other_dy) =>number;closestPoint: (axis,point) =>Point2d;distanceToPoint: (axis,point) =>number;equals: (px,py,dx,dy,other_px,other_py,other_dx,other_dy,tolerance) =>boolean;fromPointDirection: (point,direction) =>Axis2d;fromTwoPoints: (a,b) =>Axis2d;intersect: (a,b) =>Point2d|undefined;isParallel: (px,py,dx,dy,other_px,other_py,other_dx,other_dy,tolerance) =>boolean;normal: (axis) =>Vector2d;offset: (axis,distance) =>Axis2d;project: (axis,point) =>number;reflect: (axis,point) =>Point2d;side: (px,py,dx,dy,x,y,tolerance) =>number;signedDistance: (axis,point) =>number; }
The generated wasm namespace plus the members that need a TS reshape. Re-exported from src/index.ts, where it shadows the generated Axis2d.
angle
angle: (
px,py,dx,dy,other_px,other_py,other_dx,other_dy) =>number=wasm.line2d_angle
Parameters
px
number
py
number
dx
number
dy
number
other_px
number
other_py
number
other_dx
number
other_dy
number
Returns
number
closestPoint
closestPoint: (
axis,point) =>Point2d
Point on axis closest to point.
Parameters
axis
point
Returns
distanceToPoint
distanceToPoint: (
axis,point) =>number
Perpendicular distance from point to axis.
Parameters
axis
point
Returns
number
equals
equals: (
px,py,dx,dy,other_px,other_py,other_dx,other_dy,tolerance) =>boolean=wasm.line2d_equals
Parameters
px
number
py
number
dx
number
dy
number
other_px
number
other_py
number
other_dx
number
other_dy
number
tolerance
number
Returns
boolean
fromPointDirection
fromPointDirection: (
point,direction) =>Axis2d
Infinite 2D line through point along direction (unit-length crate-side).
Parameters
point
direction
Returns
fromTwoPoints
fromTwoPoints: (
a,b) =>Axis2d
Infinite 2D line through points a and b (direction a → b).
Parameters
a
b
Returns
intersect
intersect: (
a,b) =>Point2d|undefined
Intersection point of two 2D axes; undefined when parallel.
Parameters
a
b
Returns
Point2d | undefined
isParallel
isParallel: (
px,py,dx,dy,other_px,other_py,other_dx,other_dy,tolerance) =>boolean=wasm.line2d_is_parallel
Parameters
px
number
py
number
dx
number
dy
number
other_px
number
other_py
number
other_dx
number
other_dy
number
tolerance
number
Returns
boolean
normal
normal: (
axis) =>Vector2d
Unit normal of axis (the direction rotated a quarter turn).
Parameters
axis
Returns
offset
offset: (
axis,distance) =>Axis2d
axis shifted distance along its normal.
Parameters
axis
distance
number
Returns
project
project: (
axis,point) =>number
Parameter of point's projection onto axis (signed distance along the unit direction from the axis's origin).
Parameters
axis
point
Returns
number
reflect
reflect: (
axis,point) =>Point2d
Mirror image of point across axis.
Parameters
axis
point
Returns
side
side: (
px,py,dx,dy,x,y,tolerance) =>number=wasm.line2d_side
Parameters
px
number
py
number
dx
number
dy
number
x
number
y
number
tolerance
number
Returns
number
signedDistance
signedDistance: (
axis,point) =>number
Signed perpendicular distance from point to axis.
Parameters
axis
point
Returns
number
closestPoint()
closestPoint(
axis,point):Point2d
Point on axis closest to point.
Parameters
axis
point
Returns
distanceToPoint()
distanceToPoint(
axis,point):number
Perpendicular distance from point to axis.
Parameters
axis
point
Returns
number
fromPointDirection()
fromPointDirection(
point,direction):Axis2d
Infinite 2D line through point along direction (unit-length crate-side).
Parameters
point
direction
Returns
fromTwoPoints()
fromTwoPoints(
a,b):Axis2d
Infinite 2D line through points a and b (direction a → b).
Parameters
a
b
Returns
intersect()
intersect(
a,b):Point2d|undefined
Intersection point of two 2D axes; undefined when parallel.
Parameters
a
b
Returns
Point2d | undefined
normal()
normal(
axis):Vector2d
Unit normal of axis (the direction rotated a quarter turn).
Parameters
axis
Returns
offset()
offset(
axis,distance):Axis2d
axis shifted distance along its normal.
Parameters
axis
distance
number
Returns
project()
project(
axis,point):number
Parameter of point's projection onto axis (signed distance along the unit direction from the axis's origin).
Parameters
axis
point
Returns
number
reflect()
reflect(
axis,point):Point2d
Mirror image of point across axis.
Parameters
axis
point
Returns
signedDistance()
signedDistance(
axis,point):number
Signed perpendicular distance from point to axis.
Parameters
axis
point
Returns
number