Skip to content
  1. API
  2. geometry

geometry.lines

geometry.lines.getClosestPointOnSegment(px, py, ax, ay, bx, by)

Get the closest point on a segment from a point

Arguments

  • px number Point x
  • py number Point y
  • ax number Segment start x
  • ay number Segment start y
  • bx number Segment end x
  • by number Segment end y

Returns

geometry.lines.lineAngle()

Compute the angle formed by the line joining two points (x1, y1) and (x2, y2)

Returns

  • number

geometry.lines.lineIntersection(ax0, ay0, ax1, ay1, bx0, by0, bx1, by1)

Intersection between two lines (unbounded)

Arguments

  • ax0 number The X coordinate of the start point of the first line.
  • ay0 number The Y coordinate of the start point of the first line.
  • ax1 number The X coordinate of the end point of the first line.
  • ay1 number The Y coordinate of the end point of the first line.v
  • bx0 number The X coordinate of the start point of the second line.
  • by0 number The Y coordinate of the start point of the second line.
  • bx1 number The X coordinate of the end point of the second line.
  • by1 number The Y coordinate of the end point of the second line.

geometry.lines.segmentIntersection(ax0, ay0, ax1, ay1, bx0, by0, bx1, by1)

Intersection between two segments

Arguments

  • ax0 number The X coordinate of the start point of the first line.
  • ay0 number The Y coordinate of the start point of the first line.
  • ax1 number The X coordinate of the end point of the first line.
  • ay1 number The Y coordinate of the end point of the first line.v
  • bx0 number The X coordinate of the start point of the second line.
  • by0 number The Y coordinate of the start point of the second line.
  • bx1 number The X coordinate of the end point of the second line.
  • by1 number The Y coordinate of the end point of the second line.

geometry.lines.segmentRectangleIntersection(ax, ay, bx, by, minX, minY, maxX, maxY)

Arguments

  • ax Number
  • ay Number
  • bx Number
  • by Number
  • minX Number
  • minY Number
  • maxX Number
  • maxY Number

Returns

geometry.lines.twoSegmentsIntersect(p1, p2, p3, p4[, excludeBoundaries])

Indicates if two segments intersect.

Arguments

  • p1 Point First extremity of the first segment
  • p2 Point Second extremity of the first segment
  • p3 Point First extremity of the second segment
  • p4 Point Second extremity of the second segment
  • excludeBoundaries(optional) boolean[=false] If true, the segment will not be considered as intersecting if the intersection point is one of their extremities

Returns

  • boolean