Skip to content

BoundsIntersection

Overview

A region of two segments that intersects (contains static functions for segment intersection).

BoundsIntersection.intersect( a, b ) should be used for most general intersection routines as a fallback. Other segment-specific routines may be much faster.

@author Jonathan Olson <jonathan.olson@colorado.edu>

Class BoundsIntersection

import { BoundsIntersection } from 'scenerystack/kite';

Constructor

new BoundsIntersection( a : Segment, b : Segment, atMin : number, atMax : number, btMin : number, btMax : number, aMin : Vector2, aMax : Vector2, bMin : Vector2, bMax : Vector2 )

Instance Methods

initialize( a : Segment, b : Segment, atMin : number, atMax : number, btMin : number, btMax : number, aMin : Vector2, aMax : Vector2, bMin : Vector2, bMax : Vector2 ) : BoundsIntersection

@param a @param b @param atMin - Lower t value for the region of the 'a' segment @param atMax - Higher t value for the region of the 'a' segment @param btMin - Lower t value for the region of the 'b' segment @param btMax - Higher t value for the region of the 'b' segment @param aMin - Location of the lower t value for the 'a' segment's region @param aMax - Location of the higher t value for the 'a' segment's region @param bMin - Location of the lower t value for the 'b' segment's region @param bMax - Location of the higher t value for the 'b' segment's region @returns - This reference for chaining

distance( otherIntersection : BoundsIntersection ) : number

A measure of distance between this and another intersection.

clean()

Removes references (so it can allow other objects to be GC'ed or pooled)

freeToPool()

Instance Properties

a : Segment | null

Null if cleaned of references

b : Segment | null

atMin : number

atMax : number

btMin : number

btMax : number

aMin : Vector2 | null

Null if cleaned of references

aMax : Vector2 | null

bMin : Vector2 | null

bMax : Vector2 | null

Static Methods

intersect( a : Segment, b : Segment ) : SegmentIntersection[]

Determine (finite) points of intersection between two arbitrary segments.

Does repeated subdivision and excludes a-b region pairs that don't intersect. Doing this repeatedly narrows down intersections, to the point that they can be combined for a fairly accurate answer.

Static Properties

pool : Pool

(readonly)

Source Code

See the source for BoundsIntersection.ts in the kite repository.