Class MPoint

All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
MAtomSetPoint, MEFlowBasePoint, MMidPoint, MRectanglePoint

@PublicApi public class MPoint extends MObject
Point object.
Since:
Marvin 3.3, 10/18/2003
See Also:
  • Constructor Details

    • MPoint

      public MPoint(double x, double y, double z)
      Contructs a point object.
      Parameters:
      x - the x coordinate
      y - the y coordinate
      z - the z coordinate
    • MPoint

      public MPoint(double x, double y)
      Contructs a point object.
      Parameters:
      x - the x coordinate
      y - the y coordinate
      Since:
      Marvin 4.1, 03/06/2006
    • MPoint

      public MPoint(DPoint3 p)
      Constructs a point object.
      Parameters:
      p - the point
    • MPoint

      public MPoint(MPoint p)
      Copy constructor.
      Parameters:
      p - the point
  • Method Details

    • hashCode

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

      public boolean equals(Object o)
      Two points equal if their location equals.
      Overrides:
      equals in class Object
      Parameters:
      o - the other point
      Returns:
      true if they equal, false otherwise
    • isChildOf

      public boolean isChildOf(MObject o)
      Is this object a children of another one?
      Overrides:
      isChildOf in class MObject
      Parameters:
      o - a possible parent
      Returns:
      true if the other object is the parent, false otherwise
    • isInternalSelectable

      public boolean isInternalSelectable()
      Is it a selection only internal object?
      Overrides:
      isInternalSelectable in class MObject
      Returns:
      true
    • clone

      public MPoint clone()
      Description copied from class: MObject
      Creates a clone.
      Overrides:
      clone in class MObject
      Returns:
      the clone
    • getLocation

      public void getLocation(DPoint3 p, CTransform3D t)
      Gets the point's location.
      Parameters:
      p - the output point object
      t - transformation or null
      Since:
      Marvin 4.1, 04/28/2006
    • getLocation

      public final DPoint3 getLocation(CTransform3D t)
      Gets the point's location.
      Parameters:
      t - transformation or null
      Returns:
      the point
      Since:
      Marvin 4.1, 04/28/2006
    • getLocation

      public final DPoint3 getLocation()
      Gets the point's location.
      Returns:
      the point
    • setLocation

      public void setLocation(DPoint3 p, CTransform3D t)
      Sets the point's location.
      Parameters:
      p - new location in the 'absolute' system (null transform)
      t - viewing transformation
      Since:
      Marvin 4.1, 04/28/2006
    • getPointCount

      public int getPointCount()
      Gets the number of points.
      Specified by:
      getPointCount in class MObject
      Returns:
      1
    • getPoint

      public MPoint getPoint(int i)
      Gets the point.
      Specified by:
      getPoint in class MObject
      Parameters:
      i - the point index (must be 0)
      Returns:
      the point's clone
    • getPointRefCount

      public int getPointRefCount()
      Gets the number of point references.
      Overrides:
      getPointRefCount in class MObject
      Returns:
      1
    • getPointRef

      public MPoint getPointRef(int i, CTransform3D trot)
      Gets a point of the line.
      Overrides:
      getPointRef in class MObject
      Parameters:
      i - the point index
      trot - the viewing transformation or null
      Returns:
      the point's reference
      Since:
      Marvin 4.1, 05/01/2006
    • transform

      public void transform(CTransform3D t, int opts, CTransform3D trot)
      Transforms all points.
      Specified by:
      transform in class MObject
      Parameters:
      t - the transformation matrix
      opts - transform options or 0
      trot - the viewing transformation or null
      See Also:
    • calcCenter

      public final void calcCenter(DPoint3 p, CTransform3D t)
      Calculates the geometrical center.
      Specified by:
      calcCenter in class MObject
      Parameters:
      p - store the coordinates here
      t - the transformation matrix or null
      Since:
      Marvin 4.1, 04/28/2006
    • distanceFrom

      public final double distanceFrom(double x, double y, CTransform3D t)
      Gets the 2D distance from the specified point.
      Specified by:
      distanceFrom in class MObject
      Parameters:
      x - the x coordinate
      y - the y coordinate
      t - transformation or null
      Since:
      Marvin 3.5, 11/04/2004
    • toString

      public String toString()
      Description copied from class: MObject
      Overrides Object.toString() to ease debugging. Returns a string consisting of the classname (without the package name!), the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object.
      Overrides:
      toString in class MObject
      Returns:
      a string representation of the object