Enum CoordinateSystem2D
- java.lang.Object
-
- java.lang.Enum<CoordinateSystem2D>
-
- org.arakhne.afc.math.geometry.coordinatesystem.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 Summary
Enum Constants Enum Constant Description XY_LEFT_HAND
Left handed XY coordinate system.XY_RIGHT_HAND
Right handed XY coordinate system.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description double
fromDefault(double rotation)
Convert the specified rotation from the default coordinate system.void
fromDefault(Point2D<?,?> point)
Convert the specified point from the default coordinate system.void
fromDefault(Transform2D matrix)
Convert the specified transformation matrix from the default coordinate system.void
fromDefault(Vector2D<?,?> vector)
Convert the specified vector from the default coordinate system.static CoordinateSystem2D
fromVectors(double ly)
Replies the coordinate system which is corresponding to the specified orientation unit vectors.static CoordinateSystem2D
fromVectors(int ly)
Replies the coordinate system which is corresponding to the specified orientation unit vectors.static Vector2D<?,?>
getBackVector()
Replies the back vector.static <T extends Vector2D<?,?>>
TgetBackVector(T vectorToFill)
Replies the back vector.static CoordinateSystem2D
getDefaultCoordinateSystem()
Replies the default coordinate system.int
getDimensions()
Replies the count of dimension in this space referential.Vector2D<?,?>
getLeftVector()
Replies the left vector.<T extends Vector2D<?,?>>
TgetLeftVector(T vectorToFill)
Replies the left vector.Vector2D<?,?>
getRightVector()
Replies the right vector.<T extends Vector2D<?,?>>
TgetRightVector(T vectorToFill)
Replies the right vector.static Vector2D<?,?>
getViewVector()
Replies the front vector.static <T extends Vector2D<?,?>>
TgetViewVector(T vectorToFill)
Replies the front vector.boolean
isLeftHanded()
Replies if this coordinate system is a left-hand coordinate system.boolean
isRightHanded()
Replies if this coordinate system is a right-hand coordinate system.static void
setDefaultCoordinateSystem(CoordinateSystem2D system)
Set the default coordinate system.CoordinateSystem3D
toCoordinateSystem3D()
Replies the 3D coordinate system which is corresponding to this 2D coordinate system.double
toDefault(double rotation)
Convert the specified rotation into the default coordinate system.void
toDefault(Point2D<?,?> point)
Convert the specified point into the default coordinate system.void
toDefault(Transform2D matrix)
Convert the specified transformation matrix from the default coordinate system.void
toDefault(Vector2D<?,?> vector)
Convert the specified vector from the default coordinate system.double
toSystem(double rotation, CoordinateSystem2D targetCoordinateSystem)
Convert the specified rotation from the current coordinate system to the specified coordinate system.void
toSystem(Point2D<?,?> point, CoordinateSystem2D targetCoordinateSystem)
Convert the specified point from the current coordinate system to the specified coordinate system.void
toSystem(Transform2D matrix, CoordinateSystem2D targetCoordinateSystem)
Convert the specified transformation matrix into from the current coordinate system to the specified coordinate system.void
toSystem(Vector2D<?,?> point, CoordinateSystem2D targetCoordinateSystem)
Convert the specified point from the current coordinate system to the specified coordinate system.static CoordinateSystem2D
valueOf(String name)
Returns the enum constant of this type with the specified name.static CoordinateSystem2D[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.-
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
-
Methods inherited from interface org.arakhne.afc.math.geometry.coordinatesystem.CoordinateSystem
name, ordinal
-
-
-
-
Enum Constant Detail
-
XY_RIGHT_HAND
public static final CoordinateSystem2D XY_RIGHT_HAND
-
XY_LEFT_HAND
public static final CoordinateSystem2D XY_LEFT_HAND
-
-
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 nameNullPointerException
- 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 interfaceCoordinateSystem
- 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 converttargetCoordinateSystem
- 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 converttargetCoordinateSystem
- 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 converttargetCoordinateSystem
- 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 converttargetCoordinateSystem
- 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
-
getDefaultCoordinateSystem
@Pure public static CoordinateSystem2D getDefaultCoordinateSystem()
Replies the default coordinate system.If it is not changed, the default coordinate system is the one used for 2D simulation:
CoordinateSystemConstants.SIMULATION_2D
.- Returns:
- the default coordinate system.
- See Also:
setDefaultCoordinateSystem(CoordinateSystem2D)
-
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)
. Ifly
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 interfaceCoordinateSystem
- Returns:
true
if this coordinate system is right-handed, otherwisefalse
-
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 interfaceCoordinateSystem
- Returns:
true
if this coordinate system is left-handed, otherwisefalse
-
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
-
-