Class DPoint3

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

@PublicAPI public class DPoint3 extends Object implements Cloneable, Externalizable
Point in three dimensional space.
Since:
4.1, 04/28/2006
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    double
    The x coordinate.
    double
    The y coordinate.
    double
    The z coordinate.
    static final DPoint3
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Construct a zero point.
    DPoint3(double x, double y, double z)
    Construct a point from the specified coordinates.
    Copy constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Add the given point to this one.
    static DPoint3
    add(DPoint3 v1, DPoint3 v2)
    Calculates the sum of the two vectors
    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.
    double
    Calculate the angle of two vectors (this and p) in the range 0.0 through pi.
    Make an identical copy.
    static DPoint3
    Calculates the cross product of the two vectors
    final double
    Calculates the distance between two points.
    final double
    Calculates the distance between two points in the XY plane.
    boolean
    Two points equal if their coordinates equal.
    int
     
    static boolean
    Checks whether three 3D points can be connected with a line.
    double
    Calculates the square of the length of the vector defining the point.
    void
    Deserializes a 3D point.
    void
    roundTo(int decimals)
    Rounds the represented value to the given decimal precision.
    static double
    Calculates the scalar product of the two vectors
    void
    scale(double scaleFactor)
    Scales the vector with the given factor.
    void
    Set coordinates.
    void
    Subtract the given v2 vector from this one.
    static DPoint3
    Calculates the difference of the two vectors
     
    Gets a string representation of the point
    void
    Serializes a 3D point.

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • ZERO_VECTOR

      public static final DPoint3 ZERO_VECTOR
    • 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 Details

    • 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 Details

    • 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(Object o)
      Two points equal if their coordinates equal.
      Overrides:
      equals in class Object
      Parameters:
      o - the other point
      Returns:
      true if the coordinates equal, false otherwise
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • distance

      public final double distance(DPoint3 p)
      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

      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 DPoint3 clone()
      Make an identical copy.
      Overrides:
      clone in class Object
      Returns:
      the clone
    • toString

      public String toString()
      Gets a string representation of the point
      Overrides:
      toString in class Object
      Returns:
      the string representation
    • writeExternal

      public void writeExternal(ObjectOutput out) throws IOException
      Serializes a 3D point.
      Specified by:
      writeExternal in interface Externalizable
      Parameters:
      out - the object output stream
      Throws:
      IOException
    • readExternal

      public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
      Deserializes a 3D point.
      Specified by:
      readExternal in interface Externalizable
      Parameters:
      in - the object input stream
      Throws:
      IOException
      ClassNotFoundException
    • subtract

      public void subtract(DPoint3 v2)
      Subtract the given v2 vector from this one.
      Since:
      Marvin 6.2
    • angle3D

      public double angle3D(DPoint3 p)
      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

      public static double scalar(DPoint3 v1, DPoint3 v2)
      Calculates the scalar product of the two vectors
      Returns:
      the scalar product
      Since:
      Marvin 6.2
    • cross

      public static DPoint3 cross(DPoint3 v1, DPoint3 v2)
      Calculates the cross product of the two vectors
      Returns:
      the cross product
      Since:
      Marvin 6.2
    • add

      public static DPoint3 add(DPoint3 v1, DPoint3 v2)
      Calculates the sum of the two vectors
      Returns:
      the sum
      Since:
      Marvin 6.2
    • subtract

      public static DPoint3 subtract(DPoint3 v1, DPoint3 v2)
      Calculates the difference of the two vectors
      Returns:
      v1 - v2
      Since:
      Marvin 6.2
    • isCollinear

      public static boolean isCollinear(DPoint3 a, DPoint3 b, DPoint3 c)
      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

      public void add(DPoint3 v1)
      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

      public Point2D toPoint2D()
    • roundTo

      public void roundTo(int decimals)
      Rounds the represented value to the given decimal precision.
      Parameters:
      decimals - how many deciamls should be left