Enum CoordinateSystem2D

  • All Implemented Interfaces:
    Serializable, Comparable<CoordinateSystem2D>, CoordinateSystem

    public enum CoordinateSystem2D
    extends Enum<CoordinateSystem2D>
    implements CoordinateSystem
    Represents the different kind of 2D referencials and provides the conversion utilities.

    A referencial axis is expressed by the front and left directions. For example XY_LEFT_HAND is for the coordinate system with front direction along +X axis, and left direction along the -Y axis according to a "left-hand" heuristic.

    The default coordinate system is:

    • front: (1, 0)
    • left: (0, 1)
    Since:
    13.0
    Version:
    17.0 2020-01-04 14:41:43
    Author:
    Christophe BOHRHAUER, Stéphane GALLAND
    Maven Group Id:
    org.arakhne.afc.core
    Maven Artifact Id:
    mathgeom
    • Enum Constant Detail

      • XY_RIGHT_HAND

        public static final CoordinateSystem2D XY_RIGHT_HAND
        Right handed XY coordinate system.

        [Right Handed XY Coordinate System]

      • XY_LEFT_HAND

        public static final CoordinateSystem2D XY_LEFT_HAND
        Left handed XY coordinate system.

        [Left Handed XY Coordinate System]

    • Method Detail

      • values

        public static CoordinateSystem2D[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (CoordinateSystem2D c : CoordinateSystem2D.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static CoordinateSystem2D valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • getDimensions

        @Pure
        public final int getDimensions()
        Description copied from interface: CoordinateSystem
        Replies the count of dimension in this space referential.
        Specified by:
        getDimensions in interface CoordinateSystem
        Returns:
        the count of dimensions.
      • toSystem

        public void toSystem​(Point2D<?,​?> point,
                             CoordinateSystem2D targetCoordinateSystem)
        Convert the specified point from the current coordinate system to the specified coordinate system.
        Parameters:
        point - is the point to convert
        targetCoordinateSystem - is the target coordinate system.
      • toSystem

        public void toSystem​(Vector2D<?,​?> point,
                             CoordinateSystem2D targetCoordinateSystem)
        Convert the specified point from the current coordinate system to the specified coordinate system.
        Parameters:
        point - is the point to convert
        targetCoordinateSystem - is the target coordinate system.
      • toSystem

        @Pure
        public double toSystem​(double rotation,
                               CoordinateSystem2D targetCoordinateSystem)
        Convert the specified rotation from the current coordinate system to the specified coordinate system.
        Parameters:
        rotation - is the rotation to convert
        targetCoordinateSystem - is the target coordinate system.
        Returns:
        the converted rotation
      • toSystem

        public void toSystem​(Transform2D matrix,
                             CoordinateSystem2D targetCoordinateSystem)
        Convert the specified transformation matrix into from the current coordinate system to the specified coordinate system.
        Parameters:
        matrix - is the matrix to convert
        targetCoordinateSystem - is the target coordinate system.
      • toDefault

        public void toDefault​(Point2D<?,​?> point)
        Convert the specified point into the default coordinate system.
        Parameters:
        point - is the point to convert
      • toDefault

        public void toDefault​(Vector2D<?,​?> vector)
        Convert the specified vector from the default coordinate system.
        Parameters:
        vector - is the vector to convert
      • toDefault

        public void toDefault​(Transform2D matrix)
        Convert the specified transformation matrix from the default coordinate system.
        Parameters:
        matrix - is the matrix to convert
      • toDefault

        @Pure
        public double toDefault​(double rotation)
        Convert the specified rotation into the default coordinate system.
        Parameters:
        rotation - is the rotation to convert
        Returns:
        the converted rotation
      • fromDefault

        public void fromDefault​(Point2D<?,​?> point)
        Convert the specified point from the default coordinate system.
        Parameters:
        point - is the point to convert
      • fromDefault

        public void fromDefault​(Vector2D<?,​?> vector)
        Convert the specified vector from the default coordinate system.
        Parameters:
        vector - is the vector to convert
      • fromDefault

        public void fromDefault​(Transform2D matrix)
        Convert the specified transformation matrix from the default coordinate system.
        Parameters:
        matrix - is the matrix to convert
      • fromDefault

        @Pure
        public double fromDefault​(double rotation)
        Convert the specified rotation from the default coordinate system.
        Parameters:
        rotation - is the rotation to convert
        Returns:
        the converted rotation
      • setDefaultCoordinateSystem

        public static void setDefaultCoordinateSystem​(CoordinateSystem2D system)
        Set the default coordinate system.
        Parameters:
        system - is the new default coordinate system.
        See Also:
        getDefaultCoordinateSystem()
      • fromVectors

        @Pure
        public static CoordinateSystem2D fromVectors​(int ly)
        Replies the coordinate system which is corresponding to the specified orientation unit vectors.

        The front vector is assumed to be always (1, 0), and the left vector is (0, ly).

        Parameters:
        ly - y coordinate to left.
        Returns:
        the coordinate system which is corresponding to the specified vector.
      • fromVectors

        @Pure
        public static CoordinateSystem2D fromVectors​(double ly)
        Replies the coordinate system which is corresponding to the specified orientation unit vectors.

        The front vector is assumed to be always (1, 0), and the left vector is (0, ly). If ly is negative, then the corrdinate system is left-handed, otherwise it is right-handed.

        Parameters:
        ly - y coordinate to the left.
        Returns:
        the coordinate system which is corresponding to the specified vector.
      • isRightHanded

        @Pure
        public boolean isRightHanded()
        Description copied from interface: CoordinateSystem
        Replies if this coordinate system is a right-hand coordinate system.
        Specified by:
        isRightHanded in interface CoordinateSystem
        Returns:
        true if this coordinate system is right-handed, otherwise false
      • isLeftHanded

        @Pure
        public boolean isLeftHanded()
        Description copied from interface: CoordinateSystem
        Replies if this coordinate system is a left-hand coordinate system.
        Specified by:
        isLeftHanded in interface CoordinateSystem
        Returns:
        true if this coordinate system is left-handed, otherwise false
      • getViewVector

        @Pure
        public static Vector2D<?,​?> getViewVector()
        Replies the front vector.
        Returns:
        the front vector.
      • getViewVector

        public static <T extends Vector2D<?,​?>> T getViewVector​(T vectorToFill)
        Replies the front vector.
        Type Parameters:
        T - the type of the vector.
        Parameters:
        vectorToFill - is the vector to set with the front vector values.
        Returns:
        vectorToFill.
      • getBackVector

        @Pure
        public static Vector2D<?,​?> getBackVector()
        Replies the back vector.
        Returns:
        the back vector.
      • getBackVector

        public static <T extends Vector2D<?,​?>> T getBackVector​(T vectorToFill)
        Replies the back vector.
        Type Parameters:
        T - the type of the vector.
        Parameters:
        vectorToFill - is the vector to set with the back vector values.
        Returns:
        the back vector.
      • getLeftVector

        @Pure
        public Vector2D<?,​?> getLeftVector()
        Replies the left vector.
        Returns:
        the left vector.
      • getLeftVector

        public <T extends Vector2D<?,​?>> T getLeftVector​(T vectorToFill)
        Replies the left vector.
        Type Parameters:
        T - the type of the vector.
        Parameters:
        vectorToFill - is the vector to set with the left vector values.
        Returns:
        the left vector.
      • getRightVector

        @Pure
        public Vector2D<?,​?> getRightVector()
        Replies the right vector.
        Returns:
        the right vector.
      • getRightVector

        public <T extends Vector2D<?,​?>> T getRightVector​(T vectorToFill)
        Replies the right vector.
        Type Parameters:
        T - the type of the vector.
        Parameters:
        vectorToFill - is the vector to set with the right vector values.
        Returns:
        the right vector.
      • toCoordinateSystem3D

        @Pure
        public CoordinateSystem3D toCoordinateSystem3D()
        Replies the 3D coordinate system which is corresponding to this 2D coordinate system.
        Returns:
        the 3D coordinate system