Show / Hide Table of Contents

    Class Matrix

    The Matrix class represents a transformation matrix.

    Inheritance
    object
    Matrix
    Inherited Members
    object.GetType()
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    Namespace: DesignData.SDS2.Primitives
    Assembly: DesignData.SDS2.Primitives.dll
    Syntax
    public sealed class Matrix
    Remarks

    A Matrix has 4x3 floating point elements, and many routines exhibit undefined behavior if the elements of the matrix cannot be composed into a combination of rotations and translations.

    Constructors

    Matrix()

    Create an identity matrix.

    Declaration
    public Matrix()
    Remarks

    A Matrix has 4x3 floating point elements, and many routines exhibit undefined behavior if the elements of the matrix cannot be composed into a combination of rotations and translations.

    Matrix(Matrix)

    Create a matrix equal to the given matrix

    Declaration
    public Matrix(Matrix arg0)
    Parameters
    Type Name Description
    Matrix arg0
    Remarks

    A Matrix has 4x3 floating point elements, and many routines exhibit undefined behavior if the elements of the matrix cannot be composed into a combination of rotations and translations.

    Properties

    Origin

    Get the coordinate system origin.

    Declaration
    public Point3D Origin { get; }
    Property Value
    Type Description
    Point3D
    Remarks

    A Matrix has 4x3 floating point elements, and many routines exhibit undefined behavior if the elements of the matrix cannot be composed into a combination of rotations and translations.

    XAxis

    Get the coordinate system X axis.

    Declaration
    public Vector3D XAxis { get; }
    Property Value
    Type Description
    Vector3D
    Remarks

    A Matrix has 4x3 floating point elements, and many routines exhibit undefined behavior if the elements of the matrix cannot be composed into a combination of rotations and translations.

    YAxis

    Get the coordinate system Y axis.

    Declaration
    public Vector3D YAxis { get; }
    Property Value
    Type Description
    Vector3D
    Remarks

    A Matrix has 4x3 floating point elements, and many routines exhibit undefined behavior if the elements of the matrix cannot be composed into a combination of rotations and translations.

    ZAxis

    Get the coordinate system Z axis.

    Declaration
    public Vector3D ZAxis { get; }
    Property Value
    Type Description
    Vector3D
    Remarks

    A Matrix has 4x3 floating point elements, and many routines exhibit undefined behavior if the elements of the matrix cannot be composed into a combination of rotations and translations.

    Methods

    BetweenSystems(Matrix, Matrix)

    Create a transformation matrix from the first coordinate system to the second coordinate system

    Declaration
    public static Matrix BetweenSystems(Matrix from, Matrix to)
    Parameters
    Type Name Description
    Matrix from

    The "from" coordinate system

    Matrix to

    The "to" coordinate system

    Returns
    Type Description
    Matrix
    Remarks

    A Matrix has 4x3 floating point elements, and many routines exhibit undefined behavior if the elements of the matrix cannot be composed into a combination of rotations and translations.

    BinEquals(Matrix, double)

    Returns BinEquals() on each sub component of the matrix

    Declaration
    public bool BinEquals(Matrix other, double binSize)
    Parameters
    Type Name Description
    Matrix other

    The other matrix

    double binSize

    The size of a bin.

    Returns
    Type Description
    bool
    Remarks

    Unlike EpsilonEquals, BinEquals maintains the transitive rule of equality.

    EpsilonEquals(Matrix, double)

    Returns EpsilonEquals() on each sub component of the matrix

    Declaration
    public bool EpsilonEquals(Matrix other, double distanceSquared)
    Parameters
    Type Name Description
    Matrix other

    The other matrix

    double distanceSquared

    The square of the smallest distance value that should be considered different

    Returns
    Type Description
    bool
    Remarks

    Note that EpsilonEquals can violate the transitivity rule of equality comparison, because there are many groups of matrices (p, q, r) where p.EpsilonEquals(q) and p.EpsilonEquals(r) but not q.EpsilonEquals(r).

    Equals(object)

    Checks if each element of the matrix are equal using Equals on each component. Note that this is an "exact" comparison method, and only appropriate in special circumstances.

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    object obj

    The matrix to compare to

    Returns
    Type Description
    bool
    Overrides
    object.Equals(object)
    Remarks

    A Matrix has 4x3 floating point elements, and many routines exhibit undefined behavior if the elements of the matrix cannot be composed into a combination of rotations and translations.

    ~Matrix()

    The Matrix class represents a transformation matrix.

    Declaration
    protected ~Matrix()
    Remarks

    A Matrix has 4x3 floating point elements, and many routines exhibit undefined behavior if the elements of the matrix cannot be composed into a combination of rotations and translations.

    GetHashCode()

    Returns the hash code for this instance. True for instances which are Equals(), otherwise False with high probability. Specific hash values are implementation-dependent.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int
    Overrides
    object.GetHashCode()
    Remarks

    A Matrix has 4x3 floating point elements, and many routines exhibit undefined behavior if the elements of the matrix cannot be composed into a combination of rotations and translations.

    Inverse()

    Return the inverse of this matrix

    Declaration
    public Matrix Inverse()
    Returns
    Type Description
    Matrix
    Remarks

    A Matrix has 4x3 floating point elements, and many routines exhibit undefined behavior if the elements of the matrix cannot be composed into a combination of rotations and translations.

    MirrorZ()

    Create a Matrix mirrored about the XY plane.

    Declaration
    public static Matrix MirrorZ()
    Returns
    Type Description
    Matrix
    Remarks

    A Matrix has 4x3 floating point elements, and many routines exhibit undefined behavior if the elements of the matrix cannot be composed into a combination of rotations and translations.

    Rotation(double, Vector3D)

    Create a rotation matrix

    Declaration
    public static Matrix Rotation(double angle, Vector3D axis)
    Parameters
    Type Name Description
    double angle

    Counterclockwise rotation in radians

    Vector3D axis

    Axis of rotation

    Returns
    Type Description
    Matrix
    Remarks

    A Matrix has 4x3 floating point elements, and many routines exhibit undefined behavior if the elements of the matrix cannot be composed into a combination of rotations and translations.

    ToCoordinateSystemXY(Point3D, Vector3D, Vector3D)

    Create a coordinate system from X axis, Y axis, and origin location.

    Declaration
    public static Matrix ToCoordinateSystemXY(Point3D origin, Vector3D xAxis, Vector3D yAxis)
    Parameters
    Type Name Description
    Point3D origin

    The origin for the coordinate system

    Vector3D xAxis

    The X axis for the coordinate system, a unit vector

    Vector3D yAxis

    The Y axis for the coordinate system, a unit vector perpendicular to XAxis

    Returns
    Type Description
    Matrix
    Remarks

    Note that the X and Y axes must be perpendicular unit vectors to within about 1 part in 1e-7

    Exceptions
    Type Condition
    InvalidValueException

    If basis vectors are not normalized or perpendicular.

    ToString()

    Formats the point into a string. Note that because the values are rounded for display, parsing them to retrieve the X, Y, and Z values will not necessarily yield the same point.

    Declaration
    public override string ToString()
    Returns
    Type Description
    string
    Overrides
    object.ToString()
    Remarks

    A Matrix has 4x3 floating point elements, and many routines exhibit undefined behavior if the elements of the matrix cannot be composed into a combination of rotations and translations.

    Translation(Point3D)

    Create a translation matrix

    Declaration
    public static Matrix Translation(Point3D origin)
    Parameters
    Type Name Description
    Point3D origin

    The translation applied by the new matrix

    Returns
    Type Description
    Matrix
    Remarks

    A Matrix has 4x3 floating point elements, and many routines exhibit undefined behavior if the elements of the matrix cannot be composed into a combination of rotations and translations.

    XRotation(double)

    Create a rotation matrix around the X axis

    Declaration
    public static Matrix XRotation(double angle)
    Parameters
    Type Name Description
    double angle

    Counterclockwise rotation in radians

    Returns
    Type Description
    Matrix
    Remarks

    A Matrix has 4x3 floating point elements, and many routines exhibit undefined behavior if the elements of the matrix cannot be composed into a combination of rotations and translations.

    YRotation(double)

    Create a rotation matrix around the Y axis

    Declaration
    public static Matrix YRotation(double angle)
    Parameters
    Type Name Description
    double angle

    Counterclockwise rotation in radians

    Returns
    Type Description
    Matrix
    Remarks

    A Matrix has 4x3 floating point elements, and many routines exhibit undefined behavior if the elements of the matrix cannot be composed into a combination of rotations and translations.

    ZRotation(double)

    Create a rotation matrix around the Z axis

    Declaration
    public static Matrix ZRotation(double angle)
    Parameters
    Type Name Description
    double angle

    Counterclockwise rotation in radians

    Returns
    Type Description
    Matrix
    Remarks

    A Matrix has 4x3 floating point elements, and many routines exhibit undefined behavior if the elements of the matrix cannot be composed into a combination of rotations and translations.

    Operators

    operator ==(Matrix, Matrix)

    Checks if each element of the matrices are equal using == on each component. Note that this is an "exact" comparison method, and only appropriate in special circumstances.

    Declaration
    public static bool operator ==(Matrix a, Matrix b)
    Parameters
    Type Name Description
    Matrix a

    The matrix to compare

    Matrix b

    The matrix to compare to

    Returns
    Type Description
    bool
    Remarks

    A Matrix has 4x3 floating point elements, and many routines exhibit undefined behavior if the elements of the matrix cannot be composed into a combination of rotations and translations.

    operator !=(Matrix, Matrix)

    Checks if any element of the matrices are unequal using != on each component. Note that this is an "exact" comparison method, and only appropriate in special circumstances.

    Declaration
    public static bool operator !=(Matrix a, Matrix b)
    Parameters
    Type Name Description
    Matrix a

    The matrix to compare

    Matrix b

    The matrix to compare to

    Returns
    Type Description
    bool
    Remarks

    A Matrix has 4x3 floating point elements, and many routines exhibit undefined behavior if the elements of the matrix cannot be composed into a combination of rotations and translations.

    operator *(Matrix, Matrix)

    Return a new matrix which composes the two matrices

    Declaration
    public static Matrix operator *(Matrix arg0, Matrix arg1)
    Parameters
    Type Name Description
    Matrix arg0
    Matrix arg1
    Returns
    Type Description
    Matrix
    Remarks

    A Matrix has 4x3 floating point elements, and many routines exhibit undefined behavior if the elements of the matrix cannot be composed into a combination of rotations and translations.

    operator *(Matrix, Point3D)

    Return the point transformed by the matrix

    Declaration
    public static Point3D operator *(Matrix arg0, Point3D arg1)
    Parameters
    Type Name Description
    Matrix arg0
    Point3D arg1
    Returns
    Type Description
    Point3D
    Remarks

    A Matrix has 4x3 floating point elements, and many routines exhibit undefined behavior if the elements of the matrix cannot be composed into a combination of rotations and translations.

    operator *(Matrix, Vector3D)

    Return the vector transformed by the matrix

    Declaration
    public static Vector3D operator *(Matrix arg0, Vector3D arg1)
    Parameters
    Type Name Description
    Matrix arg0
    Vector3D arg1
    Returns
    Type Description
    Vector3D
    Remarks

    A Matrix has 4x3 floating point elements, and many routines exhibit undefined behavior if the elements of the matrix cannot be composed into a combination of rotations and translations.

    Back to top