chemaxon.struc
Class DPoint3

java.lang.Object
  extended by chemaxon.struc.DPoint3
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, java.lang.Cloneable

public class DPoint3
extends java.lang.Object
implements java.lang.Cloneable, java.io.Externalizable

Point in three dimensional space.

Version:
4.1, 04/28/2006
Author:
Peter Csizmadia
See Also:
Serialized Form

Field Summary
 double x
          The x coordinate.
 double y
          The y coordinate.
 double z
          The z coordinate.
 
Constructor Summary
DPoint3()
          Construct a zero point.
DPoint3(double x, double y, double z)
          Construct a point from the specified coordinates.
DPoint3(DPoint3 p)
          Copy constructor.
 
Method Summary
 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.
 java.lang.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(java.lang.Object o)
          Two points equal if their coordinates equal.
 void readExternal(java.io.ObjectInput in)
          Deserializes a 3D point.
 void set(DPoint3 p)
          Set coordinates.
 void subtract(DPoint3 v2)
          Subtract the given v2 vector from this one.
 java.lang.String toString()
          Gets a string representation of the point
 void writeExternal(java.io.ObjectOutput out)
          Serializes a 3D point.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

x

public transient double x
The x coordinate.


y

public transient double y
The y coordinate.


z

public transient double z
The z coordinate.

Constructor Detail

DPoint3

public DPoint3()
Construct a zero point.


DPoint3

public DPoint3(DPoint3 p)
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 coordinate
y - the y coordinate
z - the z coordinate
Method Detail

set

public void set(DPoint3 p)
Set coordinates.

Parameters:
p - point object containing the new coordinates
Since:
Marvin 3.5, 11/04/2004

equals

public boolean equals(java.lang.Object o)
Two points equal if their coordinates equal.

Overrides:
equals in class java.lang.Object
Parameters:
o - the other point
Returns:
true if the coordinates equal, false otherwise

distance

public final double distance(DPoint3 p)
Calculates the distance between two points.

Parameters:
p - the other point
Returns:
the distance

distance2D

public final double distance2D(DPoint3 p)
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 coordinate
y2 - the other point's y coordinate
Returns:
the angle (from -pi to pi)
Since:
Marvin 3.0

clone

public java.lang.Object clone()
Make an identical copy.

Overrides:
clone in class java.lang.Object
Returns:
the clone

toString

public java.lang.String toString()
Gets a string representation of the point

Overrides:
toString in class java.lang.Object
Returns:
the string representation

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Serializes a 3D point.

Specified by:
writeExternal in interface java.io.Externalizable
Parameters:
out - the object output stream
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Deserializes a 3D point.

Specified by:
readExternal in interface java.io.Externalizable
Parameters:
in - the object input stream
Throws:
java.io.IOException
java.lang.ClassNotFoundException

subtract

public void subtract(DPoint3 v2)
Subtract the given v2 vector from this one.

Parameters:
v2 -

angle3D

public double angle3D(DPoint3 p)
Calculate the angle of two vectors (this and p) in the range 0.0 through pi.

Parameters:
p -
Returns:
angle of two vectors (this and p) in the range 0.0 through pi

cross

public static DPoint3 cross(DPoint3 v1,
                            DPoint3 v2)
Calculates the cross product of the two vectors

Parameters:
v1 -
v2 -
Returns:
the cross product

add

public static DPoint3 add(DPoint3 v1,
                          DPoint3 v2)
Calculates the sum of the two vectors

Parameters:
v1 -
v2 -
Returns:
the sum

add

public void add(DPoint3 v1)
Add the given point to this one.

Parameters:
v1 -