# Trig

`verb.core.Trig`

CLASS

Source code

`Trig` provides various convenient methods for trigonometry

## isPointInPlane

STATIC METHOD

Source code

`isPointInPlane(pt : Point, p : Plane, tol : Float) : Bool`

## distToSegment

STATIC METHOD

Source code

`distToSegment(a : Point, b : Point, c : Point)`

## rayClosestPoint

STATIC METHOD

Source code

`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

Source code

`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

Source code

`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

Source code

`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