Skip to content

Intersection

Defined in: src/Intersection.ts:8

Constructors

new Intersection()

new Intersection(status?): Intersection

Defined in: src/Intersection.ts:13

Parameters

status?

IntersectionType

Returns

Intersection

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

Defined in: src/Intersection.ts:127

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


intersectLinePolygon()

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

Defined in: src/Intersection.ts:224

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


intersectPolygonPolygon()

static intersectPolygonPolygon(points1, points2): Intersection

Defined in: src/Intersection.ts:277

Checks if polygon intersects another polygon

Parameters

points1

Point[]

points2

Point[]

Returns

Intersection

Todo

account for stroke

Static


intersectPolygonRectangle()

static intersectPolygonRectangle(points, r1, r2): Intersection

Defined in: src/Intersection.ts:315

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


intersectSegmentLine()

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

Defined in: src/Intersection.ts:183

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


intersectSegmentPolygon()

static intersectSegmentPolygon(a1, a2, points): Intersection

Defined in: src/Intersection.ts:259

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


intersectSegmentSegment()

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

Defined in: src/Intersection.ts:202

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


isPointContained()

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

Defined in: src/Intersection.ts:51

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


isPointInPolygon()

static isPointInPolygon(point, points): boolean

Defined in: src/Intersection.ts:91

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