public class DPoint3 extends Object implements Cloneable, Externalizable
| Modifier and Type | Field and Description |
|---|---|
double |
x
The x coordinate.
|
double |
y
The y coordinate.
|
double |
z
The z coordinate.
|
static DPoint3 |
ZERO_VECTOR |
| Constructor and Description |
|---|
DPoint3()
Construct a zero point.
|
DPoint3(double x,
double y,
double z)
Construct a point from the specified coordinates.
|
DPoint3(DPoint3 p)
Copy constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(DPoint3 v1)
Add the given point to this one.
|
static DPoint3 |
add(DPoint3 v1,
DPoint3 v2)
Calculates the sum of the two vectors
|
double |
angle2D(double x2,
double y2)
Calculates the absolute angle in the XY plane of the vector pointing
from this point to the other point.
|
double |
angle3D(DPoint3 p)
Calculate the angle of two vectors (this and p) in the range 0.0 through pi.
|
Object |
clone()
Make an identical copy.
|
static DPoint3 |
cross(DPoint3 v1,
DPoint3 v2)
Calculates the cross product of the two vectors
|
double |
distance(DPoint3 p)
Calculates the distance between two points.
|
double |
distance2D(DPoint3 p)
Calculates the distance between two points in the XY plane.
|
boolean |
equals(Object o)
Two points equal if their coordinates equal.
|
int |
hashCode() |
static boolean |
isCollinear(DPoint3 a,
DPoint3 b,
DPoint3 c)
Checks whether three 3D points can be connected with a line.
|
double |
lengthSquare()
Calculates the square of the length of the vector defining the point.
|
void |
readExternal(ObjectInput in)
Deserializes a 3D point.
|
static double |
scalar(DPoint3 v1,
DPoint3 v2)
Calculates the scalar product of the two vectors
|
void |
scale(double scaleFactor)
Scales the vector with the given factor.
|
void |
set(DPoint3 p)
Set coordinates.
|
void |
subtract(DPoint3 v2)
Subtract the given v2 vector from this one.
|
static DPoint3 |
subtract(DPoint3 v1,
DPoint3 v2)
Calculates the difference of the two vectors
|
String |
toString()
Gets a string representation of the point
|
void |
writeExternal(ObjectOutput out)
Serializes a 3D point.
|
public static final DPoint3 ZERO_VECTOR
public transient double x
public transient double y
public transient double z
public DPoint3()
public DPoint3(DPoint3 p)
p - the point to copypublic DPoint3(double x,
double y,
double z)
x - the x coordinatey - the y coordinatez - the z coordinatepublic void set(DPoint3 p)
p - point object containing the new coordinatespublic boolean equals(Object o)
public final double distance(DPoint3 p)
p - the other pointpublic double lengthSquare()
public final double distance2D(DPoint3 p)
p - the other pointpublic final double angle2D(double x2,
double y2)
x2 - the other point's x coordinatey2 - the other point's y coordinatepublic Object clone()
public String toString()
public void writeExternal(ObjectOutput out) throws IOException
writeExternal in interface Externalizableout - the object output streamIOExceptionpublic void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal in interface Externalizablein - the object input streamIOExceptionClassNotFoundExceptionpublic void subtract(DPoint3 v2)
v2 - public double angle3D(DPoint3 p)
p - public static double scalar(DPoint3 v1, DPoint3 v2)
v1 - v2 - public static DPoint3 cross(DPoint3 v1, DPoint3 v2)
v1 - v2 - public static DPoint3 add(DPoint3 v1, DPoint3 v2)
v1 - v2 - public static DPoint3 subtract(DPoint3 v1, DPoint3 v2)
v1 - v2 - public static boolean isCollinear(DPoint3 a, DPoint3 b, DPoint3 c)
a - b - c - public void add(DPoint3 v1)
v1 - public void scale(double scaleFactor)
scaleFactor - the scale factor