Class Abstract2DShapeAbstract

An abstract base class for 2D shapes.

Hierarchy (view full)

Constructors

Methods

  • Returns true if and only if the given point is contained within this shape.

    epsilon is a small number used to counteract floating point error. Thus, if point is within epsilon of the inside of this shape, containsPoint may also return true.

    The default implementation relies on signedDistance. Subclasses may override this method to provide a more efficient implementation.

    Parameters

    • point: Vec3
    • epsilon: number = Abstract2DShape.smallValue

    Returns boolean

  • Parameters

    Returns number

    the distance from point to this shape. If point is within this shape, this returns the distance from point to the edge of this shape.

  • Returns a bounding box that precisely fits the content of this shape.

    Note: This bounding box should aligned with the x/y axes. (Thus, it may be possible to find a tighter bounding box not axes-aligned).

    Returns Rect2

  • Parameters

    Returns Vec3[]

    points at which this shape intersects the given lineSegment.

    If this is a closed shape, returns points where the given lineSegment intersects the boundary of this.

OpenSource licenses