Package chemaxon.struc
Class DPoint3
java.lang.Object
chemaxon.struc.DPoint3
- All Implemented Interfaces:
Externalizable,Serializable,Cloneable
Point in three dimensional space.
- Since:
- 4.1, 04/28/2006
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptiondoubleThe x coordinate.doubleThe y coordinate.doubleThe z coordinate.static final DPoint3 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd the given point to this one.static DPoint3Calculates the sum of the two vectorsfinal doubleangle2D(double x2, double y2) Calculates the absolute angle in the XY plane of the vector pointing from this point to the other point.doubleCalculate the angle of two vectors (this and p) in the range 0.0 through pi.clone()Make an identical copy.static DPoint3Calculates the cross product of the two vectorsfinal doubleCalculates the distance between two points.final doubleCalculates the distance between two points in the XY plane.booleanTwo points equal if their coordinates equal.inthashCode()static booleanisCollinear(DPoint3 a, DPoint3 b, DPoint3 c) Checks whether three 3D points can be connected with a line.doubleCalculates the square of the length of the vector defining the point.voidDeserializes a 3D point.voidroundTo(int decimals) Rounds the represented value to the given decimal precision.static doubleCalculates the scalar product of the two vectorsvoidscale(double scaleFactor) Scales the vector with the given factor.voidSet coordinates.voidSubtract the given v2 vector from this one.static DPoint3Calculates the difference of the two vectorstoString()Gets a string representation of the pointvoidSerializes a 3D point.
-
Field Details
-
ZERO_VECTOR
-
x
public transient double xThe x coordinate. -
y
public transient double yThe y coordinate. -
z
public transient double zThe z coordinate.
-
-
Constructor Details
-
DPoint3
public DPoint3()Construct a zero point. -
DPoint3
Copy constructor.- Parameters:
p- the point to copy
-
DPoint3
public DPoint3(double x, double y, double z) Construct a point from the specified coordinates.- Parameters:
x- the x coordinatey- the y coordinatez- the z coordinate
-
-
Method Details
-
set
Set coordinates.- Parameters:
p- point object containing the new coordinates- Since:
- Marvin 3.5, 11/04/2004
-
equals
Two points equal if their coordinates equal. -
hashCode
public int hashCode() -
distance
Calculates the distance between two points.- Parameters:
p- the other point- Returns:
- the distance
-
lengthSquare
public double lengthSquare()Calculates the square of the length of the vector defining the point.- Returns:
- the square of the length
- Since:
- Marvin 6.2
-
distance2D
Calculates the distance between two points in the XY plane.- Parameters:
p- the other point- Returns:
- the distance
- Since:
- Marvin 4.1, 04/28/2006
-
angle2D
public final 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. In other words, takes the difference between this vector and the vector pointing from the origin to the other point and returns the angle of the resultant vector's projection onto the XY plane.- Parameters:
x2- the other point's x coordinatey2- the other point's y coordinate- Returns:
- the angle (from -pi to pi)
- Since:
- Marvin 3.0
-
clone
Make an identical copy. -
toString
Gets a string representation of the point -
writeExternal
Serializes a 3D point.- Specified by:
writeExternalin interfaceExternalizable- Parameters:
out- the object output stream- Throws:
IOException
-
readExternal
Deserializes a 3D point.- Specified by:
readExternalin interfaceExternalizable- Parameters:
in- the object input stream- Throws:
IOExceptionClassNotFoundException
-
subtract
Subtract the given v2 vector from this one.- Since:
- Marvin 6.2
-
angle3D
Calculate the angle of two vectors (this and p) in the range 0.0 through pi.- Returns:
- angle of two vectors (this and p) in the range 0.0 through pi
- Since:
- Marvin 6.2
-
scalar
Calculates the scalar product of the two vectors- Returns:
- the scalar product
- Since:
- Marvin 6.2
-
cross
Calculates the cross product of the two vectors- Returns:
- the cross product
- Since:
- Marvin 6.2
-
add
Calculates the sum of the two vectors- Returns:
- the sum
- Since:
- Marvin 6.2
-
subtract
Calculates the difference of the two vectors- Returns:
- v1 - v2
- Since:
- Marvin 6.2
-
isCollinear
Checks whether three 3D points can be connected with a line.- Returns:
- true if points are on the same line
- Since:
- Marvin 6.2
-
add
Add the given point to this one. -
scale
public void scale(double scaleFactor) Scales the vector with the given factor.- Parameters:
scaleFactor- the scale factor
-
toPoint2D
-
roundTo
public void roundTo(int decimals) Rounds the represented value to the given decimal precision.- Parameters:
decimals- how many deciamls should be left
-