Package org.graphstream.ui.geom
Class Point2
java.lang.Object
org.graphstream.ui.geom.Point2
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
Point3
public class Point2 extends Object implements Serializable
2D point.
A Point2 is a 2D location in an affine space described by three values along
the X, and Y axes. This differs from the Vector3 and Vector4 classes in that
it is only 2D and has no vector arithmetic bound to it (to points cannot be
added, this would have no mathematical meaning).
- Since:
- 20001121 creation
- Version:
- 0.1
- Author:
- Antoine Dutot
- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description static Point2NULL_POINT2Specific point at (0,0).doublexX axis value.doubleyY axis value. -
Constructor Summary
-
Method Summary
Modifier and Type Method Description voidcopy(Point2 other)Make this a copy of other.doubledistance(Point2 other)Distance between this andother.booleanequals(Object o)inthashCode()Point2interpolate(Point2 other, double factor)Create a new point linear interpolation of this andother.booleanisZero()Are all components to zero?.voidmake(double x, double y)New 2D point at (x,y).voidmove(double dx, double dy)Move of given vector (dx,dy).voidmove(Point2 p)Move of given pointp.voidmoveTo(double x, double y)Move to absolute position (x,y).voidmoveX(double dx)Move horizontally of dx.voidmoveY(double dy)Move vertically of dy.voidscale(double sx, double sy)Scale of factor (sx,sy).voidscale(Point2 s)Scale by factor s.voidset(double x, double y)Like #moveTo().voidsetX(double x)Change only abscissa at absolute coordinate x.voidsetY(double y)Change only ordinate at absolute coordinate y.voidswap(Point2 other)Exchange the values of this and other.StringtoString()
-
Field Details
-
x
public double xX axis value. -
y
public double yY axis value. -
NULL_POINT2
Specific point at (0,0).
-
-
Constructor Details
-
Method Details
-
make
public void make(double x, double y)New 2D point at (x,y). -
isZero
public boolean isZero()Are all components to zero?. -
interpolate
Create a new point linear interpolation of this andother. The new point is located between this andotheriffactoris between 0 and 1 (0 yields this point, 1 yields theotherpoint). -
distance
Distance between this andother. -
copy
Make this a copy of other. -
set
public void set(double x, double y)Like #moveTo(). -
moveTo
public void moveTo(double x, double y)Move to absolute position (x,y). -
move
public void move(double dx, double dy)Move of given vector (dx,dy). -
move
Move of given pointp. -
moveX
public void moveX(double dx)Move horizontally of dx. -
moveY
public void moveY(double dy)Move vertically of dy. -
scale
public void scale(double sx, double sy)Scale of factor (sx,sy). -
scale
Scale by factor s. -
setX
public void setX(double x)Change only abscissa at absolute coordinate x. -
setY
public void setY(double y)Change only ordinate at absolute coordinate y. -
swap
Exchange the values of this and other. -
toString
-
equals
-
hashCode
public int hashCode()
-