Class Capsule

The CapsuleD implements a capsule represented by a line segment and a radius. The class follows the 'copy-on-write' pattern, which means that every operation returns a copy of the sphere with updates values. It also implies that the values of the sphere cannot be directly modified.

The concept of immutability improves sharing of objects as all types in TypeScript are assigned by identity, instead of by-value (e.g. a copy) as in other programming languages like C.

Constructors

Properties

_radius: number
_segment: LineSegment

Accessors

  • get radius(): number
  • Returns number

  • set radius(value): void
  • Parameters

    • value: number

    Returns void

Methods

  • Copies all properties defined by the prototype of Capsule from other to this instance.

    Parameters

    Returns Capsule

  • Clones this instance and returns a new Capsule with identical values.

    Returns Capsule

  • Determines if this Capsule instance is equal to the other instance.

    Parameters

    Returns boolean

  • Creates a new capsule with the given parameters.

    Parameters

    • start: Vector3

      The start of the line segment defining the capsule.

    • end: Vector3

      The end of the line segment defining the capsule.

    • radius: number

      The radius of the capsule.

    Returns Capsule

    The newly constructed capsule.