Serializable, Point<Euclidean1D>, Vector<Euclidean1D>public class Cartesian1D extends Vector1D implements Point<Euclidean1D>
An instance of Cartesian1D represents the point with the corresponding Cartesian coordinates.
An instance of Cartesian1D also represents the vector which begins at the origin and ends at the point corresponding to the coordinates.
Instances of this class are guaranteed to be immutable.
| Modifier and Type | Field | Description |
|---|---|---|
static Cartesian1D |
NaN |
A vector with all coordinates set to NaN.
|
static Cartesian1D |
NEGATIVE_INFINITY |
A vector with all coordinates set to negative infinity.
|
static Cartesian1D |
ONE |
Unit (coordinates: 1).
|
static Cartesian1D |
POSITIVE_INFINITY |
A vector with all coordinates set to positive infinity.
|
static Cartesian1D |
ZERO |
Origin (coordinates: 0).
|
| Constructor | Description |
|---|---|
Cartesian1D(double x) |
Simple constructor.
|
Cartesian1D(double a,
Cartesian1D u) |
Multiplicative constructor
Build a vector from another one and a scale factor.
|
Cartesian1D(double a1,
Cartesian1D u1,
double a2,
Cartesian1D u2) |
Linear constructor
Build a vector from two other ones and corresponding scale factors.
|
Cartesian1D(double a1,
Cartesian1D u1,
double a2,
Cartesian1D u2,
double a3,
Cartesian1D u3) |
Linear constructor
Build a vector from three other ones and corresponding scale factors.
|
Cartesian1D(double a1,
Cartesian1D u1,
double a2,
Cartesian1D u2,
double a3,
Cartesian1D u3,
double a4,
Cartesian1D u4) |
Linear constructor
Build a vector from four other ones and corresponding scale factors.
|
| Modifier and Type | Method | Description |
|---|---|---|
Cartesian1D |
add(double factor,
Vector<Euclidean1D> v) |
Add a scaled vector to the instance.
|
Cartesian1D |
add(Vector<Euclidean1D> v) |
Add a vector to the instance.
|
double |
distance(Cartesian1D c) |
Compute the distance between the instance and other coordinates.
|
static double |
distance(Cartesian1D p1,
Cartesian1D p2) |
Compute the distance between two points according to the L2 norm.
|
double |
distance(Point<Euclidean1D> p) |
Compute the distance between the instance and another point.
|
double |
distance(Vector<Euclidean1D> v) |
Compute the distance between the instance and another vector.
|
double |
distance1(Vector<Euclidean1D> p) |
Compute the distance between the instance and another vector according to the L1 norm.
|
static double |
distanceInf(Cartesian1D p1,
Cartesian1D p2) |
Compute the distance between two points according to the L∞ norm.
|
double |
distanceInf(Vector<Euclidean1D> p) |
Compute the distance between the instance and another vector according to the L∞ norm.
|
static double |
distanceSq(Cartesian1D p1,
Cartesian1D p2) |
Compute the square of the distance between two points.
|
double |
distanceSq(Vector<Euclidean1D> p) |
Compute the square of the distance between the instance and another vector.
|
double |
dotProduct(Vector<Euclidean1D> v) |
Compute the dot-product of the instance and another vector.
|
boolean |
equals(Object other) |
Test for the equality of two 1D vectors.
|
double |
getNorm() |
Get the L2 norm for the vector.
|
double |
getNorm1() |
Get the L1 norm for the vector.
|
double |
getNormInf() |
Get the L∞ norm for the vector.
|
double |
getNormSq() |
Get the square of the norm for the vector.
|
Space |
getSpace() |
Get the space to which the point belongs.
|
double |
getX() |
Get the abscissa of the vector.
|
Cartesian1D |
getZero() |
Get the null vector of the vectorial space or origin point of the affine space.
|
int |
hashCode() |
Get a hashCode for the 1D vector.
|
boolean |
isInfinite() |
Returns true if any coordinate of this vector is infinite and none are NaN;
false otherwise
|
boolean |
isNaN() |
Returns true if any coordinate of this point is NaN; false otherwise
|
Cartesian1D |
negate() |
Get the opposite of the instance.
|
Cartesian1D |
normalize() |
Get a normalized vector aligned with the instance.
|
Cartesian1D |
scalarMultiply(double a) |
Multiply the instance by a scalar.
|
Cartesian1D |
subtract(double factor,
Vector<Euclidean1D> v) |
Subtract a scaled vector from the instance.
|
Cartesian1D |
subtract(Vector<Euclidean1D> p) |
Subtract a vector from the instance.
|
String |
toString() |
Get a string representation of this vector.
|
String |
toString(NumberFormat format) |
Get a string representation of this vector.
|
public static final Cartesian1D ZERO
public static final Cartesian1D ONE
public static final Cartesian1D NaN
public static final Cartesian1D POSITIVE_INFINITY
public static final Cartesian1D NEGATIVE_INFINITY
public Cartesian1D(double x)
x - abscissagetX()public Cartesian1D(double a,
Cartesian1D u)
a - scale factoru - base (unscaled) vectorpublic Cartesian1D(double a1,
Cartesian1D u1,
double a2,
Cartesian1D u2)
a1 - first scale factoru1 - first base (unscaled) vectora2 - second scale factoru2 - second base (unscaled) vectorpublic Cartesian1D(double a1,
Cartesian1D u1,
double a2,
Cartesian1D u2,
double a3,
Cartesian1D u3)
a1 - first scale factoru1 - first base (unscaled) vectora2 - second scale factoru2 - second base (unscaled) vectora3 - third scale factoru3 - third base (unscaled) vectorpublic Cartesian1D(double a1,
Cartesian1D u1,
double a2,
Cartesian1D u2,
double a3,
Cartesian1D u3,
double a4,
Cartesian1D u4)
a1 - first scale factoru1 - first base (unscaled) vectora2 - second scale factoru2 - second base (unscaled) vectora3 - third scale factoru3 - third base (unscaled) vectora4 - fourth scale factoru4 - fourth base (unscaled) vectorpublic double getX()
getX in class Vector1DCartesian1D(double)public Space getSpace()
getSpace in interface Point<Euclidean1D>getSpace in interface Vector<Euclidean1D>public Cartesian1D getZero()
getZero in interface Vector<Euclidean1D>public double getNorm1()
getNorm1 in interface Vector<Euclidean1D>public double getNorm()
getNorm in interface Vector<Euclidean1D>public double getNormSq()
getNormSq in interface Vector<Euclidean1D>public double getNormInf()
getNormInf in interface Vector<Euclidean1D>public Cartesian1D add(Vector<Euclidean1D> v)
add in interface Vector<Euclidean1D>v - vector to addpublic Cartesian1D add(double factor, Vector<Euclidean1D> v)
add in interface Vector<Euclidean1D>factor - scale factor to apply to v before adding itv - vector to addpublic Cartesian1D subtract(Vector<Euclidean1D> p)
subtract in interface Vector<Euclidean1D>p - vector to subtractpublic Cartesian1D subtract(double factor, Vector<Euclidean1D> v)
subtract in interface Vector<Euclidean1D>factor - scale factor to apply to v before subtracting itv - vector to subtractpublic Cartesian1D normalize() throws MathArithmeticException
normalize in interface Vector<Euclidean1D>MathArithmeticException - if the norm is zeropublic Cartesian1D negate()
negate in interface Vector<Euclidean1D>public Cartesian1D scalarMultiply(double a)
scalarMultiply in interface Vector<Euclidean1D>a - scalarpublic boolean isNaN()
isNaN in interface Point<Euclidean1D>isNaN in interface Vector<Euclidean1D>public boolean isInfinite()
isInfinite in interface Vector<Euclidean1D>public double distance1(Vector<Euclidean1D> p)
Calling this method is equivalent to calling:
q.subtract(p).getNorm1() except that no intermediate
vector is built
distance1 in interface Vector<Euclidean1D>p - second vectorpublic double distance(Point<Euclidean1D> p)
distance in interface Point<Euclidean1D>p - second pointpublic double distance(Vector<Euclidean1D> v)
distance in interface Vector<Euclidean1D>v - second vectorpublic double distance(Cartesian1D c)
c - other coordinatespublic double distanceInf(Vector<Euclidean1D> p)
Calling this method is equivalent to calling:
q.subtract(p).getNormInf() except that no intermediate
vector is built
distanceInf in interface Vector<Euclidean1D>p - second vectorpublic double distanceSq(Vector<Euclidean1D> p)
Calling this method is equivalent to calling:
q.subtract(p).getNormSq() except that no intermediate
vector is built
distanceSq in interface Vector<Euclidean1D>p - second vectorpublic double dotProduct(Vector<Euclidean1D> v)
dotProduct in interface Vector<Euclidean1D>v - second vectorpublic static double distance(Cartesian1D p1, Cartesian1D p2)
Calling this method is equivalent to calling:
p1.subtract(p2).getNorm() except that no intermediate
vector is built
p1 - first vectorp2 - second vectorpublic static double distanceInf(Cartesian1D p1, Cartesian1D p2)
Calling this method is equivalent to calling:
p1.subtract(p2).getNormInf() except that no intermediate
vector is built
p1 - first vectorp2 - second vectorpublic static double distanceSq(Cartesian1D p1, Cartesian1D p2)
Calling this method is equivalent to calling:
p1.subtract(p2).getNormSq() except that no intermediate
vector is built
p1 - first vectorp2 - second vectorpublic boolean equals(Object other)
If all coordinates of two 1D vectors are exactly the same, and none are
Double.NaN, the two 1D vectors are considered to be equal.
NaN coordinates are considered to affect globally the vector
and be equals to each other - i.e, if either (or all) coordinates of the
1D vector are equal to Double.NaN, the 1D vector is equal to
NaN.
public int hashCode()
All NaN values have the same hash code.
public String toString()
public String toString(NumberFormat format)
toString in interface Vector<Euclidean1D>format - the custom format for componentsCopyright © 2003–2017 The Apache Software Foundation. All rights reserved.