| 
 | Search this API | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecty.geom.YPoint
public final class YPoint
This class represents a point in the plane with double coordinates. This class implements the immutable design pattern.
| Field Summary | |
|---|---|
| static YPoint | ORIGINA YPointconstant with coordinates (0,0). | 
|  double | xThe x coordinate of the point. | 
|  double | yThe y coordinate of the point. | 
| Constructor Summary | |
|---|---|
| YPoint()Creates a new YPointat location (0,0) | |
| YPoint(double x,
       double y)Creates a new YPointobject for a given position. | |
| Method Summary | |
|---|---|
| static YPoint | add(YPoint p1,
    YPoint p2)Adds two points and returns the result. | 
|  int | compareTo(java.lang.Object o)Comparable implementation. | 
| static double | distance(double x1,
         double y1,
         double x2,
         double y2)Returns the euclidean distance between two points. | 
| static double | distance(YPoint p1,
         YPoint p2)Returns the euclidean distance between two points. | 
|  double | distanceTo(double x,
           double y)Returns the euclidean distance between this point and a given point. | 
|  double | distanceTo(YPoint p)Returns the euclidean distance between this point and a given point. | 
|  boolean | equals(java.lang.Object o)Tests a point to equality to another point. | 
|  double | getX()Returns the x-coordinate of the point object. | 
|  double | getY()Returns the y-coordinate of the point object. | 
|  int | hashCode() | 
| static YPoint | midPoint(YPoint p1,
         YPoint p2)Returns a point that geometrically lies in in the middle of the line formed by the given points. | 
|  YPoint | moveBy(double x,
       double y)Returns the point, got by moving this point to another position. | 
| static YPoint | subtract(YPoint p1,
         YPoint p2)Subtracts two points (p1 - p2) and returns the result. | 
| static YPoint | swap(YPoint p)Returns a copy of the given point with exchanged x- and y-coordinates. | 
|  java.lang.String | toString()Returns the coordinates of the point as string. | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, finalize, getClass, notify, notifyAll, wait, wait, wait | 
| Field Detail | 
|---|
public final double x
public final double y
public static final YPoint ORIGIN
YPoint constant with coordinates (0,0).
| Constructor Detail | 
|---|
public YPoint()
YPoint at location (0,0)
public YPoint(double x,
              double y)
YPoint object for a given position.
x - the x coordinate of the point.y - the y coordinate of the point.| Method Detail | 
|---|
public final double getX()
public final double getY()
public double distanceTo(double x,
                         double y)
x - the x coordinate of an arbitrary pointy - the y coordinate of an arbitrary point
public double distanceTo(YPoint p)
p - an arbitrary point
public static double distance(YPoint p1,
                              YPoint p2)
p1 - an arbitrary pointp2 - an arbitrary point
public static double distance(double x1,
                              double y1,
                              double x2,
                              double y2)
x1 - x-coordinate of first pointy1 - y-coordinate of first pointx2 - x-coordinate of second pointy2 - y-coordinate of second point
public static YPoint add(YPoint p1,
                         YPoint p2)
p1 - an arbitrary instance of YPoint.p2 - an arbitrary instance of YPoint.
public static YPoint subtract(YPoint p1,
                              YPoint p2)
p1 - an arbitrary instance of YPoint.p2 - an arbitrary instance of YPoint.
public static YPoint midPoint(YPoint p1,
                              YPoint p2)
p1 - an arbitrary instance of YPoint.p2 - an arbitrary instance of YPoint.public static YPoint swap(YPoint p)
p - an arbitrary instance of YPoint.
public YPoint moveBy(double x,
                     double y)
x - the value which is added on the x-coordinate of the point.y - the value which is added on the y-coordinate of the point.
public boolean equals(java.lang.Object o)
o is also an instance of
 YPoint and has the same coordinates as the instance on which equals is
 invoked.
equals in class java.lang.Objecto - an arbitrary instance.public int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic int compareTo(java.lang.Object o)
compareTo in interface java.lang.Comparable| 
 | © Copyright 2000-2025, yWorks GmbH. All rights reserved. | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||