Trig
verb.core.Trig
CLASS
Trig
provides various convenient methods for trigonometry
isPointInPlane
STATIC METHOD
isPointInPlane(pt : Point, p : Plane, tol : Float) : Bool
distToSegment
STATIC METHOD
distToSegment(a : Point, b : Point, c : Point)
rayClosestPoint
STATIC METHOD
rayClosestPoint(pt : undefined, o : undefined, r : undefined)
Find the closest point on a ray
params
- point to project
- origin for ray
- direction of ray 1, assumed normalized
returns
- pt
distToRay
STATIC METHOD
distToRay(pt : undefined, o : undefined, r : undefined)
Find the distance of a point to a ray
params
- point to project
- origin for ray
- direction of ray 1, assumed normalized
returns
- the distance
threePointsAreFlat
STATIC METHOD
threePointsAreFlat(p1 : undefined, p2 : undefined, p3 : undefined, tol : undefined)
Determine if three points form a straight line within a given tolerance for their 2 * squared area
* p2
/ \
/ \
/ \
/ \
* p1 ---- * p3
The area metric is 2 * the squared norm of the cross product of two edges, requiring no square roots and no divisions
params
- p1
- p2
- p3
- The tolerance
returns
- Whether the triangle passes the test
segmentClosestPoint
STATIC METHOD
segmentClosestPoint(pt : Point, segpt0 : Point, segpt1 : Point, u0 : Float, u1 : Float)
Find the closest point on a segment
params
- point to project
- first point of segment
- second point of segment
- first param of segment
- second param of segment
returns
- Object with u and pt properties