Class b2Segment

A line in space between two given vertices.

Index

Properties

Methods

Properties

public p1: b2Vec2

The starting point.

public p2: b2Vec2

The ending point.

Methods

public Extend(aabb: b2AABB)

Extends or clips the segment so that it's ends lie on the boundary of the AABB.

Parameters

  • aabb: b2AABB

    AABB to extend/clip the segement.

public ExtendBackward(aabb: b2AABB)

See Extend, this works on the ending point.

Parameters

  • aabb: b2AABB

    AABB to extend/clip the ending point.

public ExtendForward(aabb: b2AABB)

See Extend, this works on the starting point.

Parameters

  • aabb: b2AABB

    AABB to extend/clip the starting point.

public TestSegment(lambda: Array<number>, normal: b2Vec2, segment: b2Segment, maxLambda: number): boolean

Ray cast against this segment with another segment.

Parameters

  • lambda: Array<number>

    returns the hit fraction. You can use this to compute the contact point p = (1 - lambda) segment.p1 + lambda segment.p2 @normal Normal at the contact point. If there is no intersection, the normal is not set.

  • normal: b2Vec2
  • segment: b2Segment

    Defines the begining and end point of the ray cast.

  • maxLambda: number

    a number typically in the range [0,1].

Returns

boolean

True if there is an intersection, otherwise false.