Function tupleSubtract

  • Produces the sum of two tuples, the 2 tuples can be of any kind but a Point cannot be subtracted from a Vector Point - Vector -> Point Vector - Vector -> Vector Point - Point -> Vector Vector - Point -/- invalid

    Example

    const point1 = new Point(3, 2, 1)
    const point2 = new Point(5, 6, 7)
    tupleSubtract(point1, point2).components() //-> [-2, -4, -6, 0]

    Returns

    A tuple that is the result of the differece between tuple1 & tuple2 (tuple1-tuple2)

    Throws

    RangeError - Thrown if user is attempting to subtract a Point from a Vector i.e (Vector-Point)

    Parameters

    • tuple1: Ttuple

      Tuple to subtract from

    • tuple2: Ttuple

      Tuple to subtract

    Returns Ttuple

Generated using TypeDoc