This subset of geometry functions is particularly aimed at vector editing applications.

**intersectionPoint**(*a1*, *a2*, *b1*, *b2*)

Get intersection point between line *a1*,*a2* and line *b1*,*b2*. The points are objects with x and y number properties. Returns {x : *x*, y : *y*} intersection point object, or false.

**intersect**(*a1*, *a2*, *b1*, *b2*)

Test intersection between line *a1*,*a2* and line *b1*,*b2*. The points are objects with x and y properties. Returns true if lines intersect, or false.

**pointBetween**(*a*, *b*, *c*)

Test if point *c* is between point *a* and point *b*. Unidimensional (x or y). Returns true if point is between, or false.

**pointOnLine**(*p*, *a*, *b*)

Tests if point *p* is on segment *a*,*b*. The points are objects with x and y properties. Treats horizontal and vertical lines. Applies 1 x 10−6 compensation. Returns true if point is on line, or false.

**getPDistance**(*x*, *y*, *x1*, *y1*, *x2*, *y2*)

Get shortest distance from point *x*,*y* to line *x1*,*y1* *x2*,*y2*. Returns shortest distance number.

**getPPoint**(*p*, *l*)

Get the perpendicular point on line *l* ({x1,y1,x2,y2}) from point *p* ({x,y}). Returns {x : *x*, y : *y*} perpendicular point object.

**getP2Pdistance**(*a*, *b*)

Get the distance between two points. *a* and *b* are objects with x and y properties. Returns distance number.

**centroid**(*points*, *area*)

Get true centroid of a polygon. *points* is an array whose elements are objects with x and y properties. *area* is the polygon's area. Returns {x : *x*, y : *y*} center point object.

**crossProduct**(*v1*, *v2*)

Vectors *v1* and *v2* are objects with x and y properties. Returns number.

**degrees**(*p1*, *p2*)

Get rotation angle of line *p1*,*p2*. *p1* and *p2* are objects with x and y properties. Returns a number representing the angle in degrees.

**radians**(*dy*, *dx*)

Get angle in radians from center point, where *dy* is y - cy, and *dx* is x - cx. A typical use is when drawing a line or dragging one anchor point of a line. Returns a number representing the current angle in radians.

**toDegrees**(*radians*)

Converts *radians* to degrees. Returns degrees number.

**toRadians**(*degrees*)

Converts *degrees* to radians. Returns radians number.

**angleBetween2Lines**(*a*, *b*)

Get angle between two lines. *a* and *b* are objects ({x1,y1,x2,y2}). Returns a number representing the angle in degrees.

**constrain**(*angle*[, *cardinals*])

Constrain an angle to fixed values. if *cardinals* is not specified the value 16 (22.5 degrees) is used. A typical use is when drawing a line or dragging one anchor point of a line. Returns a number representing the constrained angle in degrees.

**triangle**(*s*)

Computes the area of a triangle, based on sides. *s* is an array containing the sides' length. Returns area number.

**polygon**(*X*, *Y*, *n*)

Computes the area of a polygon, based on vertices. *X* is an array of ordered x vertices; *Y* is an array of ordered y vertices; *n* is the number of sides. Returns area signed number (negative for clockwise order).