Q
- The Quantity (unit type) associated with this vector's coordinate values.public abstract class GeomVector<Q extends Quantity> extends AbstractGeomElement<GeomVector> implements Transformable<GeomVector>
Modified by: Joseph A. Huwaldt
Modifier and Type | Field and Description |
---|---|
static int |
X
Constant used to identify the X coordinate in a 3D vector.
|
static int |
Y
Constant used to identify the Y coordinate in a 3D vector.
|
static int |
Z
Constant used to identify the Z coordinate in a 3D vector.
|
RESOURCES
Constructor and Description |
---|
GeomVector() |
Modifier and Type | Method and Description |
---|---|
Parameter<Angle> |
angle(GeomVector<?> that)
Returns the angle between this vector and the specified vector.
|
abstract GeomVector<Q> |
copy()
Returns a copy of this GeomVector instance
allocated by the calling thread
(possibly on the stack). |
abstract Vector<? extends Quantity> |
cross(GeomVector<?> that)
Returns the cross product of two vectors.
|
abstract Vector<Q> |
divide(double divisor)
Returns this vector with each element divided by the specified divisor
(dimensionless).
|
abstract Vector<? extends Quantity> |
divide(Parameter<?> that)
Returns this vector with each element divided by the specified divisor.
|
Parameter<? extends Quantity> |
dot(GeomVector<?> that)
Returns the dot product (scalar product) of this vector with the one specified.
|
Parameter<Q> |
get(int i)
Returns the value of a Parameter from this vector.
|
Point |
getBoundsMax()
Return the coordinate point representing the maximum bounding box corner (e.g.: max
X, max Y, max Z).
|
Point |
getBoundsMin()
Return the coordinate point representing the minimum bounding box corner (e.g.: min
X, min Y, min Z).
|
Point |
getLimitPoint(int dim,
boolean max,
double tol)
Returns the most extreme point, either minimum or maximum, in the specified
coordinate direction on this geometry element.
|
abstract Point |
getOrigin()
Return the origin point for this vector.
|
int |
getParDimension()
Returns the number of parametric dimensions of the geometry element.
|
VectorTrans<Q> |
getTransformed(GTransform transform)
Returns transformed version of this element.
|
abstract double |
getValue(int i)
Returns the value of the Parameter in this vector as a
double , stated
in this vector's unit . |
abstract double |
getValue(int i,
Unit<Q> unit)
Returns the value of the Parameter in this vector as a
double , stated
in the specified units. |
abstract Vector<Q> |
immutable()
Return an immutable version of this vector.
|
boolean |
isApproxEqual(GeomVector obj)
Compares this vector against the specified vector for approximate equality
(coordinate values approximately equal to this one to within the numerical roundoff
tolerance).
|
boolean |
isApproxEqual(GeomVector obj,
Parameter<Q> tol)
Compares this vector against the specified vector for approximate equality
(coordinate values approximately equal to this one to within the numerical roundoff
tolerance).
|
boolean |
isValid()
Return
true if this GeomVector contains valid and finite numerical
components. |
Parameter<Q> |
mag()
Returns the Euclidian norm, magnitude, or length of this vector (square root of the
dot product of this vector and itself).
|
double |
magValue()
Returns the
norm() , magnitude, or length value of this vector. |
abstract Vector<Q> |
minus(GeomVector<Q> that)
Returns the difference between this vector and the one specified.
|
abstract Vector<Q> |
minus(Parameter<Q> that)
Subtracts the supplied Parameter from each element of this vector and returns the
result.
|
Parameter<Q> |
norm()
Returns the Euclidian norm, magnitude, or length of this vector (square root of the
dot product of this vector and itself).
|
abstract double |
normValue()
Returns the
norm() , magnitude, or length value of this vector (square root
of the dot product of this vector and itself). |
abstract Vector<Q> |
opposite()
Returns the negation of this vector.
|
abstract Vector<Q> |
plus(GeomVector<Q> that)
Returns the sum of this vector with the one specified.
|
abstract Vector<Q> |
plus(Parameter<Q> that)
Returns the sum of this vector with the parameter specified.
|
abstract void |
setOrigin(Point o)
Set the origin point for this vector.
|
int |
size()
Returns the number of child-elements that make up this geometry element.
|
abstract Vector<Q> |
times(double k)
Returns the product of this vector with the specified coefficient (dimensionless).
|
abstract Parameter<? extends Quantity> |
times(GeomVector<?> that)
Returns the dot product (scalar product) of this vector with the one specified.
|
abstract Vector<? extends Quantity> |
times(Parameter<?> k)
Returns the product of this vector with the specified coefficient.
|
abstract Vector<? extends Quantity> |
timesEBE(GeomVector<?> that)
Returns the element-by-element product of this vector with the one specified.
|
double[] |
toArray()
Returns the values stored in this vector as a Java array, stated in the
current
units . |
double[] |
toArray(double[] array)
Returns the values stored in this vector, stated in the current
units stored in the input Java array. |
abstract GeomVector<Q> |
toDimension(int newDim)
Return a copy of this vector converted to the specified number of physical
dimensions.
|
abstract Float64Vector |
toFloat64Vector()
Returns a
Float64Vector containing the elements of this vector stated
in the current units. |
abstract ParameterVector<Q> |
toParameterVector()
Returns a
ParameterVector representation of this vector. |
javolution.text.Text |
toText()
Returns the text representation of this geometry element that consists of the name
followed by the vector axis values.
|
abstract Vector<Dimensionless> |
toUnitVector()
Returns this vector converted to a unit vector by dividing all the vector's
elements by the length (
norm() ) of this vector. |
addChangeListener, clone, compareTo, equals, getAllUserData, getID, getName, getUserData, hashCode, putAllUserData, putUserData, removeChangeListener, removeUserData, reset, setName, toString
addChangeListener, copyToReal, getAllUserData, getID, getName, getPhyDimension, getUnit, getUserData, putAllUserData, putUserData, removeChangeListener, removeUserData, setName, to
public static final int X
public static final int Y
public static final int Z
public GeomVector()
public int size()
size
in interface GeomElement<GeomVector>
public int getParDimension()
getParDimension
in interface GeomElement<GeomVector>
public Parameter<Q> get(int i)
i
- the dimension index.i
.java.lang.IndexOutOfBoundsException
- (i < 0) || (i ≥ getPhyDimension())
public abstract double getValue(int i)
double
, stated
in this vector's unit
.i
- the dimension index.i
.java.lang.IndexOutOfBoundsException
- (i < 0) || (i ≥ getPhyDimension())
public abstract double getValue(int i, Unit<Q> unit)
double
, stated
in the specified units.i
- the dimension index.unit
- the unit to return the value in. May not be null.i
in the specified unit.java.lang.IndexOutOfBoundsException
- (i < 0) || (i ≥ getPhyDimension())
public abstract void setOrigin(Point o)
o
- The origin point to assign to this vector. May not be null.public abstract Point getOrigin()
public Parameter<Q> norm()
sqrt(this · this)
.public abstract double normValue()
norm()
, magnitude, or length value of this vector (square root
of the dot product of this vector and itself).this.norm().doubleValue()
.public Parameter<Q> mag()
sqrt(this · this)
.public double magValue()
norm()
, magnitude, or length value of this vector.this.norm().doubleValue()
.public abstract Vector<Q> plus(GeomVector<Q> that)
that
- the vector to be added. May not be null.this + that
.DimensionException
- if vector dimensions are different.public abstract Vector<Q> plus(Parameter<Q> that)
that
- the parameter to be added to each element of this vector. May not be
null.this + that
.public abstract Vector<Q> minus(GeomVector<Q> that)
that
- the vector to be subtracted from this vector. May not be null.this - that
.DimensionException
- if vector dimensions are different.public abstract Vector<Q> minus(Parameter<Q> that)
that
- the Parameter to be subtracted from each element of this vector. May
not be null.this - that
.public abstract Vector<Q> times(double k)
k
- the coefficient multiplier.this · k
public abstract Vector<? extends Quantity> times(Parameter<?> k)
k
- the coefficient multiplier. May not be null.this · k
public abstract Parameter<? extends Quantity> times(GeomVector<?> that)
that
- the vector multiplier. May not be null.this · that
DimensionException
- if this.dimension() != that.dimension()
public Parameter<? extends Quantity> dot(GeomVector<?> that)
that
- the vector multiplier. May not be null.this · that
DimensionException
- if this.dimension() != that.dimension()
public abstract Vector<? extends Quantity> timesEBE(GeomVector<?> that)
that
- the vector multiplier. May not be null.this .* that
DimensionException
- if this.dimension() != that.dimension()
public abstract Vector<? extends Quantity> cross(GeomVector<?> that)
that
- the vector multiplier. May not be null.this x that
DimensionException
- if
(that.getDimension() != this.getDimension())
public abstract Vector<Q> divide(double divisor)
divisor
- the divisor.this / divisor
.public abstract Vector<? extends Quantity> divide(Parameter<?> that)
that
- the divisor. May not be null.this / that
.public Parameter<Angle> angle(GeomVector<?> that)
that
- the vector to which the angle will be determined. May not be null.acos(this · that)/(norm(this)*norm(that))
public abstract Vector<Q> immutable()
public boolean isValid()
true
if this GeomVector contains valid and finite numerical
components. A value of false
will be returned if any of the elements
in this vector, including the origin, are invalid.isValid
in interface GeomElement<GeomVector>
public abstract Vector<Dimensionless> toUnitVector()
norm()
) of this vector.public Point getBoundsMin()
getBoundsMin
in interface GeomElement<GeomVector>
public Point getBoundsMax()
getBoundsMax
in interface GeomElement<GeomVector>
public Point getLimitPoint(int dim, boolean max, double tol)
getBoundsMin
or getBoundsMax
depending on the setting of
the "max" flag.getLimitPoint
in interface GeomElement<GeomVector>
dim
- An index indicating the dimension to find the min/max point for (0=X,
1=Y, 2=Z, etc).max
- Set to true
to return the maximum value, false
to return the minimum.tol
- Fractional tolerance to refine the min/max point position to if
necessary.getBoundsMin()
,
getBoundsMax()
public abstract ParameterVector<Q> toParameterVector()
ParameterVector
representation of this vector.public abstract Float64Vector toFloat64Vector()
Float64Vector
containing the elements of this vector stated
in the current units.public double[] toArray()
units
.public double[] toArray(double[] array)
units
stored in the input Java array.array
- An existing array that has at least as many elements as the physical
dimension of this vector.GeomElement.getPhyDimension()
public VectorTrans<Q> getTransformed(GTransform transform)
GeomTransform
and contains this element as a child.getTransformed
in interface Transformable<GeomVector>
transform
- The transformation to apply to this geometry. May not be null.DimensionException
- if this point is not 3D.public abstract GeomVector<Q> toDimension(int newDim)
toDimension
in interface GeomElement<GeomVector>
newDim
- The dimension of the vector to return.public javolution.text.Text toText()
{v = {{10 ft, -3 ft, 4.56 ft},o={0 m, 0m, 0m}}}If there is no name, then the output looks like this:
{{10 ft, -3 ft, 4.56 ft},o={0 m, 0 m, 0 m}}}
toText
in interface GeomElement<GeomVector>
toText
in class AbstractGeomElement<GeomVector>
public abstract GeomVector<Q> copy()
allocated
by the calling thread
(possibly on the stack).copy
in interface GeomElement<GeomVector>
public boolean isApproxEqual(GeomVector obj)
obj
- The vector object to compare with.true
if this vector is approximately identical to that vector;
false
otherwise.public boolean isApproxEqual(GeomVector obj, Parameter<Q> tol)
obj
- The vector object to compare with.tol
- The amount use to define approximate equality. If null
then
exact numerical equality is required.true
if this vector is approximately identical to that vector;
false
otherwise.