public final class Point extends GeomPoint implements javolution.lang.ValueType
Modified by: Joseph A. Huwaldt
RESOURCES
Modifier and Type | Method and Description |
---|---|
static Point[] |
allocateArray(int size)
Allocate a recyclable array that can contain Point objects using factory methods.
|
Point |
copy()
Returns a copy of this Point instance
allocated by the calling thread
(possibly on the stack). |
Point |
copyToReal()
Return a copy of this object with any transformations or subranges removed
(applied).
|
boolean |
equals(java.lang.Object obj)
Compares this Point against the specified object for strict equality (same values
and same units).
|
int |
getPhyDimension()
Returns the number of physical dimensions of the geometry element.
|
Unit<Length> |
getUnit()
Returns the unit in which the
values in this point are stated in. |
double |
getValue(int i)
Returns the value of a coordinate in this point as a
double , stated in
this point's unit . |
double |
getValue(int i,
Unit<Length> unit)
Returns the value of a coordinate in this point as a
double , stated in
the specified unit. |
int |
hashCode()
Returns the hash code for this parameter.
|
Point |
immutable()
Return an immutable version of this point.
|
static void |
main(java.lang.String[] args)
Tests the methods in this class.
|
Point |
minus(GeomPoint that)
Returns the difference between this point and the one specified.
|
Point |
minus(Parameter<Length> that)
Subtracts the specified parameter from each component of this point.
|
MutablePoint |
mutable()
Return a mutable copy of this point.
|
static Point |
newInstance(int dim)
Returns a
Point instance of the specified dimension with zero meters for
each coordinate value. |
static Point |
newInstance(int dim,
Unit<Length> unit)
Returns a
Point instance of the specified dimension and units with zero for
each coordinate value. |
double |
normSqValue()
Returns the square of the Euclidean norm, magnitude, or length value of the vector
from the origin to this point (the dot product of the origin-to-this-point vector
and itself).
|
Point |
opposite()
Returns the negation of this point (all the values of each dimension negated).
|
Point |
plus(GeomPoint that)
Returns the sum of this point with the one specified.
|
Point |
plus(Parameter<Length> that)
Adds the specified parameter to each component of this point.
|
static void |
recycleArray(Point[] arr)
Recycle an array of Point objects that was created by Point.allocateArray().
|
Point |
times(double k)
Returns the product of this point with the specified coefficient.
|
Point |
to(Unit<Length> unit)
Returns the equivalent to this point but stated in the specified unit.
|
Point |
toDimension(int newDim)
Return the equivalent of this point converted to the specified number of physical
dimensions.
|
Float64Vector |
toFloat64Vector()
Returns the values stored in this point, stated in this point's
unit , as a Float64Vector. |
static Point |
valueOf(Coordinate3D<Length> coord)
Returns a
Point instance holding the specified
@link jahuwaldt.js.param.Coordinate3D Coordinate3D values. |
static Point |
valueOf(double... x)
Returns a
Point instance holding the specified double value or
values stated in meters. |
static Point |
valueOf(double x,
double y,
double z,
Unit<Length> unit)
Returns a 3D
Point instance holding the specified double
values stated in the specified units. |
static Point |
valueOf(double x,
double y,
Unit<Length> unit)
Returns a 2D
Point instance holding the specified double value
stated in the specified units. |
static Point |
valueOf(double x,
Unit<Length> unit)
Returns a 1D
Point instance holding the specified double
values stated in the specified units. |
static Point |
valueOf(GeomPoint point)
Returns a
Point instance containing the specified GeomPoint's data. |
static Point |
valueOf(GeomVector<?> vector)
Returns a
Point instance that represents the direction elements of the
specified GeomVector given in length or dimensionless units. |
static Point |
valueOf(java.util.List<Parameter<Length>> values)
Returns a
Point instance holding the specified Parameter
values. |
static Point |
valueOf(Parameter<Length>... values)
Returns a
Point instance holding the specified Parameter
values. |
static Point |
valueOf(Point point)
Returns a
Point instance containing the specified Point's data. |
static Point |
valueOf(Unit<Length> unit,
double... values)
Returns a
Point instance holding the specified double values
stated in the specified units. |
static Point |
valueOf(Vector<Float64> vector,
Unit<Length> unit)
Returns a
Point instance containing the specified vector of Float64 values
stated in the specified units. |
static <Q extends Quantity> |
valueOf(Vector<Parameter<Q>> vector)
Returns a
Point instance containing the specified vector of Parameter
values with length units. |
distance, distanceSq, distanceSqValue, distanceValue, divide, divide, get, getBoundsMax, getBoundsMin, getLimitPoint, getNumberOfPoints, getParDimension, getTransformed, isApproxEqual, isApproxEqual, isValid, max, min, norm, normSq, normValue, size, times, toArray, toArray, toGeomVector, toParameterVector, toText, toVector3D
addChangeListener, clone, compareTo, getAllUserData, getID, getName, getUserData, putAllUserData, putUserData, removeChangeListener, removeUserData, reset, setName, toString
addChangeListener, getAllUserData, getID, getName, getUserData, putAllUserData, putUserData, removeChangeListener, removeUserData, setName
public static Point newInstance(int dim)
Point
instance of the specified dimension with zero meters for
each coordinate value.dim
- the physical dimension of the point to create.public static Point newInstance(int dim, Unit<Length> unit)
Point
instance of the specified dimension and units with zero for
each coordinate value.dim
- the physical dimension of the point to create.unit
- The unit for the point to create. May not be null.public static Point valueOf(double... x)
Point
instance holding the specified double
value or
values stated in meters.x
- the coordinate values stated in meters. May not be null.public static Point valueOf(double x, Unit<Length> unit)
Point
instance holding the specified double
values stated in the specified units.x
- the x value stated in the specified unit.unit
- the unit in which the coordinates are stated. May not be null.public static Point valueOf(double x, double y, Unit<Length> unit)
Point
instance holding the specified double
value
stated in the specified units.x
- the x value stated in the specified unit.y
- the y value stated in the specified unit.unit
- the unit in which the coordinates are stated. May not be null.public static Point valueOf(double x, double y, double z, Unit<Length> unit)
Point
instance holding the specified double
values stated in the specified units.x
- the x value stated in the specified unit.y
- the y value stated in the specified unit.z
- the z value stated in the specified unit.unit
- the unit in which the coordinates are stated. May not be null.public static Point valueOf(Unit<Length> unit, double... values)
Point
instance holding the specified double
values
stated in the specified units.unit
- the length unit in which the coordinates are stated. May not be null.values
- the list of values stated in the specified unit. May not be null.public static Point valueOf(Parameter<Length>... values)
Point
instance holding the specified Parameter
values. All the values are converted to the same units as the 1st value.values
- The list of values to be stored. May not be null.public static Point valueOf(java.util.List<Parameter<Length>> values)
Point
instance holding the specified Parameter
values. All the values are converted to the same units as the 1st value.values
- The list of values to be stored. May not be null and must have at
least one element..public static Point valueOf(Coordinate3D<Length> coord)
Point
instance holding the specified
@link jahuwaldt.js.param.Coordinate3D Coordinate3D
values.coord
- The Coordinate3D
to be stored.
May not be null.public static Point valueOf(Vector<Float64> vector, Unit<Length> unit)
Point
instance containing the specified vector of Float64 values
stated in the specified units.vector
- the vector of Float64 values stated in the specified unit. May not be
null.unit
- the unit in which the values are stated. May not be null.public static <Q extends Quantity> Point valueOf(Vector<Parameter<Q>> vector)
Point
instance containing the specified vector of Parameter
values with length units. All the values are converted to the same units as the 1st
value.Q
- The Quantity (type of unit) for this Point data. Must be "Length" or
"Dimensionless".vector
- The vector of Parameter values stated in length or dimensionless
units. If in dimensionless units, the values are interpreted as being
in meters. May not be null.ConversionException
- if the input vector is not in Length (or Dimensionless)
units.public static Point valueOf(GeomVector<?> vector)
Point
instance that represents the direction elements of the
specified GeomVector given in length or dimensionless units. If the user wishes for
the point to represent the end or tip of the vehicle they should use the following:
Point p = Point.valueOf(vector).plus(vector.getOrigin());
vector
- the GeomVector stated in length or dimensionless units. If in
dimensionless units, the values are interpreted as being in meters.
May not be null.ConversionException
- if the input vector is not in length (or Dimensionless)
units.public static Point valueOf(GeomPoint point)
Point
instance containing the specified GeomPoint's data.point
- the GeomPoint to be copied into a new Point. May not be null.public static Point valueOf(Point point)
Point
instance containing the specified Point's data.point
- the Point to be copied into a new Point. May not be null.public Point immutable()
public MutablePoint mutable()
public int getPhyDimension()
getPhyDimension
in interface GeomElement<GeomPoint>
public double getValue(int i)
double
, stated in
this point's unit
.public double getValue(int i, Unit<Length> unit)
double
, stated in
the specified unit.public double normSqValue()
normValue
if the
squared value is all that is needed.normSqValue
in class GeomPoint
this.normSq().getValue()
.GeomPoint.normValue()
public Point plus(GeomPoint that)
plus
in class GeomPoint
that
- the point to be added. May not be null.this + that
.DimensionException
- if point dimensions are different.public Point plus(Parameter<Length> that)
public Point minus(GeomPoint that)
minus
in class GeomPoint
that
- the point to be subtracted from this point. May not be null.this - that
.DimensionException
- if point dimensions are different.public Point minus(Parameter<Length> that)
public Point opposite()
public Point times(double k)
public Point copy()
allocated
by the calling thread
(possibly on the stack).copy
in interface GeomElement<GeomPoint>
copy
in interface javolution.lang.ValueType
copy
in class GeomPoint
public Point copyToReal()
copyToReal
in interface GeomElement<GeomPoint>
copyToReal
in class GeomPoint
public final Unit<Length> getUnit()
values
in this point are stated in.getUnit
in interface GeomElement<GeomPoint>
public Point to(Unit<Length> unit) throws ConversionException
to
in interface GeomElement<GeomPoint>
to
in interface PointGeometry<GeomPoint>
unit
- the length unit of the point to be returned. May not be null.ConversionException
- if the the input unit is not a length unit.public Point toDimension(int newDim)
toDimension
in interface GeomElement<GeomPoint>
newDim
- The dimension of the point to return.public final Float64Vector toFloat64Vector()
unit
, as a Float64Vector.toFloat64Vector
in class GeomPoint
public boolean equals(java.lang.Object obj)
equals
in class AbstractGeomElement<GeomPoint>
obj
- the object to compare with.true
if this point is identical to that point;
false
otherwise.public int hashCode()
hashCode
in class AbstractGeomElement<GeomPoint>
public static Point[] allocateArray(int size)
WARNING: The array returned may not be zeroed. Any object references in the returned array must be assumed to be invalid. Also, the returned array may be larger than the requested size! The array returned by this method can be recycled by recycleArray().
size
- The minimum number of elements for the returned array to contain.recycleArray(geomss.geom.Point[])
public static void recycleArray(Point[] arr)
arr
- The array to be recycled. The array must have been created by this the
allocateArray() method!allocateArray(int)
public static void main(java.lang.String[] args)
args
- Command-line arguments (not used).