Package snap.geom

Class Point

java.lang.Object
snap.geom.Point
All Implemented Interfaces:
Cloneable

public class Point extends Object implements Cloneable
A class to represent a simple geometric point.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    double
     
    double
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create new point.
    Point(double aX, double aY)
    Create new point.
    Point(Point aPoint)
    Create new point.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(Point aPoint)
    Adds the given point to this point.
    Standard clone implementation.
    static boolean
    equals(double x0, double y0, double x1, double y1)
    Standard equals implementation.
    boolean
    equals(Object anObj)
    Standard equals implementation.
    static final double
    getAngle(double x0, double y0, double x1, double y1)
    Returns the angle to the mouse point.
    double
    getDistance(double px, double py)
    Returns the distance from this Point to a specified point.
    static final double
    getDistance(double x0, double y0, double x1, double y1)
    Returns the distance from this Point to a specified point.
    double
    Returns the distance from this Point to a specified point.
    static final double
    getDistanceSquared(double x0, double y0, double x1, double y1)
    Returns the distance from this Point to a specified point.
    int
    Returns the rounded x value (as int).
    int
    Returns the rounded y value (as int).
    final double
    Return point x.
    final double
    Return point y.
    void
    multiply(double sx, double sy)
    Multiplies this point by the given sx and sy.
    void
    offset(double dx, double dy)
    Offsets the receiver by the given x and y.
    final void
    setPoint(Point aPoint)
    Sets the x/y.
    final void
    setX(double aValue)
    Set point x.
    final void
    setXY(double aX, double aY)
    Sets the x/y.
    final void
    setY(double aValue)
    Set point y.
    void
    Rounds a point to neared integers.
    void
    subtract(Point aPoint)
    Subtracts the given point from this point.
    Returns a string representation of the receiver in the form "[x y]".
    void
    Transforms this point by the given Transform.

    Methods inherited from class java.lang.Object

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

    • x

      public double x
    • y

      public double y
  • Constructor Details

    • Point

      public Point()
      Create new point.
    • Point

      public Point(double aX, double aY)
      Create new point.
    • Point

      public Point(Point aPoint)
      Create new point.
  • Method Details

    • getX

      public final double getX()
      Return point x.
    • setX

      public final void setX(double aValue)
      Set point x.
    • getY

      public final double getY()
      Return point y.
    • setY

      public final void setY(double aValue)
      Set point y.
    • setXY

      public final void setXY(double aX, double aY)
      Sets the x/y.
    • setPoint

      public final void setPoint(Point aPoint)
      Sets the x/y.
    • offset

      public void offset(double dx, double dy)
      Offsets the receiver by the given x and y.
    • getRoundX

      public int getRoundX()
      Returns the rounded x value (as int).
    • getRoundY

      public int getRoundY()
      Returns the rounded y value (as int).
    • add

      public void add(Point aPoint)
      Adds the given point to this point.
    • subtract

      public void subtract(Point aPoint)
      Subtracts the given point from this point.
    • multiply

      public void multiply(double sx, double sy)
      Multiplies this point by the given sx and sy.
    • transformBy

      public void transformBy(Transform aTrans)
      Transforms this point by the given Transform.
    • getDistance

      public double getDistance(Point aPoint)
      Returns the distance from this Point to a specified point.
    • getDistance

      public double getDistance(double px, double py)
      Returns the distance from this Point to a specified point.
    • snap

      public void snap()
      Rounds a point to neared integers.
    • equals

      public boolean equals(Object anObj)
      Standard equals implementation.
      Overrides:
      equals in class Object
    • clone

      public Point clone()
      Standard clone implementation.
      Overrides:
      clone in class Object
    • toString

      public String toString()
      Returns a string representation of the receiver in the form "[x y]".
      Overrides:
      toString in class Object
    • equals

      public static boolean equals(double x0, double y0, double x1, double y1)
      Standard equals implementation.
    • getDistance

      public static final double getDistance(double x0, double y0, double x1, double y1)
      Returns the distance from this Point to a specified point.
    • getDistanceSquared

      public static final double getDistanceSquared(double x0, double y0, double x1, double y1)
      Returns the distance from this Point to a specified point.
    • getAngle

      public static final double getAngle(double x0, double y0, double x1, double y1)
      Returns the angle to the mouse point.