Skip to content

Intersection

Constructors

new Intersection()

new Intersection(status?): Intersection

Parameters

status?: IntersectionType

Returns

Intersection

Defined in

src/Intersection.ts:13

Properties

points

points: Point[]

Defined in

src/Intersection.ts:9


status?

optional status: IntersectionType

Defined in

src/Intersection.ts:11

Methods

intersectLineLine()

static intersectLineLine(a1, a2, b1, b2, aInfinite?, bInfinite?): Intersection

Checks if a line intersects another

Parameters

a1: Point

a2: Point

b1: Point

b2: Point

aInfinite?: boolean = true

check segment intersection by passing false

bInfinite?: boolean = true

check segment intersection by passing false

Returns

Intersection

See

Static

Defined in

src/Intersection.ts:127


intersectLinePolygon()

static intersectLinePolygon(a1, a2, points, infinite?): Intersection

Checks if line intersects polygon

Parameters

a1: Point

point on line

a2: Point

other point on line

points: Point[]

polygon points

infinite?: boolean = true

check segment intersection by passing false

Returns

Intersection

Todo

account for stroke

Static

See

intersectSegmentPolygon for segment intersection

Defined in

src/Intersection.ts:224


intersectPolygonPolygon()

static intersectPolygonPolygon(points1, points2): Intersection

Checks if polygon intersects another polygon

Parameters

points1: Point[]

points2: Point[]

Returns

Intersection

Todo

account for stroke

Static

Defined in

src/Intersection.ts:277


intersectPolygonRectangle()

static intersectPolygonRectangle(points, r1, r2): Intersection

Checks if polygon intersects rectangle

Parameters

points: Point[]

polygon points

r1: Point

top left point of rect

r2: Point

bottom right point of rect

Returns

Intersection

Static

See

intersectPolygonPolygon for polygon intersection

Defined in

src/Intersection.ts:315


intersectSegmentLine()

static intersectSegmentLine(s1, s2, l1, l2): Intersection

Checks if a segment intersects a line

Parameters

s1: Point

boundary point of segment

s2: Point

other boundary point of segment

l1: Point

point on line

l2: Point

other point on line

Returns

Intersection

See

intersectLineLine for line intersection

Static

Defined in

src/Intersection.ts:183


intersectSegmentPolygon()

static intersectSegmentPolygon(a1, a2, points): Intersection

Checks if segment intersects polygon

Parameters

a1: Point

boundary point of segment

a2: Point

other boundary point of segment

points: Point[]

polygon points

Returns

Intersection

Static

See

intersectLinePolygon for line intersection

Defined in

src/Intersection.ts:259


intersectSegmentSegment()

static intersectSegmentSegment(a1, a2, b1, b2): Intersection

Checks if a segment intersects another

Parameters

a1: Point

boundary point of segment

a2: Point

other boundary point of segment

b1: Point

boundary point of segment

b2: Point

other boundary point of segment

Returns

Intersection

See

intersectLineLine for line intersection

Static

Defined in

src/Intersection.ts:202


isPointContained()

static isPointContained(T, A, B, infinite?): boolean

check if point T is on the segment or line defined between A and B

Parameters

T: Point

the point we are checking for

A: Point

one extremity of the segment

B: Point

the other extremity of the segment

infinite?: boolean = false

if true checks if T is on the line defined by A and B

Returns

boolean

true if T is contained

Defined in

src/Intersection.ts:51


isPointInPolygon()

static isPointInPolygon(point, points): boolean

Use the ray casting algorithm to determine if point is in the polygon defined by points

Parameters

point: Point

points: Point[]

polygon points

Returns

boolean

See

https://en.wikipedia.org/wiki/Point_in_polygon

Defined in

src/Intersection.ts:91