public class PlanePoint
extends java.lang.Object
Because this space is built on the vector space R2, any instance of this class also represents a vector in R2. Moreover, unless otherwise stated, we assume the orthonormal frame {O, e1, e2} where O=(0,0), e1=(1, 0), e2=(0, 1).
Modifier and Type | Field and Description |
---|---|
double |
x1
The first element.
|
double |
x2
The second element.
|
Constructor and Description |
---|
PlanePoint(double x1,
double x2)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
double |
angle(PlanePoint vec)
Calculates the angle between this vector and the specified argument,
provided none of these vectors is the null vector.
|
PlanePoint |
diff(PlanePoint vec)
Calculates the sum of this vector with the reciprocal of the specified
argument.
|
double |
distance(PlanePoint p)
Calculates the distance between this point and the specified argument.
|
double |
dot(PlanePoint vec)
Calulates the dot product of this vector by the specified argument.
|
boolean |
equals(double x1,
double x2)
Check to see if the point values are equal.
|
boolean |
equals(java.lang.Object o)
Overridden to reflect equality of abstract values (data object) as
opposite to object identity.
|
int |
hashCode()
Overridden to reflect equality of abstract values (data object) as
opposite to object identity.
|
double |
norm()
Calculates the Euclidian norm of this vector.
|
PlanePoint |
normalize()
Calculates the unit vector of this vector, provided this is not the null
vector.
|
PlanePoint |
scalar(double k)
Multiplies this vector by the specified scalar.
|
PlanePoint |
sum(PlanePoint vec)
Calculates the sum of this vector with the specified argument.
|
PlanePoint |
vec(double x1,
double x2)
Calculates the vector associated to this point and the specified
argument.
|
PlanePoint |
vec(PlanePoint p)
Calculates the vector associated to this point and the specified
argument.
|
public final double x1
public final double x2
public PlanePoint(double x1, double x2)
x1
- The first element of the pointx2
- The second element of the pointpublic double distance(PlanePoint p)
p
- The other point. Mustn't be null
.public PlanePoint sum(PlanePoint vec)
vec
- The other vector. Mustn't be a null
reference.vec
.public PlanePoint diff(PlanePoint vec)
vec
- The other vector. Mustn't be a null
reference.-vec
.public PlanePoint scalar(double k)
k
- The scalar.k
.public PlanePoint vec(PlanePoint p)
f(a, b) = b - a = (b1 - a1, b2 - a2)
p
- The other point. Mustn't be a null
reference.public PlanePoint vec(double x1, double x2)
f(a, b) = b - a = (b1 - a1, b2 - a2)
x1
- The first element of the pointx2
- The second element of the pointpublic double dot(PlanePoint vec)
vec
- The other vector in the product. Mustn't be a
null
reference.public double norm()
dot
product of this vector by itself.public PlanePoint normalize()
public double angle(PlanePoint vec)
vec
- The other vector. Mustn't be a null
reference
and mustn't be the null vector.vec
, in the
range of 0
through pi
.java.lang.IllegalArgumentException
- If this vector or vec
or both are the null
vector.public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
Object.equals(Object)
public boolean equals(double x1, double x2)
x1
- The comparison point's first element.x2
- The comparison point's second element.true
if the points are equal, false
otherwise.public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()