Package org.jzy3d.maths
Class Coord3d
java.lang.Object
org.jzy3d.maths.Coord3d
- All Implemented Interfaces:
Serializable
A
Coord3d
stores a 3 dimensional coordinate for cartesian or polar mode, and provide few
operators.
Operators allow adding, substracting, multiplying and divising coordinate values, as well as
computing the distance between two points, and converting polar and cartesian coordinates.- Author:
- Martin Pernollet
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCoord3d()
Create a 3d coordinate with value 0 for each dimension.Coord3d
(double[] c) Coord3d
(double xi, double yi) Coord3d
(double xi, double yi, double zi) Create a 3d coordinate.Coord3d
(float[] c) Coord3d
(float xi, float yi) Coord3d
(float xi, float yi, float zi) Create a 3d coordinate. -
Method Summary
Modifier and TypeMethodDescriptionadd
(double x, double y, double z) add
(float value) Add a value to all components of the current Coord and return the result in a new Coord3d.add
(float x, float y, float z) static void
static void
Add a Coord3d to the current one and return the result in a new Coord3d.addSelf
(float value) addSelf
(float x, float y, float z) static Coord3d[]
Converts the current Coord3d into cartesian coordinates and return the result in a new Coord3d.clone()
Return a duplicate of this 3d coordinate.final Coord3d
Computes the vectorial product of the current and the given vector.double
Compute the distance between two coordinates.double
Compute the square distance between two coordinates.div
(float value) Divise all components of the current Coord by the same value and return the result in a new Coord3d.static void
static void
Divise a Coord3d to the current one and return the result in a new Coord3d.void
divSelf
(double value) void
divSelf
(float value) void
final float
Compute the dot product (a.k.a scalar product) between the current and given vector.boolean
static Coord3d
getCoordAt
(double[] array, int i) static Coord3d
getCoordAt
(float[] array, int i) getCoords
(double[] array) getCoords
(float[] array) getNormalizedTo
(float len) getXY()
Return the x and y component as a 2d coordinate.static Range
int
hashCode()
final Coord3d
interpolateTo
(Coord3d v, float f) boolean
isValid()
list
(int size) float
static Coord3d
Compute the component-wise minimum values of a set of coordinates.static Coord3d
Compute the component-wise minimum values of a set of coordinates.Compute the component-wise minimum and maximum values of a set of coordinates.mul
(double value) mul
(float value) Multiply all components of the current Coord and return the result in a new Coord3d.mul
(float x, float y, float z) static void
static void
Multiply a Coord3d to the current one and return the result in a new Coord3d.void
mulSelf
(float value) void
mulSelf
(float x, float y, float z) void
negative()
normalizeTo
(float len) polar()
Converts the current Coord3d into polar coordinates and return the result in a new Coord3d.final Coord3d
Applies a rotation represented by the AxisAngle notation using the Rodrigues' rotation formula.set
(float x, float y, float z) sub
(float value) Substract a value to all components of the current Coord and return the result in a new Coord3d.sub
(float x2, float y2, float z2) static void
static void
Substract a Coord3d to the current one and return the result in a new Coord3d.subSelf
(float value) float[]
toArray()
Return an array representation of this coordinate.void
toArray
(float[] array, int offset) toString()
Return a string representation of this coordinate.
-
Field Details
-
x
public float x -
y
public float y -
z
public float z -
ORIGIN
The origin is a Coord3d having value 0 for each dimension. -
IDENTITY
The origin is a Coord3d having value 1 for each dimension. -
INVALID
An invalid Coord2d has value NaN for each dimension.
-
-
Constructor Details
-
Coord3d
public Coord3d()Create a 3d coordinate with value 0 for each dimension. -
Coord3d
public Coord3d(float xi, float yi, float zi) Create a 3d coordinate. When using polar mode, x represents azimuth, y represents elevation, and z represents range. -
Coord3d
public Coord3d(float xi, float yi) -
Coord3d
-
Coord3d
-
Coord3d
-
Coord3d
-
Coord3d
public Coord3d(float[] c) -
Coord3d
public Coord3d(double[] c) -
Coord3d
public Coord3d(double xi, double yi, double zi) Create a 3d coordinate. When using polar mode, x is azimuth, y is elevation, and z is range. -
Coord3d
public Coord3d(double xi, double yi)
-
-
Method Details
-
list
-
list
-
array
-
getZRange
-
set
-
set
-
clone
Return a duplicate of this 3d coordinate. -
getXY
Return the x and y component as a 2d coordinate. -
add
Add a Coord3d to the current one and return the result in a new Coord3d.- Parameters:
c2
-- Returns:
- the result Coord3d
-
add
-
add
-
addSelf
-
addSelf
-
add
Add a value to all components of the current Coord and return the result in a new Coord3d.- Parameters:
value
-- Returns:
- the result Coord3d
-
addSelf
-
sub
Substract a Coord3d to the current one and return the result in a new Coord3d.- Parameters:
c2
-- Returns:
- the result Coord3d
-
sub
-
subSelf
-
sub
Substract a value to all components of the current Coord and return the result in a new Coord3d.- Parameters:
value
-- Returns:
- the result Coord3d
-
subSelf
-
mul
Multiply a Coord3d to the current one and return the result in a new Coord3d.- Parameters:
c2
-- Returns:
- the result Coord3d
-
mul
-
mul
Multiply all components of the current Coord and return the result in a new Coord3d.- Parameters:
value
-- Returns:
- the result Coord3d
-
mul
-
mulSelf
-
mulSelf
public void mulSelf(float x, float y, float z) -
mulSelf
public void mulSelf(float value) -
div
Divise a Coord3d to the current one and return the result in a new Coord3d.- Parameters:
c2
-- Returns:
- the result Coord3d
-
divSelf
-
divSelf
public void divSelf(float value) -
divSelf
public void divSelf(double value) -
div
Divise all components of the current Coord by the same value and return the result in a new Coord3d.- Parameters:
value
-- Returns:
- the result Coord3d
-
negative
-
cartesian
Converts the current Coord3d into cartesian coordinates and return the result in a new Coord3d. Assume that- X represent azimuth
- Y represent elevation
- Z represent distance
- Returns:
- the result Coord3d
-
cartesianSelf
-
polar
Converts the current Coord3d into polar coordinates and return the result in a new Coord3d.- Returns:
- the result Coord3d
-
polarSelf
-
distance
Compute the distance between two coordinates. -
distanceSq
Compute the square distance between two coordinates. -
magSquared
public float magSquared() -
getNormalizedTo
-
normalizeTo
-
dot
Compute the dot product (a.k.a scalar product) between the current and given vector. Remind that the dot product is 0 if vectors are perpendicular- Parameters:
v
- input vector
-
cross
Computes the vectorial product of the current and the given vector. The result is a vector defined as a Coord3d, that is perpendicular to the plan induced by current vector and vector V.- Parameters:
v
- input vector
-
rotate
Applies a rotation represented by the AxisAngle notation using the Rodrigues' rotation formula. math implemented using http://en.wikipedia.org/wiki/Rodrigues%27_rotation_formula- Parameters:
angleDeg
- angle of rotation about the given axis [deg]axis
- unit vector describing an axis of rotation- Returns:
- rotated copy of the original vector
-
interpolateTo
-
toString
Return a string representation of this coordinate. -
toArray
public float[] toArray()Return an array representation of this coordinate. -
toArray
public void toArray(float[] array, int offset) -
hashCode
public int hashCode() -
equals
-
min
Compute the component-wise minimum values of a set of coordinates.- Parameters:
coords
-- Returns:
- minimum value on each dimension
-
max
Compute the component-wise minimum values of a set of coordinates.- Parameters:
coords
-- Returns:
- maximum value on each dimension
-
minMax
Compute the component-wise minimum and maximum values of a set of coordinates.- Parameters:
coords
-- Returns:
- maximum value on each dimension
-
add
-
add
-
sub
-
sub
-
mul
-
mul
-
div
-
div
-
clone
-
getCoords
-
getCoordAt
-
getCoords
-
getCoordAt
-
isValid
public boolean isValid()
-