satsim.vecmath package — SatSim 0.20.1 documentation

# satsim.vecmath package

## Submodules

## satsim.vecmath.Cartesian2 module

class satsim.vecmath.Cartesian2.Cartesian2(x=0.0, y=0.0)

  Bases: `object`

  A 2D Cartesian point.

  static ONE()

    A Cartesian2 instance initialized to (1.0, 1.0).

  static UNIT_X()

    A Cartesian2 instance initialized to (1.0, 0.0).

  static UNIT_Y()

    A Cartesian2 instance initialized to (0.0, 1.0).

  static ZERO()

    A Cartesian2 instance initialized to (0.0, 0.0).

  static abs(cartesian, result)

    Computes the absolute value of the provided Cartesian.

    Parameters:

      - cartesian –

      - Cartesian2 –

      - computed. (The Cartesian whose absolute value is to be) –

      - result – Cartesian2, The object onto which to store the result.

    Returns:

      A Cartesian2, The modified result parameter.

  static add(left, right, result)

    Computes the component wise sum of two Cartesians.

    Parameters:

      - left –

      - Cartesian2 –

      - Cartesian. (The second) –

      - right –

      - Cartesian2 –

      - Cartesian. –

      - result – Cartesian2, The object onto which to store the result.

    Returns:

      A float, The modified result parameter.

  static angleBetween(left, right)

    Returns the angle, in radians, between the provided Cartesians.

    Parameters:

      - left –

      - Cartesian2 –

      - Cartesian. (The second) –

      - right –

      - Cartesian2 –

      - Cartesian. –

    Returns:

      A float, The angle between the Cartesians.

  static clamp(value, min_val, max_val, result)

    Computes the value of the minimum component for the supplied Cartesian.

    Parameters:

      - value – Cartesian2, The value to clamp.

      - min_val – Cartesian2, The minimum bound.

      - max_val – Cartesian2, The maximum bound.

      - result – Cartesian2, The object onto which to store the result.

    Returns:

      A number, The clamped value such that min <= result <= max.

  static clone(cartesian=None, result=None)

    Duplicates a Cartesian2 instance.

    Parameters:

      - cartesian – Cartesian2, The cartesian to duplicate.

      - result – Cartesian2, The object onto which to store the result.

    Returns:

      A Cartesian2, The modified result parameter or a new Cartesian2 instance if one was not provided.

  static cross(left, right)

    Computes the magnitude of the cross product that would result from implicitly setting the Z coordinate of the input vectors to 0.

    Parameters:

      - left –

      - Cartesian2 –

      - Cartesian. (The second) –

      - right –

      - Cartesian2 –

      - Cartesian. –

    Returns:

      A float, The cross product.

  static distance(left, right)

    Computes the distance between two points.

    Parameters:

      - left –

      - Cartesian2 –

      - from. (The first point to compute the distance) –

      - right –

      - Cartesian2 –

      - to. (The second point to compute the distance) –

    Returns:

      A float, The distance between two points.

  static distanceSquared(left, right)

    Computes the squared distance between two points. Comparing squared distances using this function is more efficient than comparing distances.

    Parameters:

      - left –

      - Cartesian2 –

      - from. (The first point to compute the distance) –

      - right –

      - Cartesian2 –

      - to. (The second point to compute the distance) –

    Returns:

      A float, The distance between two points.

  static divideByScalar(cartesian, scalar, result)

    Divides the provided Cartesian componentwise by the provided scalar.

    Parameters:

      - cartesian –

      - Cartesian2 –

      - divided. (The Cartesian to be) –

      - scalar –

      - float –

      - by. (The scalar to divide) –

      - result – Cartesian2, The object onto which to store the result.

    Returns:

      A Cartesian2, The modified result parameter.

  static divideComponents(left, right, result)

    Computes the component wise quotient of two Cartesians.

    Parameters:

      - left –

      - Cartesian2 –

      - Cartesian. (The second) –

      - right –

      - Cartesian2 –

      - Cartesian. –

      - result – Cartesian2, The object onto which to store the result.

    Returns:

      A float, The modified result parameter.

  static dot(left, right)

    Computes the dot (scalar) product of two Cartesians.

    Parameters:

      - left –

      - Cartesian2 –

      - Cartesian. (The second) –

      - right –

      - Cartesian2 –

      - Cartesian. –

    Returns:

      A float, The dot product.

  static equals(left, right)

    Compares the provided Cartesians componentwise and return True if equal, False otherwise.

    Parameters:

      - left –

      - Cartesian2 –

      - Cartesian. (The first) –

      - right – Cartesian2, The second Cartesian.

    Returns:

      A boolean, True if equal, False otherwise.

  static equalsEpsilon(left, right, relativeEpsilon=0.0, absoluteEpsilon=0.0)

    Compares the provided Cartesians componentwise and return True if they pass an absolute or relative tolerance test, False otherwise.

    Parameters:

      - left –

      - Cartesian2 –

      - Cartesian. (The first) –

      - right – Cartesian2, The second Cartesian.

      - relativeEpsilon –

      - float –

      - default=0 (The absolute epsilon tolerance to use for equality testing.) –

      - absoluteEpsilon –

      - float –

      - default=0 –

    Returns:

      A boolean, True if they pass an absolute or relative tolerance test, False otherwise.

  static fromArray(array, startingIndex=0, result=None)

    Creates a Cartesian2 from two consecutive elements in an array.

    Parameters:

      - array – list, The array whose two consecutive elements correspond to the x and y components, respectively.

      - startingIndex – int, The offset into the array of the first element, which corresponds to the x component.

      - result – Cartesian2, The object onto which to store the result.

    Returns:

      A Cartesian2, The modified result parameter or a new Cartesian2 instance if one was not provided.

  static fromCartesian3(cartesian, result=None)

    Creates a Cartesian2 instance from an existing Cartesian3. This simply takes the x and y properties of the Cartesian3 and drops z.

    Parameters:

      - cartesian – Cartesian3, The cartesian to create from.

      - result – Cartesian2, The object onto which to store the result.

    Returns:

      A Cartesian2, The modified result parameter or a new Cartesian2 instance if one was not provided.

  static fromCartesian4(cartesian, result=None)

    Creates a Cartesian2 instance from an existing Cartesian3. This simply takes the x and y properties of the Cartesian3 and drops z and w.

    Parameters:

      - cartesian – Cartesian4, The cartesian to create from.

      - result – Cartesian2, The object onto which to store the result.

    Returns:

      A Cartesian2, The modified result parameter or a new Cartesian2 instance if one was not provided.

  static fromElements(x, y, result=None)

    Creates a Cartesian2 instance from x and y coordinates.

    Parameters:

      - x – float, The X component. default: 0

      - y – float, The Y component. default: 0

      - result – Cartesian2, The object onto which to store the result.

    Returns:

      A Cartesian2, The modified result parameter or a new Cartesian2 instance if one was not provided.

  static lerp(start, end, t, result)

    Computes the linear interpolation or extrapolation at t using the provided cartesians.

    Parameters:

      - start –

      - Cartesian2 –

      - 0.0. (The value corresponding to t at) –

      - end –

      - Cartesian2 –

      - 1.0. (The value corresponding to t at) –

      - t –

      - Cartesian2 –

      - interpolate. (The point along t at which to) –

      - result – Cartesian2, The object onto which to store the result.

    Returns:

      A Cartesian2, The modified result parameter.

  static magnitude(cartesian)

    Computes the provided Cartesian’s magnitude (length).

    Parameters:

      cartesian – Cartesian2, he Cartesian instance whose magnitude is to be computed.

    Returns:

      A float, The magnitude.

  static magnitudeSquared(cartesian)

    Computes the provided Cartesian’s squared magnitude.

    Parameters:

      cartesian – Cartesian2, he Cartesian instance whose squared magnitude is to be computed.

    Returns:

      A float, The squared magnitude.

  static maximumByComponent(first, second, result)

    Computes the value of the maximum component for the supplied Cartesian.

    Parameters:

      - first – Cartesian2, The cartesian to compare.

      - second – Cartesian2, The cartesian to compare.

      - result – Cartesian2, The object onto which to store the result.

    Returns:

      A number, The value of the maximum component.

  static maximumComponent(cartesian)

    Computes the value of the maximum component for the supplied Cartesian.

    Parameters:

      cartesian – Cartesian2, The cartesian to use.

    Returns:

      A number, The value of the maximum component.

  static minimumByComponent(first, second, result)

    Computes the value of the minimum component for the supplied Cartesian.

    Parameters:

      - first – Cartesian2, The cartesian to compare.

      - second – Cartesian2, The cartesian to compare.

      - result – Cartesian2, The object onto which to store the result.

    Returns:

      A number, The value of the minimum component.

  static minimumComponent(cartesian)

    Computes the value of the minimum component for the supplied Cartesian.

    Parameters:

      cartesian – Cartesian2, The cartesian to use.

    Returns:

      A number, The value of the minimum component.

  static mostOrthogonalAxis(cartesian, result)

    Returns the angle, in radians, between the provided Cartesians.

    Parameters:

      - cartesian –

      - Cartesian2 –

      - axis. (The Cartesian on which to find the most orthogonal) –

      - result – Cartesian2, The object onto which to store the result.

    Returns:

      A Cartesian2, The most orthogonal axis.

  static multiplyByScalar(cartesian, scalar, result)

    Multiplies the provided Cartesian componentwise by the provided scalar.

    Parameters:

      - cartesian –

      - Cartesian2 –

      - scaled. (The Cartesian to be) –

      - scalar –

      - float –

      - with. (The scalar to multiply) –

      - result – Cartesian2, The object onto which to store the result.

    Returns:

      A Cartesian2, The modified result parameter.

  static multiplyComponents(left, right, result)

    Computes the componentwise product of two Cartesians.

    Parameters:

      - left –

      - Cartesian2 –

      - Cartesian. (The second) –

      - right –

      - Cartesian2 –

      - Cartesian. –

      - result – Cartesian2, The object onto which to store the result.

    Returns:

      A Cartesian2, The modified result parameter.

  static negate(cartesian, result)

    Negates the provided Cartesian.

    Parameters:

      - cartesian –

      - Cartesian2 –

      - negated. (The Cartesian to be) –

      - result – Cartesian2, The object onto which to store the result.

    Returns:

      A Cartesian2, The modified result parameter.

  static normalize(cartesian, result)

    Computes the normalized form of the supplied Cartesian.

    Parameters:

      - cartesian –

      - Cartesian2 –

      - normalized. (The Cartesian to be) –

      - result – Cartesian2, The object onto which to store the result.

    Returns:

      A Cartesian2, The modified result parameter.

  static subtract(left, right, result)

    Computes the component wise difference of two Cartesians.

    Parameters:

      - left –

      - Cartesian2 –

      - Cartesian. (The second) –

      - right –

      - Cartesian2 –

      - Cartesian. –

      - result – Cartesian2, The object onto which to store the result.

    Returns:

      A Cartesian2, The modified result parameter.

## satsim.vecmath.Cartesian3 module

class satsim.vecmath.Cartesian3.Cartesian3(x=0.0, y=0.0, z=0.0)

  Bases: `object`

  A 3D Cartesian point.

  static ONE()

    A Cartesian3 instance initialized to (1.0, 1.0, 1.0).

  static UNIT_X()

    A Cartesian3 instance initialized to (1.0, 0.0, 0.0).

  static UNIT_Y()

    A Cartesian3 instance initialized to (0.0, 1.0, 0.0).

  static UNIT_Z()

    A Cartesian3 instance initialized to (0.0, 0.0, 1.0).

  static ZERO()

    A Cartesian3 instance initialized to (0.0, 0.0, 0.0).

  static abs(cartesian, result)

    Computes the absolute value of the provided Cartesian.

    Parameters:

      - cartesian –

      - Cartesian3 –

      - computed. (The Cartesian whose absolute value is to be) –

      - result – Cartesian3, The object onto which to store the result.

    Returns:

      A Cartesian3, The modified result parameter.

  static add(left, right, result)

    Computes the component wise sum of two Cartesians.

    Parameters:

      - left –

      - Cartesian3 –

      - Cartesian. (The second) –

      - right –

      - Cartesian3 –

      - Cartesian. –

      - result – Cartesian3, The object onto which to store the result.

    Returns:

      A float, The modified result parameter.

  static angleBetween(left, right)

    Returns the angle, in radians, between the provided Cartesians.

    Parameters:

      - left –

      - Cartesian3 –

      - Cartesian. (The second) –

      - right –

      - Cartesian3 –

      - Cartesian. –

    Returns:

      A float, The angle between the Cartesians.

  static clamp(value, min_val, max_val, result)

    Computes the value of the minimum component for the supplied Cartesian.

    Parameters:

      - value – Cartesian3, The value to clamp.

      - min_val – Cartesian3, The minimum bound.

      - max_val – Cartesian3, The maximum bound.

      - result – Cartesian3, The object onto which to store the result.

    Returns:

      A number, The clamped value such that min <= result <= max.

  static clone(cartesian=None, result=None)

    Duplicates a Cartesian3 instance.

    Parameters:

      - cartesian – Cartesian3, The cartesian to duplicate.

      - result – Cartesian3, The object onto which to store the result.

    Returns:

      A Cartesian3, The modified result parameter or a new Cartesian3 instance if one was not provided.

  static cross(left, right, result)

    Computes the magnitude of the cross product that would result from implicitly setting the Z coordinate of the input vectors to 0.

    Parameters:

      - left –

      - Cartesian3 –

      - Cartesian. (The second) –

      - right –

      - Cartesian3 –

      - Cartesian. –

    Returns:

      A float, The cross product.

  static distance(left, right)

    Computes the distance between two points.

    Parameters:

      - left –

      - Cartesian3 –

      - from. (The first point to compute the distance) –

      - right –

      - Cartesian3 –

      - to. (The second point to compute the distance) –

    Returns:

      A float, The distance between two points.

  static distanceSquared(left, right)

    Computes the squared distance between two points. Comparing squared distances using this function is more efficient than comparing distances.

    Parameters:

      - left –

      - Cartesian3 –

      - from. (The first point to compute the distance) –

      - right –

      - Cartesian3 –

      - to. (The second point to compute the distance) –

    Returns:

      A float, The distance between two points.

  static divideByScalar(cartesian, scalar, result)

    Divides the provided Cartesian componentwise by the provided scalar.

    Parameters:

      - cartesian –

      - Cartesian3 –

      - divided. (The Cartesian to be) –

      - scalar –

      - float –

      - by. (The scalar to divide) –

      - result – Cartesian3, The object onto which to store the result.

    Returns:

      A Cartesian3, The modified result parameter.

  static divideComponents(left, right, result)

    Computes the component wise quotient of two Cartesians.

    Parameters:

      - left –

      - Cartesian3 –

      - Cartesian. (The second) –

      - right –

      - Cartesian3 –

      - Cartesian. –

      - result – Cartesian3, The object onto which to store the result.

    Returns:

      A float, The modified result parameter.

  static dot(left, right)

    Computes the dot (scalar) product of two Cartesians.

    Parameters:

      - left –

      - Cartesian3 –

      - Cartesian. (The second) –

      - right –

      - Cartesian3 –

      - Cartesian. –

    Returns:

      A float, The dot product.

  static equals(left, right)

    Compares the provided Cartesians componentwise and return True if equal, False otherwise

    Parameters:

      - left –

      - Cartesian3 –

      - Cartesian. (The first) –

      - right – Cartesian3, The second Cartesian.

    Returns:

      A boolean, True if equal, False otherwise.

  static equalsEpsilon(left, right, relativeEpsilon=0.0, absoluteEpsilon=0.0)

    Compares the provided Cartesians componentwise and return True if they pass an absolute or relative tolerance test, False otherwise.

    Parameters:

      - left –

      - Cartesian3 –

      - Cartesian. (The first) –

      - right – Cartesian3, The second Cartesian.

      - relativeEpsilon –

      - float –

      - default=0 (The absolute epsilon tolerance to use for equality testing.) –

      - absoluteEpsilon –

      - float –

      - default=0 –

    Returns:

      A boolean, True if they pass an absolute or relative tolerance test, False otherwise.

  static fromArray(array, startingIndex=0, result=None)

    Creates a Cartesian3 from three consecutive elements in an array.

    Parameters:

      - array – list, The array whose three consecutive elements correspond to the x, y, and z components, respectively.

      - startingIndex – int, The offset into the array of the first element, which corresponds to the x component.

      - result – Cartesian3, The object onto which to store the result.

    Returns:

      A Cartesian3, The modified result parameter or a new Cartesian3 instance if one was not provided.

  static fromCartesian4(cartesian)

    Creates a Cartesian3 instance from an existing Cartesian3. This simply takes the x and y properties of the Cartesian3 and drops z and w.

    Parameters:

      - cartesian – Cartesian4, The cartesian to create from.

      - result – Cartesian3, The object onto which to store the result.

    Returns:

      A Cartesian3, The modified result parameter or a new Cartesian3 instance if one was not provided.

  static fromElements(x, y, z, result=None)

    Creates a Cartesian3 instance from x and y coordinates.

    Parameters:

      - x – float, The X component. default: 0

      - y – float, The Y component. default: 0

      - z – float, The Z component. default: 0

      - result – Cartesian3, The object onto which to store the result.

    Returns:

      A Cartesian3, The modified result parameter or a new Cartesian3 instance if one was not provided.

  static fromSpherical(spherical, result=None)

    Converts the provided Spherical into Cartesian3 coordinates.

    Parameters:

      - spherical – dict, The Spherical to be converted to Cartesian3.

      - result – Cartesian3, The object onto which to store the result.

    Returns:

      A Cartesian3, The modified result parameter or a new Cartesian3 instance if one was not provided.

  static lerp(start, end, t, result)

    Computes the linear interpolation or extrapolation at t using the provided cartesians.

    Parameters:

      - start –

      - Cartesian3 –

      - 0.0. (The value corresponding to t at) –

      - end –

      - Cartesian3 –

      - 1.0. (The value corresponding to t at) –

      - t –

      - Cartesian3 –

      - interpolate. (The point along t at which to) –

      - result – Cartesian3, The object onto which to store the result.

    Returns:

      A Cartesian3, The modified result parameter.

  static magnitude(cartesian)

    Computes the provided Cartesian’s magnitude (length).

    Parameters:

      cartesian – Cartesian3, he Cartesian instance whose magnitude is to be computed.

    Returns:

      A float, The magnitude.

  static magnitudeSquared(cartesian)

    Computes the provided Cartesian’s squared magnitude.

    Parameters:

      cartesian – Cartesian3, he Cartesian instance whose squared magnitude is to be computed.

    Returns:

      A float, The squared magnitude.

  static maximumByComponent(first, second, result)

    Computes the value of the maximum component for the supplied Cartesian.

    Parameters:

      - first – Cartesian3, The cartesian to compare.

      - second – Cartesian3, The cartesian to compare.

      - result – Cartesian3, The object onto which to store the result.

    Returns:

      A number, The value of the maximum component.

  static maximumComponent(cartesian)

    Computes the value of the maximum component for the supplied Cartesian.

    Parameters:

      cartesian – Cartesian3, The cartesian to use.

    Returns:

      A number, The value of the maximum component.

  static midpoint(left, right, result)

    Computes the midpoint between the right and left Cartesian.

    Parameters:

      - left –

      - Cartesian3 –

      - Cartesian. (The first) –

      - right – Cartesian3, The second Cartesian.

      - result – Cartesian3, The object onto which to store the result.

    Returns:

      A Cartesian3, The midpoint.

  static minimumByComponent(first, second, result)

    Computes the value of the minimum component for the supplied Cartesian.

    Parameters:

      - first – Cartesian3, The cartesian to compare.

      - second – Cartesian3, The cartesian to compare.

      - result – Cartesian3, The object onto which to store the result.

    Returns:

      A number, The value of the minimum component.

  static minimumComponent(cartesian)

    Computes the value of the minimum component for the supplied Cartesian.

    Parameters:

      cartesian – Cartesian3, The cartesian to use.

    Returns:

      A number, The value of the minimum component.

  static mostOrthogonalAxis(cartesian, result)

    Returns the angle, in radians, between the provided Cartesians.

    Parameters:

      - cartesian –

      - Cartesian3 –

      - axis. (The Cartesian on which to find the most orthogonal) –

      - result – Cartesian3, The object onto which to store the result.

    Returns:

      A Cartesian3, The most orthogonal axis.

  static multiplyByScalar(cartesian, scalar, result)

    Multiplies the provided Cartesian componentwise by the provided scalar.

    Parameters:

      - cartesian –

      - Cartesian3 –

      - scaled. (The Cartesian to be) –

      - scalar –

      - float –

      - with. (The scalar to multiply) –

      - result – Cartesian3, The object onto which to store the result.

    Returns:

      A Cartesian3, The modified result parameter.

  static multiplyComponents(left, right, result)

    Computes the componentwise product of two Cartesians.

    Parameters:

      - left –

      - Cartesian3 –

      - Cartesian. (The second) –

      - right –

      - Cartesian3 –

      - Cartesian. –

      - result – Cartesian3, The object onto which to store the result.

    Returns:

      A Cartesian3, The modified result parameter.

  static negate(cartesian, result)

    Negates the provided Cartesian.

    Parameters:

      - cartesian –

      - Cartesian3 –

      - negated. (The Cartesian to be) –

      - result – Cartesian3, The object onto which to store the result.

    Returns:

      A Cartesian3, The modified result parameter.

  static normalize(cartesian, result)

    Computes the normalized form of the supplied Cartesian.

    Parameters:

      - cartesian –

      - Cartesian3 –

      - normalized. (The Cartesian to be) –

      - result – Cartesian3, The object onto which to store the result.

    Returns:

      A Cartesian3, The modified result parameter.

  static projectVector(a, b, result)

    Projects vector a onto vector b.

    Parameters:

      - a –

      - Cartesian3 –

      - projecting. (The vector that needs) –

      - b – Cartesian3, The vector to project onto.

      - result – Cartesian3, The object onto which to store the result.

    Returns:

      A Cartesian3, The modified result parameter.

  static subtract(left, right, result)

    Computes the component wise difference of two Cartesians.

    Parameters:

      - left –

      - Cartesian3 –

      - Cartesian. (The second) –

      - right –

      - Cartesian3 –

      - Cartesian. –

      - result – Cartesian3, The object onto which to store the result.

    Returns:

      A Cartesian3, The modified result parameter.

## satsim.vecmath.Cartesian4 module

class satsim.vecmath.Cartesian4.Cartesian4(x=0.0, y=0.0, z=0.0, w=0.0)

  Bases: `object`

  A 4D Cartesian point.

  static ONE()

    A Cartesian4 instance initialized to (1.0, 1.0, 1.0, 1.0).

  static UNIT_W()

    A Cartesian4 instance initialized to (0.0, 0.0, 0.0, 1.0).

  static UNIT_X()

    A Cartesian4 instance initialized to (1.0, 0.0, 0.0, 0.0).

  static UNIT_Y()

    A Cartesian4 instance initialized to (0.0, 1.0, 0.0, 0.0).

  static UNIT_Z()

    A Cartesian4 instance initialized to (0.0, 0.0, 1.0, 0.0).

  static ZERO()

    A Cartesian4 instance initialized to (0.0, 0.0, 0.0, 0.0).

  static abs(cartesian, result)

    Computes the absolute value of the provided Cartesian.

    Parameters:

      - cartesian –

      - Cartesian4 –

      - computed. (The Cartesian whose absolute value is to be) –

      - result – Cartesian4, The object onto which to store the result.

    Returns:

      A Cartesian4, The modified result parameter.

  static add(left, right, result)

    Computes the component wise sum of two Cartesians.

    Parameters:

      - left –

      - Cartesian4 –

      - Cartesian. (The second) –

      - right –

      - Cartesian4 –

      - Cartesian. –

      - result – Cartesian4, The object onto which to store the result.

    Returns:

      A float, The modified result parameter.

  static clamp(value, min_val, max_val, result)

    Computes the value of the minimum component for the supplied Cartesian.

    Parameters:

      - value – Cartesian4, The value to clamp.

      - min_val – Cartesian4, The minimum bound.

      - max_val – Cartesian4, The maximum bound.

      - result – Cartesian4, The object onto which to store the result.

    Returns:

      A number, The clamped value such that min <= result <= max.

  static clone(cartesian=None, result=None)

    Duplicates a Cartesian4 instance.

    Parameters:

      - cartesian – Cartesian4, The cartesian to duplicate.

      - result – Cartesian4, The object onto which to store the result.

    Returns:

      A Cartesian4, The modified result parameter or a new Cartesian4 instance if one was not provided.

  static distance(left, right)

    Computes the distance between two points.

    Parameters:

      - left –

      - Cartesian4 –

      - from. (The first point to compute the distance) –

      - right –

      - Cartesian4 –

      - to. (The second point to compute the distance) –

    Returns:

      A float, The distance between two points.

  static distanceSquared(left, right)

    Computes the squared distance between two points. Comparing squared distances using this function is more efficient than comparing distances.

    Parameters:

      - left –

      - Cartesian4 –

      - from. (The first point to compute the distance) –

      - right –

      - Cartesian4 –

      - to. (The second point to compute the distance) –

    Returns:

      A float, The distance between two points.

  static divideByScalar(cartesian, scalar, result)

    Divides the provided Cartesian componentwise by the provided scalar.

    Parameters:

      - cartesian –

      - Cartesian4 –

      - divided. (The Cartesian to be) –

      - scalar –

      - float –

      - by. (The scalar to divide) –

      - result – Cartesian4, The object onto which to store the result.

    Returns:

      A Cartesian4, The modified result parameter.

  static divideComponents(left, right, result)

    Computes the component wise quotient of two Cartesians.

    Parameters:

      - left –

      - Cartesian4 –

      - Cartesian. (The second) –

      - right –

      - Cartesian4 –

      - Cartesian. –

      - result – Cartesian4, The object onto which to store the result.

    Returns:

      A float, The modified result parameter.

  static dot(left, right)

    Computes the dot (scalar) product of two Cartesians.

    Parameters:

      - left –

      - Cartesian4 –

      - Cartesian. (The second) –

      - right –

      - Cartesian4 –

      - Cartesian. –

    Returns:

      A float, The dot product.

  static equals(left, right)

    Compares the provided Cartesians componentwise and return True if equal, False otherwise

    Parameters:

      - left –

      - Cartesian4 –

      - Cartesian. (The first) –

      - right – Cartesian4, The second Cartesian.

    Returns:

      A boolean, True if equal, False otherwise.

  static equalsEpsilon(left, right, relativeEpsilon=0.0, absoluteEpsilon=0.0)

    Compares the provided Cartesians componentwise and return True if they pass an absolute or relative tolerance test, False otherwise.

    Parameters:

      - left –

      - Cartesian4 –

      - Cartesian. (The first) –

      - right – Cartesian4, The second Cartesian.

      - relativeEpsilon –

      - float –

      - default=0 (The absolute epsilon tolerance to use for equality testing.) –

      - absoluteEpsilon –

      - float –

      - default=0 –

    Returns:

      A boolean, True if they pass an absolute or relative tolerance test, False otherwise.

  static fromArray(array, startingIndex=0, result=None)

    Creates a Cartesian4 from four consecutive elements in an array.

    Parameters:

      - array – list, The array whose four consecutive elements correspond to the x y, z, and w components, respectively.

      - startingIndex – int, The offset into the array of the first element, which corresponds to the x component.

      - result – Cartesian4, The object onto which to store the result.

    Returns:

      A Cartesian4, The modified result parameter or a new Cartesian4 instance if one was not provided.

  static fromElements(x, y, z, w, result=None)

    Creates a Cartesian4 instance from x and y coordinates.

    Parameters:

      - x – float, The X component. default: 0

      - y – float, The Y component. default: 0

      - z – float, The Z component. default: 0

      - w – float, The W component. default: 0

      - result – Cartesian4, The object onto which to store the result.

    Returns:

      A Cartesian4, The modified result parameter or a new Cartesian4 instance if one was not provided.

  static lerp(start, end, t, result)

    Computes the linear interpolation or extrapolation at t using the provided cartesians.

    Parameters:

      - start –

      - Cartesian4 –

      - 0.0. (The value corresponding to t at) –

      - end –

      - Cartesian4 –

      - 1.0. (The value corresponding to t at) –

      - t –

      - Cartesian4 –

      - interpolate. (The point along t at which to) –

      - result – Cartesian4, The object onto which to store the result.

    Returns:

      A Cartesian4, The modified result parameter.

  static magnitude(cartesian)

    Computes the provided Cartesian’s magnitude (length).

    Parameters:

      cartesian – Cartesian4, he Cartesian instance whose magnitude is to be computed.

    Returns:

      A float, The magnitude.

  static magnitudeSquared(cartesian)

    Computes the provided Cartesian’s squared magnitude.

    Parameters:

      cartesian – Cartesian4, he Cartesian instance whose squared magnitude is to be computed.

    Returns:

      A float, The squared magnitude.

  static maximumByComponent(first, second, result)

    Computes the value of the maximum component for the supplied Cartesian.

    Parameters:

      - first – Cartesian4, The cartesian to compare.

      - second – Cartesian4, The cartesian to compare.

      - result – Cartesian4, The object onto which to store the result.

    Returns:

      A number, The value of the maximum component.

  static maximumComponent(cartesian)

    Computes the value of the maximum component for the supplied Cartesian.

    Parameters:

      cartesian – Cartesian4, The cartesian to use.

    Returns:

      A number, The value of the maximum component.

  static minimumByComponent(first, second, result)

    Computes the value of the minimum component for the supplied Cartesian.

    Parameters:

      - first – Cartesian4, The cartesian to compare.

      - second – Cartesian4, The cartesian to compare.

      - result – Cartesian4, The object onto which to store the result.

    Returns:

      A number, The value of the minimum component.

  static minimumComponent(cartesian)

    Computes the value of the minimum component for the supplied Cartesian.

    Parameters:

      cartesian – Cartesian4, The cartesian to use.

    Returns:

      A number, The value of the minimum component.

  static mostOrthogonalAxis(cartesian, result)

    Returns the angle, in radians, between the provided Cartesians.

    Parameters:

      - cartesian –

      - Cartesian4 –

      - axis. (The Cartesian on which to find the most orthogonal) –

      - result – Cartesian4, The object onto which to store the result.

    Returns:

      A Cartesian4, The most orthogonal axis.

  static multiplyByScalar(cartesian, scalar, result)

    Multiplies the provided Cartesian componentwise by the provided scalar.

    Parameters:

      - cartesian –

      - Cartesian4 –

      - scaled. (The Cartesian to be) –

      - scalar –

      - float –

      - with. (The scalar to multiply) –

      - result – Cartesian4, The object onto which to store the result.

    Returns:

      A Cartesian4, The modified result parameter.

  static multiplyComponents(left, right, result)

    Computes the componentwise product of two Cartesians.

    Parameters:

      - left –

      - Cartesian4 –

      - Cartesian. (The second) –

      - right –

      - Cartesian4 –

      - Cartesian. –

      - result – Cartesian4, The object onto which to store the result.

    Returns:

      A Cartesian4, The modified result parameter.

  static negate(cartesian, result)

    Negates the provided Cartesian.

    Parameters:

      - cartesian –

      - Cartesian4 –

      - negated. (The Cartesian to be) –

      - result – Cartesian4, The object onto which to store the result.

    Returns:

      A Cartesian4, The modified result parameter.

  static normalize(cartesian, result)

    Computes the normalized form of the supplied Cartesian.

    Parameters:

      - cartesian –

      - Cartesian4 –

      - normalized. (The Cartesian to be) –

      - result – Cartesian4, The object onto which to store the result.

    Returns:

      A Cartesian4, The modified result parameter.

  static subtract(left, right, result)

    Computes the component wise difference of two Cartesians.

    Parameters:

      - left –

      - Cartesian4 –

      - Cartesian. (The second) –

      - right –

      - Cartesian4 –

      - Cartesian. –

      - result – Cartesian4, The object onto which to store the result.

    Returns:

      A Cartesian4, The modified result parameter.

## satsim.vecmath.Matrix2 module

class satsim.vecmath.Matrix2.Matrix2(column0Row0=0.0, column1Row0=0.0, column0Row1=0.0, column1Row1=0.0)

  Bases: `object`

  A 2x2 matrix, indexable as a column-major order array. Constructor parameters are in row-major order for code readability.

  COLUMN0ROW0 = 0
  COLUMN0ROW1 = 1
  COLUMN1ROW0 = 2
  COLUMN1ROW1 = 3
  static IDENTITY()

    A Matrix2 initialized to the identity matrix.

  static ZERO()

    A Matrix2 initialized to the zero matrix.

  static abs(matrix, result)

    Computes a matrix, which contains the absolute (unsigned) values of the provided matrix’s elements.

    Parameters:

      - matrix –

      - Matrix2 –

      - elements. (The matrix with signed) –

      - result – Matrix2, The object onto which to store the result.

    Returns:

      A Matrix2, The modified result parameter.

  static add(left, right, result)

    Computes the sum of two matrices.

    Parameters:

      - left – Matrix2, The first matrix.

      - right – Matrix2, The second matrix.

      - result – Matrix2, The object onto which to store the result.

    Returns:

      A Matrix2, The modified result parameter.

  static clone(matrix=None, result=None)

    Duplicates a Matrix2 instance.

    Parameters:

      - matrix – Matrix2, The cartesian to duplicate.

      - result – Matrix2, The object onto which to store the result.

    Returns:

      A Matrix2, The modified result parameter or a new Matrix2 instance if one was not provided.

  static equalsEpsilon(left, right, epsilon)

    Compares the provided matrices componentwise and return True if they pass an absolute or relative tolerance test, False otherwise.

    Parameters:

      - left –

      - Matrix2 –

      - Cartesian. (The first) –

      - right – Matrix2, The second Cartesian.

      - epsilon –

      - float –

      - testing. (The epsilon to use for equality) –

    Returns:

      A boolean, True if they pass an absolute or relative tolerance test, False otherwise.

  static fromArray(array, startingIndex=0, result=None)

    Creates a Matrix2 from 4 consecutive elements in an array.

    Parameters:

      - array – list, The array whose 4 consecutive elements correspond to the positions of the matrix. Assumes column-major order.

      - startingIndex – int, The offset into the array of the first element, which corresponds to the x component.

      - result – Matrix2, The object onto which to store the result.

    Returns:

      A Matrix2, The modified result parameter or a new Matrix2 instance if one was not provided.

  static fromColumnMajorArray(values, result=None)

    Creates a Matrix2 from a column-major order array. The resulting matrix will be in column-major order.

    Parameters:

      - array – list, The column-major order array.

      - startingIndex – int, The offset into the array of the first element, which corresponds to the x component.

      - result – Matrix2, The object onto which to store the result.

    Returns:

      A Matrix2, The modified result parameter or a new Matrix2 instance if one was not provided.

  static fromRotation(angle, result=None)

    Creates a rotation matrix.

    Parameters:

      - angle – float, The angle, in radians, of the rotation. Positive angles are counterclockwise.

      - result – Matrix2, The object onto which to store the result.

    Returns:

      A Matrix2, The modified result parameter or a new Matrix2 instance if one was not provided.

  static fromRowMajorArray(values, result=None)

    Creates a Matrix2 from a row-major order array. The resulting matrix will be in column-major order.

    Parameters:

      - array – list, The row-major order array.

      - startingIndex – int, The offset into the array of the first element, which corresponds to the x component.

      - result – Matrix2, The object onto which to store the result.

    Returns:

      A Matrix2, The modified result parameter or a new Matrix2 instance if one was not provided.

  static fromScale(scale, result=None)

    Computes a Matrix2 instance representing a non-uniform scale.

    Parameters:

      - scale – Cartesian2, The x and y scale factors.

      - result – Matrix2, The object onto which to store the result.

    Returns:

      A Matrix2, The modified result parameter or a new Matrix2 instance if one was not provided.

  static fromUniformScale(scale, result=None)

    Computes a Matrix2 instance representing a uniform scale.

    Parameters:

      - scale – float, The uniform scale factor.

      - result – Matrix2, The object onto which to store the result.

    Returns:

      A Matrix2, The modified result parameter or a new Matrix2 instance if one was not provided.

  static getColumn(matrix, index, result)

    Retrieves a copy of the matrix column at the provided index as a Cartesian2 instance.

    Parameters:

      - matrix – Matrix2, The matrix to use.

      - index – int, The zero-based index of the column to retrieve.

      - result – Cartesian2, The object onto which to store the result.

    Returns:

      A Cartesian2, The modified result parameter.

  static getElementIndex(column, row)

    Computes the array index of the element at the provided row and column.

    Parameters:

      - row – int, The zero-based index of the row.

      - column – int, The zero-based index of the column.

    Returns:

      A int, The index of the element at the provided row and column.

  static getMaximumScale(matrix)

    Computes the maximum scale assuming the matrix is an affine transformation. The maximum scale is the maximum length of the column vectors.

    Parameters:

      matrix – Matrix2, The matrix.

    Returns:

      A float, The maximum scale.

  static getRotation(matrix, result)

    Extracts the rotation matrix assuming the matrix is an affine transformation.

    Parameters:

      - matrix – Matrix2, The matrix.

      - result – Matrix2, The object onto which to store the result.

    Returns:

      A Matrix2, The modified result parameter.

  static getRow(matrix, index, result)

    Retrieves a copy of the matrix row at the provided index as a Cartesian2 instance.

    Parameters:

      - matrix – Matrix2, The matrix to use.

      - index – int, The zero-based index of the row to retrieve.

      - result – Cartesian2, The object onto which to store the result.

    Returns:

      A Cartesian2, The modified result parameter.

  static getScale(matrix, result)

    Extracts the non-uniform scale assuming the matrix is an affine transformation.

    Parameters:

      - matrix – Matrix2, The matrix.

      - result – Cartesian2, The object onto which to store the result.

    Returns:

      A Cartesian2, The modified result parameter.

  static multiply(left, right, result)

    Computes the product of two matrices.

    Parameters:

      - left – Matrix2, The first matrix.

      - right – Matrix2, The second matrix.

      - result – Matrix2, The object onto which to store the result.

    Returns:

      A Matrix2, The modified result parameter.

  static multiplyByScalar(matrix, scalar, result)

    Computes the product of a matrix and a column vector.

    Parameters:

      - matrix – Matrix2, The first matrix.

      - scalar – float, The number to multiply by.

      - result – Matrix2, The object onto which to store the result.

    Returns:

      A Matrix2, The modified result parameter.

  static multiplyByScale(matrix, scale, result)

    Computes the product of a matrix times a (non-uniform) scale, as if the scale were a scale matrix.

    Parameters:

      - matrix – Matrix2, The first matrix.

      - scale – Cartesian2, The non-uniform scale on the right-hand side.

      - result – Matrix2, The object onto which to store the result.

    Returns:

      A Matrix2, The modified result parameter.

  static multiplyByUniformScale(matrix, scale, result)

    Computes the product of a matrix times a uniform scale, as if the scale were a scale matrix.

    Parameters:

      - matrix – Matrix2, The first matrix.

      - scale – float, The uniform scale on the right-hand side.

      - result – Matrix2, The object onto which to store the result.

    Returns:

      A Matrix2, The modified result parameter.

  static multiplyByVector(matrix, cartesian, result)

    Computes the product of a matrix and a column vector.

    Parameters:

      - matrix – Matrix2, The first matrix.

      - cartesian – Cartesian2, The column.

      - result – Matrix2, The object onto which to store the result.

    Returns:

      A Matrix2, The modified result parameter.

  static negate(matrix, result)

    Negates the provided matrix.

    Parameters:

      - matrix –

      - Matrix2 –

      - negated. (The matrix to be) –

      - result – Matrix2, The object onto which to store the result.

    Returns:

      A Matrix2, The modified result parameter.

  packedLength = 4
  static setColumn(matrix, index, cartesian, result)

    Computes a new matrix that replaces the specified column in the provided matrix with the provided Cartesian2 instance.

    Parameters:

      - matrix – Matrix2, The matrix to use.

      - index – int, The zero-based index of the column to retrieve.

      - cartesian – Cartesian2, The Cartesian whose values will be assigned to the specified column.

      - result – Matrix2, The object onto which to store the result.

    Returns:

      A Matrix2, The modified result parameter.

  static setRotation(matrix, rotation, result)

    Sets the rotation assuming the matrix is an affine transformation.

    Parameters:

      - matrix – Matrix2, The matrix to use.

      - rotation – Matrix2, The rotation matrix.

      - result – Matrix2, The object onto which to store the result.

    Returns:

      A Matrix2, The modified result parameter.

  static setRow(matrix, index, cartesian, result)

    Computes a new matrix that replaces the specified row in the provided matrix with the provided Cartesian2 instance.

    Parameters:

      - matrix – Matrix2, The matrix to use.

      - index – int, The zero-based index of the row to retrieve.

      - cartesian – Cartesian2, The Cartesian whose values will be assigned to the specified row.

      - result – Matrix2, The object onto which to store the result.

    Returns:

      A Matrix2, The modified result parameter.

  static setScale(matrix, scale, result)

    Computes a new matrix that replaces the scale with the provided scale. This assumes the matrix is an affine transformation.

    Parameters:

      - matrix – Matrix2, The matrix to use.

      - scale – Cartesian2, The scale that replaces the scale of the provided matrix.

      - result – Matrix2, The object onto which to store the result.

    Returns:

      A Matrix2, The modified result parameter.

  static setUniformScale(matrix, scale, result)

    Computes a new matrix that replaces the scale with the provided uniform scale. This assumes the matrix is an affine transformation.

    Parameters:

      - matrix – Matrix2, The matrix to use.

      - scale – float, The uniform scale that replaces the scale of the provided matrix.

      - result – Matrix2, The object onto which to store the result.

    Returns:

      A Matrix2, The modified result parameter.

  static subtract(left, right, result)

    Computes the difference of two matrices.

    Parameters:

      - left – Matrix2, The first matrix.

      - right – Matrix2, The second matrix.

      - result – Matrix2, The object onto which to store the result.

    Returns:

      A Matrix2, The modified result parameter.

  static toArray(matrix, result=None)

    Creates an Array from the provided Matrix2 instance. The array will be in column-major order.

    Parameters:

      - matrix – Matrix2, The matrix to use.

      - result – list, The Array onto which to store the result.

    Returns:

      A list, The modified Array parameter or a new Array instance if one was not provided.

  static transpose(matrix, result)

    Computes the transpose of the provided matrix.

    Parameters:

      - matrix –

      - Matrix2 –

      - transpose. (The matrix to be) –

      - result – Matrix2, The object onto which to store the result.

    Returns:

      A Matrix2, The modified result parameter.

## satsim.vecmath.Matrix3 module

class satsim.vecmath.Matrix3.Matrix3(column0Row0=0.0, column1Row0=0.0, column2Row0=0.0, column0Row1=0.0, column1Row1=0.0, column2Row1=0.0, column0Row2=0.0, column1Row2=0.0, column2Row2=0.0)

  Bases: `object`

  A 3x3 matrix, indexable as a column-major order array. Constructor parameters are in row-major order for code readability.

  COLUMN0ROW0 = 0
  COLUMN0ROW1 = 1
  COLUMN0ROW2 = 2
  COLUMN1ROW0 = 3
  COLUMN1ROW1 = 4
  COLUMN1ROW2 = 5
  COLUMN2ROW0 = 6
  COLUMN2ROW1 = 7
  COLUMN2ROW2 = 8
  static IDENTITY()

    A Matrix3 initialized to the identity matrix.

  static ZERO()

    A Matrix3 initialized to the zero matrix.

  static abs(matrix, result)

    Computes a matrix, which contains the absolute (unsigned) values of the provided matrix’s elements.

    Parameters:

      - matrix –

      - Matrix3 –

      - elements. (The matrix with signed) –

      - result – Matrix3, The object onto which to store the result.

    Returns:

      A Matrix3, The modified result parameter.

  static add(left, right, result)

    Computes the sum of two matrices.

    Parameters:

      - left – Matrix3, The first matrix.

      - right – Matrix3, The second matrix.

      - result – Matrix3, The object onto which to store the result.

    Returns:

      A Matrix3, The modified result parameter.

  static clone(matrix=None, result=None)

    Creates a Matrix3 from 9 consecutive elements in an array.

    Parameters:

      - array – list, The array whose 9 consecutive elements correspond to the positions of the matrix. Assumes column-major order.

      - startingIndex – int, The offset into the array of the first element, which corresponds to the x component.

      - result – Matrix3, The object onto which to store the result.

    Returns:

      A Matrix3, The modified result parameter or a new Matrix3 instance if one was not provided.

  static computeEigenDecomposition(matrix, result=None)

    Computes the eigenvectors and eigenvalues of a symmetric matrix.

    Parameters:

      - matrix –

      - Matrix3 –

      - symmetric. (The matrix to decompose into diagonal and unitary matrix. Expected to be) –

      - result – Matrix3, The object onto which to store the result.

    Returns:

      A Matrix3, The modified result parameter.

  static computeFrobeniusNorm(matrix)

    Computes the Frobenius norm.

    Parameters:

      - matrix –

      - Matrix3 –

      - computed. (The matrix to be) –

    Returns:

      A float, The Frobenius norm.

  static determinant(matrix)

    Computes the determinant of the provided matrix.

    Parameters:

      - matrix –

      - Matrix3 –

      - use. (The matrix to) –

    Returns:

      A float, The value of the determinant of the matrix.

  static equals(left, right)

    Compares the provided matrices componentwise and return True if they pass an absolute or relative tolerance test, False otherwise.

    Parameters:

      - left –

      - Matrix3 –

      - Cartesian. (The first) –

      - right – Matrix3, The second Cartesian.

      - relativeEpsilon –

      - float –

      - default=0 (The absolute epsilon tolerance to use for equality testing.) –

      - absoluteEpsilon –

      - float –

      - default=0 –

    Returns:

      A boolean, True if they pass an absolute or relative tolerance test, False otherwise.

  static equalsEpsilon(left, right, epsilon=0)

    Compares the provided matrices componentwise and return True if they pass an absolute or relative tolerance test, False otherwise.

    Parameters:

      - left –

      - Matrix3 –

      - Cartesian. (The first) –

      - right – Matrix3, The second Cartesian.

      - epsilon –

      - float –

      - testing. (The epsilon to use for equality) –

    Returns:

      A boolean, True if they pass an absolute or relative tolerance test, False otherwise.

  static fromArray(array, startingIndex=0, result=None)

    Creates a Matrix3 from 9 consecutive elements in an array.

    Parameters:

      - array – list, The array whose 9 consecutive elements correspond to the positions of the matrix. Assumes column-major order.

      - startingIndex – int, The offset into the array of the first element, which corresponds to the x component.

      - result – Matrix3, The object onto which to store the result.

    Returns:

      A Matrix3, The modified result parameter or a new Matrix3 instance if one was not provided.

  static fromColumnMajorArray(values, result=None)

    Creates a Matrix3 from a column-major order array. The resulting matrix will be in column-major order.

    Parameters:

      - values – list, The column-major order array.

      - startingIndex – int, The offset into the array of the first element, which corresponds to the x component.

      - result – Matrix3, The object onto which to store the result.

    Returns:

      A Matrix3, The modified result parameter or a new Matrix3 instance if one was not provided.

  static fromCrossProduct(vector, result=None)

    Computes a Matrix3 instance representing the cross product equivalent matrix of a Cartesian3 vector.

    Parameters:

      - vector – Cartesian3, The vector on the left hand side of the cross product operation.

      - result – Matrix3, The object onto which to store the result.

    Returns:

      A Matrix3, The modified result parameter or a new Matrix3 instance if one was not provided.

  static fromHeadingPitchRoll(headingPitchRoll, result=None)

    Computes a 3x3 rotation matrix from the provided headingPitchRoll.

    Parameters:

      - headingPitchRoll – dict, The headingPitchRoll to use.

      - result – Matrix3, The object onto which to store the result.

    Returns:

      A Matrix3, The modified result parameter or a new Matrix3 instance if one was not provided.

  static fromQuaternion(quaternion, result=None)

    Computes a 3x3 rotation matrix from the provided quaternion.

    Parameters:

      - quaternion – Quaternion, The quaternion to use.

      - result – Matrix3, The object onto which to store the result.

    Returns:

      A Matrix3, The modified result parameter or a new Matrix3 instance if one was not provided.

  static fromRotationX(angle, result=None)

    Creates a rotation matrix around the x-axis.

    Parameters:

      - angle – float, The angle, in radians, of the rotation. Positive angles are counterclockwise.

      - result – Matrix3, The object onto which to store the result.

    Returns:

      A Matrix3, The modified result parameter or a new Matrix3 instance if one was not provided.

  static fromRotationY(angle, result=None)

    Creates a rotation matrix around the y-axis.

    Parameters:

      - angle – float, The angle, in radians, of the rotation. Positive angles are counterclockwise.

      - result – Matrix3, The object onto which to store the result.

    Returns:

      A Matrix3, The modified result parameter or a new Matrix3 instance if one was not provided.

  static fromRotationZ(angle, result=None)

    Creates a rotation matrix around the z-axis.

    Parameters:

      - angle – float, The angle, in radians, of the rotation. Positive angles are counterclockwise.

      - result – Matrix3, The object onto which to store the result.

    Returns:

      A Matrix3, The modified result parameter or a new Matrix3 instance if one was not provided.

  static fromRowMajorArray(values, result=None)

    Creates a Matrix3 from a row-major order array. The resulting matrix will be in column-major order.

    Parameters:

      - values – list, The row-major order array.

      - startingIndex – int, The offset into the array of the first element, which corresponds to the x component.

      - result – Matrix3, The object onto which to store the result.

    Returns:

      A Matrix3, The modified result parameter or a new Matrix3 instance if one was not provided.

  static fromScale(scale, result=None)

    Computes a Matrix3 instance representing a non-uniform scale.

    Parameters:

      - scale – Cartesian3, The x, y, and z scale factors.

      - result – Matrix3, The object onto which to store the result.

    Returns:

      A Matrix3, The modified result parameter or a new Matrix3 instance if one was not provided.

  static fromUniformScale(scale, result=None)

    Computes a Matrix3 instance representing a uniform scale.

    Parameters:

      - scale – float, The uniform scale factor.

      - result – Matrix3, The object onto which to store the result.

    Returns:

      A Matrix3, The modified result parameter or a new Matrix3 instance if one was not provided.

  static getColumn(matrix, index, result)

    Retrieves a copy of the matrix column at the provided index as a Cartesian3 instance.

    Parameters:

      - matrix – Matrix3, The matrix to use.

      - index – int, The zero-based index of the column to retrieve.

      - result – Cartesian3, The object onto which to store the result.

    Returns:

      A Cartesian3, The modified result parameter.

  static getElementIndex(column, row)

    Computes the array index of the element at the provided row and column.

    Parameters:

      - row – int, The zero-based index of the row.

      - column – int, The zero-based index of the column.

    Returns:

      A int, The index of the element at the provided row and column.

  static getMaximumScale(matrix)

    Computes the maximum scale assuming the matrix is an affine transformation. The maximum scale is the maximum length of the column vectors.

    Parameters:

      matrix – Matrix3, The matrix.

    Returns:

      A float, The maximum scale.

  static getRotation(matrix, result)

    Extracts the rotation matrix assuming the matrix is an affine transformation.

    Parameters:

      - matrix – Matrix3, The matrix.

      - result – Matrix3, The object onto which to store the result.

    Returns:

      A Matrix3, The modified result parameter.

  static getRow(matrix, index, result)

    Retrieves a copy of the matrix row at the provided index as a Cartesian3 instance.

    Parameters:

      - matrix – Matrix3, The matrix to use.

      - index – int, The zero-based index of the row to retrieve.

      - result – Cartesian3, The object onto which to store the result.

    Returns:

      A Cartesian3, The modified result parameter.

  static getScale(matrix, result)

    Extracts the non-uniform scale assuming the matrix is an affine transformation.

    Parameters:

      - matrix – Matrix3, The matrix.

      - result – Cartesian3, The object onto which to store the result.

    Returns:

      A Cartesian3, The modified result parameter.

  static inverse(matrix, result)

    Computes the inverse of the provided matrix.

    Parameters:

      - matrix –

      - Matrix3 –

      - invert. (The matrix to) –

      - result – Matrix3, The object onto which to store the result.

    Returns:

      A Matrix3, The modified result parameter.

  static inverseTranspose(matrix, result)

    Computes the inverse transpose of a matrix.

    Parameters:

      - matrix –

      - Matrix3 –

      - invert. (The matrix to transpose and) –

      - result – Matrix3, The object onto which to store the result.

    Returns:

      A Matrix3, The modified result parameter.

  static multiply(left, right, result)

    Computes the product of two matrices.

    Parameters:

      - left – Matrix3, The first matrix.

      - right – Matrix3, The second matrix.

      - result – Matrix3, The object onto which to store the result.

    Returns:

      A Matrix3, The modified result parameter.

  static multiplyByScalar(matrix, scalar, result)

    Computes the product of a matrix and a scalar.

    Parameters:

      - matrix – Matrix3, The matrix.

      - scalar – float, The number to multiply by.

      - result – Matrix3, The object onto which to store the result.

    Returns:

      A Matrix3, The modified result parameter.

  static multiplyByScale(matrix, scale, result)

    Computes the product of a matrix times a (non-uniform) scale, as if the scale were a scale matrix.

    Parameters:

      - matrix – Matrix3, The matrix.

      - scale – Cartesian3, The non-uniform scale on the right-hand side.

      - result – Matrix3, The object onto which to store the result.

    Returns:

      A Matrix3, The modified result parameter.

  static multiplyByUniformScale(matrix, scale, result)

    Computes the product of a matrix times a uniform scale, as if the scale were a scale matrix.

    Parameters:

      - matrix – Matrix3, The matrix.

      - scale – float, The uniform scale on the right-hand side.

      - result – Matrix3, The object onto which to store the result.

    Returns:

      A Matrix3, The modified result parameter.

  static multiplyByVector(matrix, cartesian, result)

    Computes the product of a matrix and a column vector.

    Parameters:

      - matrix – Matrix3, The matrix.

      - cartesian – Cartesian3, The column.

      - result – Matrix3, The object onto which to store the result.

    Returns:

      A Matrix3, The modified result parameter.

  static negate(matrix, result)

    Negates the provided matrix.

    Parameters:

      - matrix –

      - Matrix3 –

      - negated. (The matrix to be) –

      - result – Matrix3, The object onto which to store the result.

    Returns:

      A Matrix3, The modified result parameter.

  static offDiagonalFrobeniusNorm(matrix)

    Computes the “off-diagonal” Frobenius norm. Assumes matrix is symmetric.

    Parameters:

      - matrix –

      - Matrix3 –

      - computed. (The matrix to be) –

    Returns:

      A float, The Frobenius norm.

  packedLength = 9
  static setColumn(matrix, index, cartesian, result)

    Computes a new matrix that replaces the specified column in the provided matrix with the provided Cartesian3 instance.

    Parameters:

      - matrix – Matrix3, The matrix to use.

      - index – int, The zero-based index of the column to retrieve.

      - cartesian – Cartesian3, The Cartesian whose values will be assigned to the specified column.

      - result – Matrix3, The object onto which to store the result.

    Returns:

      A Matrix3, The modified result parameter.

  static setRotation(matrix, rotation, result)

    Sets the rotation assuming the matrix is an affine transformation.

    Parameters:

      - matrix – Matrix3, The matrix to use.

      - rotation – Matrix3, The rotation matrix.

      - result – Matrix3, The object onto which to store the result.

    Returns:

      A Matrix3, The modified result parameter.

  static setRow(matrix, index, cartesian, result)

    Computes a new matrix that replaces the specified row in the provided matrix with the provided Cartesian3 instance.

    Parameters:

      - matrix – Matrix3, The matrix to use.

      - index – int, The zero-based index of the row to retrieve.

      - cartesian – Cartesian3, The Cartesian whose values will be assigned to the specified row.

      - result – Matrix3, The object onto which to store the result.

    Returns:

      A Matrix3, The modified result parameter.

  static setScale(matrix, scale, result)

    Computes a new matrix that replaces the scale with the provided scale. This assumes the matrix is an affine transformation.

    Parameters:

      - matrix – Matrix3, The matrix to use.

      - scale – Cartesian3, The scale that replaces the scale of the provided matrix.

      - result – Matrix3, The object onto which to store the result.

    Returns:

      A Matrix3, The modified result parameter.

  static setUniformScale(matrix, scale, result)

    Computes a new matrix that replaces the scale with the provided uniform scale. This assumes the matrix is an affine transformation.

    Parameters:

      - matrix – Matrix3, The matrix to use.

      - scale – float, The uniform scale that replaces the scale of the provided matrix.

      - result – Matrix3, The object onto which to store the result.

    Returns:

      A Matrix3, The modified result parameter.

  static shurDecomposition(matrix, result)

    This routine was created based upon Matrix Computations, 3rd ed., by Golub and Van Loan, section 8.4.2 The 2by2 Symmetric Schur Decomposition. The routine takes a matrix, which is assumed to be symmetric, and finds the largest off-diagonal term, and then creates a matrix (result) which can be used to help reduce it

    Parameters:

      - matrix –

      - Matrix3 –

      - matrix. (The) –

      - result – Matrix3, The object onto which to store the result.

    Returns:

      A Matrix3, The modified result parameter.

  static subtract(left, right, result)

    Computes the difference of two matrices.

    Parameters:

      - left – Matrix3, The first matrix.

      - right – Matrix3, The second matrix.

      - result – Matrix3, The object onto which to store the result.

    Returns:

      A Matrix3, The modified result parameter.

  static toArray(matrix, result=None)

    Creates an Array from the provided Matrix3 instance. The array will be in column-major order.

    Parameters:

      - matrix – Matrix3, The matrix to use.

      - result – list, The Array onto which to store the result.

    Returns:

      A list, The modified Array parameter or a new Array instance if one was not provided.

  static transpose(matrix, result)

    Computes the transpose of the provided matrix.

    Parameters:

      - matrix –

      - Matrix3 –

      - transpose. (The matrix to be) –

      - result – Matrix3, The object onto which to store the result.

    Returns:

      A Matrix3, The modified result parameter.

## satsim.vecmath.Matrix4 module

class satsim.vecmath.Matrix4.Matrix4(column0Row0=0.0, column1Row0=0.0, column2Row0=0.0, column3Row0=0.0, column0Row1=0.0, column1Row1=0.0, column2Row1=0.0, column3Row1=0.0, column0Row2=0.0, column1Row2=0.0, column2Row2=0.0, column3Row2=0.0, column0Row3=0.0, column1Row3=0.0, column2Row3=0.0, column3Row3=0.0)

  Bases: `object`

  A 4x4 matrix, indexable as a column-major order array. Constructor parameters are in row-major order for code readability.

  COLUMN0ROW0 = 0
  COLUMN0ROW1 = 1
  COLUMN0ROW2 = 2
  COLUMN0ROW3 = 3
  COLUMN1ROW0 = 4
  COLUMN1ROW1 = 5
  COLUMN1ROW2 = 6
  COLUMN1ROW3 = 7
  COLUMN2ROW0 = 8
  COLUMN2ROW1 = 9
  COLUMN2ROW2 = 10
  COLUMN2ROW3 = 11
  COLUMN3ROW0 = 12
  COLUMN3ROW1 = 13
  COLUMN3ROW2 = 14
  COLUMN3ROW3 = 15
  static IDENTITY()

    A Matrix4 initialized to the identity matrix.

  static ZERO()

    A Matrix4 initialized to the zero matrix.

  static abs(matrix, result)

    Computes a matrix, which contains the absolute (unsigned) values of the provided matrix’s elements.

    Parameters:

      - matrix –

      - Matrix4 –

      - elements. (The matrix with signed) –

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter.

  static add(left, right, result)

    Computes the sum of two matrices.

    Parameters:

      - left – Matrix4, The first matrix.

      - right – Matrix4, The second matrix.

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter.

  static clone(matrix=None, result=None)

    Creates a Matrix4 from 16 consecutive elements in an array.

    Parameters:

      - array – list, The array whose 16 consecutive elements correspond to the positions of the matrix. Assumes column-major order.

      - startingIndex – int, The offset into the array of the first element, which corresponds to the x component.

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter or a new Matrix4 instance if one was not provided.

  static computeInfinitePerspectiveOffCenter(left, right, bottom, top, near, result=None)

    Computes a Matrix4 instance representing an infinite off center perspective transformation.

    Parameters:

      - left – float, The number of meters to the left of the camera that will be in view.

      - right – float, The number of meters to the right of the camera that will be in view.

      - bottom – float, The number of meters below of the camera that will be in view.

      - top – float, The number of meters above of the camera that will be in view.

      - near – float, The distance to the near plane in meters.

      - far – float, The distance to the far plane in meters.

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter or a new Matrix4 instance if one was not provided.

  static computeLookAt(position, target, up, result=None)

    Computes look at transform from observer to target.

    Parameters:

      - position – Cartesian3, The observer position.

      - target – Cartesian3, The target position.

      - up – Cartesian3, The up direction.

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter or a new Matrix4 instance if one was not provided.

  static computeOrthographicOffCenter(left, right, bottom, top, near, far, result=None)

    Computes a Matrix4 instance representing a perspective transformation matrix.

    Parameters:

      - left – float, The number of meters to the left of the camera that will be in view.

      - right – float, The number of meters to the right of the camera that will be in view.

      - bottom – float, The number of meters below of the camera that will be in view.

      - top – float, The number of meters above of the camera that will be in view.

      - near – float, The distance to the near plane in meters.

      - far – float, The distance to the far plane in meters.

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter or a new Matrix4 instance if one was not provided.

  static computePerspectiveFieldOfView(fovY, aspectRatio, near, far, result=None)

    Computes a Matrix4 instance representing a perspective transformation matrix.

    Parameters:

      - fovY – float, The field of view along the Y axis in radians.

      - aspectRatio – float, The aspect ratio.

      - near – float, The distance to the near plane in meters.

      - far – float, The distance to the far plane in meters.

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter or a new Matrix4 instance if one was not provided.

  static computePerspectiveOffCenter(left, right, bottom, top, near, far, result=None)

    Computes a Matrix4 instance representing an off center perspective transformation.

    Parameters:

      - left – float, The number of meters to the left of the camera that will be in view.

      - right – float, The number of meters to the right of the camera that will be in view.

      - bottom – float, The number of meters below of the camera that will be in view.

      - top – float, The number of meters above of the camera that will be in view.

      - near – float, The distance to the near plane in meters.

      - far – float, The distance to the far plane in meters.

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter or a new Matrix4 instance if one was not provided.

  static computeView(position, direction, up, right, result=None)

    Computes a Matrix4 instance that transforms from world space to view space.

    Parameters:

      - position – Cartesian3, The position of the camera.

      - direction – Cartesian3, The forward direction.

      - up – Cartesian3, The up direction.

      - right – Cartesian3, The right direction.

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter or a new Matrix4 instance if one was not provided.

  static computeViewportTransformation(viewport={}, nearDepthRange=0.0, farDepthRange=1.0, result=None)

    Computes a Matrix4 instance that transforms from normalized device coordinates to window coordinates.

    Parameters:

      - viewport – dict, The viewport’s corners.

      - nearDepthRange – float, The near plane distance in window coordinates.

      - farDepthRange – float, The far plane distance in window coordinates.

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter or a new Matrix4 instance if one was not provided.

  static equalsEpsilon(left, right, epsilon=0)

    Compares the provided matrices componentwise and return True if they pass an absolute or relative tolerance test, False otherwise.

    Parameters:

      - left –

      - Matrix4 –

      - Cartesian. (The first) –

      - right – Matrix4, The second Cartesian.

      - epsilon –

      - float –

      - testing. (The epsilon to use for equality) –

    Returns:

      A boolean, True if they pass an absolute or relative tolerance test, False otherwise.

  static fromArray(array, startingIndex=0, result=None)

    Creates a Matrix4 from 16 consecutive elements in an array.

    Parameters:

      - array – list, The array whose 16 consecutive elements correspond to the positions of the matrix. Assumes column-major order.

      - startingIndex – int, The offset into the array of the first element, which corresponds to the x component.

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter or a new Matrix4 instance if one was not provided.

  static fromCamera(camera, result=None)

    Computes a Matrix4 instance from a Camera.

    Parameters:

      - camera – dict, The camera to use.

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter or a new Matrix4 instance if one was not provided.

  static fromColumnMajorArray(values, result=None)

    Creates a Matrix4 from a column-major order array. The resulting matrix will be in column-major order.

    Parameters:

      - values – list, The column-major order array.

      - startingIndex – int, The offset into the array of the first element, which corresponds to the x component.

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter or a new Matrix4 instance if one was not provided.

  static fromRotation(rotation, result=None)

    Creates a rotation matrix.

    Parameters:

      - rotation – Matrix3, The rotation matrix.

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter or a new Matrix4 instance if one was not provided.

  static fromRotationTranslation(rotation, translation=<satsim.vecmath.Cartesian3.Cartesian3 object>, result=None)

    Computes a Matrix4 instance from a Matrix3 representing the rotation and a Cartesian3 representing the translation.

    Parameters:

      - rotation – Matrix3, The upper left portion of the matrix representing the rotation.

      - translation – Cartesian3, The upper right portion of the matrix representing the translation.

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter or a new Matrix4 instance if one was not provided.

  static fromRowMajorArray(values, result=None)

    Creates a Matrix4 from a row-major order array. The resulting matrix will be in column-major order.

    Parameters:

      - values – list, The row-major order array.

      - startingIndex – int, The offset into the array of the first element, which corresponds to the x component.

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter or a new Matrix4 instance if one was not provided.

  static fromScale(scale, result=None)

    Computes a Matrix4 instance representing a non-uniform scale.

    Parameters:

      - scale – Cartesian3, The x, y, and z scale factors.

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter or a new Matrix4 instance if one was not provided.

  static fromTranslation(translation, result=None)

    Creates a Matrix4 instance from a Cartesian3 representing the translation.

    Parameters:

      - translation – Cartesian3, The translation transformation.

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter or a new Matrix4 instance if one was not provided.

  static fromTranslationQuaternionRotationScale(translation, rotation, scale, result=None)

    Computes a Matrix4 instance from a translation, rotation, and scale (TRS) representation with the rotation represented as a quaternion.

    Parameters:

      - translation – Cartesian3, The translation transformation.

      - rotation – Quaternion, The rotation transformation.

      - scale – Cartesian3, The non-uniform scale transformation.

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter or a new Matrix4 instance if one was not provided.

  static fromTranslationRotationScale(translationRotationScale, result=None)

    Creates a Matrix4 instance from a dict.

    Parameters:

      - translationRotationScale – dict, The translation, rotation, and scale.

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter or a new Matrix4 instance if one was not provided.

  static fromUniformScale(scale, result=None)

    Computes a Matrix4 instance representing a uniform scale.

    Parameters:

      - scale – float, The uniform scale factor.

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter or a new Matrix4 instance if one was not provided.

  static getColumn(matrix, index, result)

    Retrieves a copy of the matrix column at the provided index as a Cartesian3 instance.

    Parameters:

      - matrix – Matrix4, The matrix to use.

      - index – int, The zero-based index of the column to retrieve.

      - result – Cartesian3, The object onto which to store the result.

    Returns:

      A Cartesian3, The modified result parameter.

  static getElementIndex(column, row)

    Computes the array index of the element at the provided row and column.

    Parameters:

      - row – int, The zero-based index of the row.

      - column – int, The zero-based index of the column.

    Returns:

      A int, The index of the element at the provided row and column.

  static getMatrix3(matrix, result)

    Gets the upper left 3x3 matrix of the provided matrix.

    Parameters:

      - matrix –

      - Matrix4 –

      - use. (The matrix to) –

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter.

  static getMaximumScale(matrix)

    Computes the maximum scale assuming the matrix is an affine transformation. The maximum scale is the maximum length of the column vectors.

    Parameters:

      matrix – Matrix4, The matrix.

    Returns:

      A float, The maximum scale.

  static getRotation(matrix, result)

    Extracts the rotation matrix assuming the matrix is an affine transformation.

    Parameters:

      - matrix – Matrix4, The matrix.

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter.

  static getRow(matrix, index, result)

    Retrieves a copy of the matrix row at the provided index as a Cartesian3 instance.

    Parameters:

      - matrix – Matrix4, The matrix to use.

      - index – int, The zero-based index of the row to retrieve.

      - result – Cartesian4, The object onto which to store the result.

    Returns:

      A Cartesian4, The modified result parameter.

  static getScale(matrix, result)

    Extracts the non-uniform scale assuming the matrix is an affine transformation.

    Parameters:

      - matrix – Matrix4, The matrix.

      - result – Cartesian3, The object onto which to store the result.

    Returns:

      A Cartesian3, The modified result parameter.

  static getTranslation(matrix, result)

    Gets the translation portion of the provided matrix, assuming the matrix is an affine transformation matrix.

    Parameters:

      - matrix –

      - Matrix4 –

      - use. (The matrix to) –

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter.

  static inverse(matrix, result)

    Computes the inverse of the provided matrix using Cramers Rule. If the determinant is zero, the matrix can not be inverted, and an exception is thrown. If the matrix is a proper rigid transformation, it is more efficient to invert it with {@link Matrix4.inverseTransformation}.

    Parameters:

      - matrix –

      - Matrix4 –

      - invert. (The matrix to) –

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter.

  static inverseTransformation(matrix, result)

    Computes the inverse of the provided matrix assuming it is a proper rigid matrix, where the upper left 3x3 elements are a rotation matrix, and the upper three elements in the fourth column are the translation. The bottom row is assumed to be [0, 0, 0, 1]. The matrix is not verified to be in the proper form. This method is faster than computing the inverse for a general 4x4 matrix using inverse.

    Parameters:

      - matrix –

      - Matrix4 –

      - invert. (The matrix to) –

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter.

  static inverseTranspose(matrix, result)

    Computes the inverse transpose of a matrix.

    Parameters:

      - matrix –

      - Matrix4 –

      - invert. (The matrix to transpose and) –

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter.

  m

    Constructor.

    Parameters:

      - column0Row0 – float, The value for column 0, row 0.

      - column1Row0 – float, The value for column 1, row 0.

      - column2Row0 – float, The value for column 2, row 0.

      - column3Row0 – float, The value for column 3, row 0.

      - column0Row1 – float, The value for column 0, row 1.

      - column1Row1 – float, The value for column 1, row 1.

      - column2Row1 – float, The value for column 2, row 1.

      - column3Row1 – float, The value for column 3, row 1.

      - column0Row2 – float, The value for column 0, row 2.

      - column1Row2 – float, The value for column 1, row 2.

      - column2Row2 – float, The value for column 2, row 2.

      - column3Row2 – float, The value for column 3, row 2.

      - column0Row3 – float, The value for column 0, row 3.

      - column1Row3 – float, The value for column 1, row 3.

      - column2Row3 – float, The value for column 2, row 3.

      - column3Row3 – float, The value for column 3, row 3.

  static multiply(left, right, result)

    Computes the product of two matrices.

    Parameters:

      - left – Matrix4, The first matrix.

      - right – Matrix4, The second matrix.

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter.

  static multiplyByMatrix3(matrix, rotation, result)

    Multiplies a transformation matrix by a 3x3 rotation matrix. This is an optimization with less allocations and arithmetic operations than fromRotationTranslation.

    Parameters:

      - matrix – Matrix4, The matrix on the left-hand side.

      - rotation – Matrix4, The 3x3 rotation matrix on the right-hand side.

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter.

  static multiplyByPoint(matrix, cartesian, result)
    Computes the product of a matrix and a Cartesian3. This is equivalent to calling multiplyByVector

      with a Cartesian4 with a w component of 1, but returns a Cartesian3 instead of a Cartesian4.

    Parameters:

      - matrix – Matrix4, The matrix.

      - cartesian – Cartesian4, The point.

      - result – Cartesian4, The object onto which to store the result.

    Returns:

      A Cartesian4, The modified result parameter.

  static multiplyByPointAsVector(matrix, cartesian, result)

    Computes the product of a matrix and a Cartesian3.

    Parameters:

      - matrix – Matrix4, The matrix.

      - cartesian – Cartesian4, The point.

      - result – Cartesian4, The object onto which to store the result.

    Returns:

      A Cartesian4, The modified result parameter.

  static multiplyByScalar(matrix, scalar, result)

    Computes the product of a matrix and a scalar.

    Parameters:

      - matrix – Matrix4, The matrix.

      - scalar – float, The number to multiply by.

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter.

  static multiplyByScale(matrix, scale, result)

    Multiplies a transformation matrix by an implicit non-uniform scale matrix. This is an optimization with less allocations and arithmetic operations than fromRotationTranslation.

    Parameters:

      - matrix – Matrix4, The matrix on the left-hand side.

      - scale – Cartesian3, The non-uniform scale on the right-hand side.

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter.

  static multiplyByTranslation(matrix, translation, result)

    Multiplies a transformation matrix by an implicit translation matrix defined by a Cartesian3. This is an optimization with less allocations and arithmetic operations than fromRotationTranslation.

    Parameters:

      - matrix – Matrix4, The matrix on the left-hand side.

      - translation – Matrix4, The translation on the right-hand side.

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter.

  static multiplyByUniformScale(matrix, scale, result)

    Computes the product of a matrix times a uniform scale, as if the scale were a scale matrix.

    Parameters:

      - matrix – Matrix4, The matrix on the left-hand side.

      - scale – float, The uniform scale on the right-hand side.

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter.

  static multiplyByVector(matrix, cartesian, result)

    Computes the product of a matrix and a column vector.

    Parameters:

      - matrix – Matrix4, The matrix.

      - cartesian – Cartesian4, The vector.

      - result – Cartesian4, The object onto which to store the result.

    Returns:

      A Cartesian4, The modified result parameter.

  static multiplyTransformation(left, right, result)

    Computes the product of two matrices assuming the matrices are affine transformation matrices, where the upper left 3x3 elements are any matrix, and the upper three elements in the fourth column are the translation. The bottom row is assumed to be [0, 0, 0, 1]. The matrix is not verified to be in the proper form. This method is faster than computing the product for general 4x4 matrices.

    Parameters:

      - left – Matrix4, The first matrix.

      - right – Matrix4, The second matrix.

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter.

  static negate(matrix, result)

    Negates the provided matrix.

    Parameters:

      - matrix –

      - Matrix4 –

      - negated. (The matrix to be) –

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter.

  packedLength = 16
  static setColumn(matrix, index, cartesian, result)

    Computes a new matrix that replaces the specified column in the provided matrix with the provided Cartesian3 instance.

    Parameters:

      - matrix – Matrix4, The matrix to use.

      - index – int, The zero-based index of the column to retrieve.

      - cartesian – Cartesian3, The Cartesian whose values will be assigned to the specified column.

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter.

  static setRotation(matrix, rotation, result)

    Sets the rotation assuming the matrix is an affine transformation.

    Parameters:

      - matrix – Matrix4, The matrix to use.

      - rotation – Matrix3, The rotation matrix.

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter.

  static setRow(matrix, index, cartesian, result)

    Computes a new matrix that replaces the specified row in the provided matrix with the provided Cartesian3 instance.

    Parameters:

      - matrix – Matrix4, The matrix to use.

      - index – int, The zero-based index of the row to retrieve.

      - cartesian – Cartesian3, The Cartesian whose values will be assigned to the specified row.

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter.

  static setScale(matrix, scale, result)

    Computes a new matrix that replaces the scale with the provided scale. This assumes the matrix is an affine transformation.

    Parameters:

      - matrix – Matrix4, The matrix to use.

      - scale – Cartesian3, The scale that replaces the scale of the provided matrix.

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter.

  static setTranslation(matrix, translation, result)
    Computes a new matrix that replaces the translation in the rightmost column of the provided

      matrix with the provided translation. This assumes the matrix is an affine transformation.

    Parameters:

      - matrix – Matrix4, The matrix to use.

      - translation – Cartesian3, The translation that replaces the translation of the provided matrix.

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter.

  static setUniformScale(matrix, scale, result)

    Computes a new matrix that replaces the scale with the provided uniform scale. This assumes the matrix is an affine transformation.

    Parameters:

      - matrix – Matrix4, The matrix to use.

      - scale – float, The uniform scale that replaces the scale of the provided matrix.

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter.

  static subtract(left, right, result)

    Computes the difference of two matrices.

    Parameters:

      - left – Matrix4, The first matrix.

      - right – Matrix4, The second matrix.

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter.

  static toArray(matrix, result=None)

    Creates an Array from the provided Matrix4 instance. The array will be in column-major order.

    Parameters:

      - matrix – Matrix4, The matrix to use.

      - result – list, The Array onto which to store the result.

    Returns:

      A list, The modified Array parameter or a new Array instance if one was not provided.

  static transpose(matrix, result)

    Computes the transpose of the provided matrix.

    Parameters:

      - matrix –

      - Matrix4 –

      - transpose. (The matrix to be) –

      - result – Matrix4, The object onto which to store the result.

    Returns:

      A Matrix4, The modified result parameter.

## satsim.vecmath.Quaternion module

class satsim.vecmath.Quaternion.Quaternion(x=0.0, y=0.0, z=0.0, w=0.0)

  Bases: `object`

  A 4D Cartesian point.

  static add(left, right, result)

    Computes the component wise sum of two Quaternions.

    Parameters:

      - left –

      - Quaternion –

      - Cartesian. (The second) –

      - right –

      - Quaternion –

      - Cartesian. –

      - result – Quaternion, The object onto which to store the result.

    Returns:

      A float, The modified result parameter.

  static clone(quaternion=None, result=None)

    Duplicates a Quaternion instance.

    Parameters:

      - quaternion – Quaternion, The quaternion to duplicate.

      - result – Quaternion, The object onto which to store the result.

    Returns:

      A Quaternion, The modified result parameter or a new Quaternion instance if one was not provided.

  static computeAngle(quaternion)

    Computes the angle of rotation of the provided quaternion.

    Parameters:

      - quaternion –

      - Quaternion –

      - use. (The quaternion to) –

    Returns:

      A float, The angle of rotation.

  static computeAxis(quaternion, result)

    Computes the axis of rotation of the provided quaternion.

    Parameters:

      - quaternion –

      - Quaternion –

      - use. (The quaternion to) –

      - result – Quaternion, The object onto which to store the result.

    Returns:

      A Quaternion, The modified result parameter.

  static computeInnerQuadrangle(q0, q1, q2, result)

    Computes an inner quadrangle point.

    Parameters:

      - q0 –

      - Quaternion –

      - quaternion. (The third) –

      - q1 –

      - Quaternion –

      - quaternion. –

      - q2 –

      - Quaternion –

      - quaternion. –

      - result – Quaternion, The object onto which to store the result.

    Returns:

      A Quaternion, The modified result parameter.

  static conjugate(quaternion, result)

    Computes the conjugate of the provided quaternion.

    Parameters:

      - quaternion – Quaternion, The quaternion to conjugate.

      - result – Quaternion, The object onto which to store the result.

    Returns:

      A Quaternion, The modified result parameter.

  static divideByScalar(quaternion, scalar, result)

    Divides the provided Cartesian componentwise by the provided scalar.

    Parameters:

      - quaternion –

      - Quaternion –

      - divided. (The Cartesian to be) –

      - scalar –

      - float –

      - by. (The scalar to divide) –

      - result – Quaternion, The object onto which to store the result.

    Returns:

      A Quaternion, The modified result parameter.

  static dot(left, right)

    Computes the dot (scalar) product of two Quaternions.

    Parameters:

      - left –

      - Quaternion –

      - Cartesian. (The second) –

      - right –

      - Quaternion –

      - Cartesian. –

    Returns:

      A float, The dot product.

  static equals(left, right)

    Compares the provided Quaternions componentwise and return True if equal, False otherwise

    Parameters:

      - left –

      - Quaternion –

      - Cartesian. (The first) –

      - right – Quaternion, The second Cartesian.

    Returns:

      A boolean, True if equal, False otherwise.

  static equalsEpsilon(left, right, epsilon=0)

    Compares the provided Quaternions componentwise and return True if they pass an absolute or relative tolerance test, False otherwise.

    Parameters:

      - left –

      - Quaternion –

      - Cartesian. (The first) –

      - right – Quaternion, The second Cartesian.

      - relativeEpsilon –

      - float –

      - default=0 (The absolute epsilon tolerance to use for equality testing.) –

      - absoluteEpsilon –

      - float –

      - default=0 –

    Returns:

      A boolean, True if they pass an absolute or relative tolerance test, False otherwise.

  static exp(cartesian, result)

    The exponential quaternion function.

    Parameters:

      - cartesian –

      - Cartesian3 –

      - cartesian. (The) –

      - result – Quaternion, The object onto which to store the result.

    Returns:

      A Quaternion, The modified result parameter.

  static fastSlerp(start, end, t, result)

    Computes the spherical linear interpolation or extrapolation at t using the provided quaternions. Note: This implementation is faster but is only accurate to 10e-6.

    Parameters:

      - start –

      - Quaternion –

      - 0.0. (The value corresponding to t at) –

      - end –

      - Quaternion –

      - 1.0. (The value corresponding to t at) –

      - t –

      - float –

      - interpolate. (The point along t at which to) –

      - result – Quaternion, The object onto which to store the result.

    Returns:

      A Quaternion, The modified result parameter.

  static fastSquad(q0, q1, s0, s1, t, result)

    Computes the spherical quadrangle interpolation between quaternions. Note: This implementation is faster but is only accurate to 10e-6.

    Parameters:

      - q0 –

      - Quaternion –

      - quaternion. (The second) –

      - q1 –

      - Quaternion –

      - quaternion. –

      - s0 –

      - Quaternion –

      - quadrangle. (The first inner) –

      - s1 –

      - Quaternion –

      - quadrangle. –

      - t –

      - float –

      - interpolate. (The point along t at which to) –

      - result – Quaternion, The object onto which to store the result.

    Returns:

      A Quaternion, The modified result parameter.

  static fromAxisAngle(axis, angle, result=None)

    Computes a quaternion representing a rotation around an axis.

    Parameters:

      - axis – Cartesian3, The axis of rotation.

      - angle – float, The angle in radians to rotate around the axis.

      - result – Quaternion, The object onto which to store the result.

    Returns:

      A Quaternion, The modified result parameter or a new Quaternion instance if one was not provide

  static fromHeadingPitchRoll(headingPitchRoll, result=None)

    Computes a rotation from the given heading, pitch and roll angles. Heading is the rotation about the negative z axis. Pitch is the rotation about the negative y axis. Roll is the rotation about the positive x axis.

    Parameters:

      - headingPitchRoll – dict, The rotation expressed as a heading, pitch and roll.

      - result – Quaternion, The object onto which to store the result.

    Returns:

      A Quaternion, The modified result parameter or a new Quaternion instance if one was not provide

  static fromRotationMatrix(matrix, result=None)

    Computes a Quaternion from the provided Matrix3 instance.

    Parameters:

      - axis – Cartesian3, The axis of rotation.

      - angle – float, The angle in radians to rotate around the axis.

      - result – Quaternion, The object onto which to store the result.

    Returns:

      A Quaternion, The modified result parameter or a new Quaternion instance if one was not provide

  static inverse(quaternion, result)

    Computes the inverse of the provided quaternion.

    Parameters:

      - quaternion –

      - Quaternion –

      - invert. (The quaternion to) –

      - result – Quaternion, The object onto which to store the result.

    Returns:

      A Quaternion, The modified result parameter.

  static lerp(start, end, t, result)

    Computes the linear interpolation or extrapolation at t using the provided cartesians.

    Parameters:

      - start –

      - Quaternion –

      - 0.0. (The value corresponding to t at) –

      - end –

      - Quaternion –

      - 1.0. (The value corresponding to t at) –

      - t –

      - float –

      - interpolate. (The point along t at which to) –

      - result – Quaternion, The object onto which to store the result.

    Returns:

      A Quaternion, The modified result parameter.

  static log(quaternion, result)

    The logarithmic quaternion function.

    Parameters:

      - quaternion –

      - Quaternion –

      - quaternion. (The unit) –

      - result – Quaternion, The object onto which to store the result.

    Returns:

      A Quaternion, The modified result parameter.

  static magnitude(quaternion)

    Computes the provided Cartesian’s magnitude (length).

    Parameters:

      quaternion – Quaternion, he Cartesian instance whose magnitude is to be computed.

    Returns:

      A float, The magnitude.

  static magnitudeSquared(quaternion)

    Computes the provided Cartesian’s squared magnitude.

    Parameters:

      quaternion – Quaternion, he Cartesian instance whose squared magnitude is to be computed.

    Returns:

      A float, The squared magnitude.

  static multiply(left, right, result)

    Computes the product of two quaternions.

    Parameters:

      - left –

      - Quaternion –

      - quaternion. (right The second) –

      - right –

      - float –

      - quaternion. –

      - result – Quaternion, The object onto which to store the result.

    Returns:

      A Quaternion, The modified result parameter.

  static multiplyByScalar(quaternion, scalar, result)

    Multiplies the provided Cartesian componentwise by the provided scalar.

    Parameters:

      - quaternion –

      - Quaternion –

      - scaled. (The Cartesian to be) –

      - scalar –

      - float –

      - with. (The scalar to multiply) –

      - result – Quaternion, The object onto which to store the result.

    Returns:

      A Quaternion, The modified result parameter.

  static negate(quaternion, result)

    Negates the provided Cartesian.

    Parameters:

      - quaternion –

      - Quaternion –

      - negated. (The Cartesian to be) –

      - result – Quaternion, The object onto which to store the result.

    Returns:

      A Quaternion, The modified result parameter.

  static normalize(quaternion, result)

    Computes the normalized form of the supplied Cartesian.

    Parameters:

      - quaternion –

      - Quaternion –

      - normalized. (The Cartesian to be) –

      - result – Quaternion, The object onto which to store the result.

    Returns:

      A Quaternion, The modified result parameter.

  static slerp(start, end, t, result)

    Computes the spherical linear interpolation or extrapolation at t using the provided quaternions.

    Parameters:

      - start –

      - Quaternion –

      - 0.0. (The value corresponding to t at) –

      - end –

      - Quaternion –

      - 1.0. (The value corresponding to t at) –

      - t –

      - float –

      - interpolate. (The point along t at which to) –

      - result – Quaternion, The object onto which to store the result.

    Returns:

      A Quaternion, The modified result parameter.

  static squad(q0, q1, s0, s1, t, result)

    Computes the spherical quadrangle interpolation between quaternions.

    Parameters:

      - q0 –

      - Quaternion –

      - quaternion. (The second) –

      - q1 –

      - Quaternion –

      - quaternion. –

      - s0 –

      - Quaternion –

      - quadrangle. (The first inner) –

      - s1 –

      - Quaternion –

      - quadrangle. –

      - t –

      - float –

      - interpolate. (The point along t at which to) –

      - result – Quaternion, The object onto which to store the result.

    Returns:

      A Quaternion, The modified result parameter.

  static subtract(left, right, result)

    Computes the component wise difference of two Quaternions.

    Parameters:

      - left –

      - Quaternion –

      - Cartesian. (The second) –

      - right –

      - Quaternion –

      - Cartesian. –

      - result – Quaternion, The object onto which to store the result.

    Returns:

      A Quaternion, The modified result parameter.

  static toHeadingPitchRoll(quaternion, result={})

    Computes the heading, pitch and roll from a quaternion.

    Parameters:

      - quaternion – Quaternion, The quaternion from which to retrieve heading, pitch, and roll, all expressed in radians.

      - result – dict, The object onto which to store the result.

    Returns:

      A dict, The result as a dict with heading, pitch, and roll.