Skip navigation links
WebARTS Design
Java Library

Version 0.10.2
2020-11-11 (Wed), 10:42:54
org.graphstream.ui.geom

## Class 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 and Description
`static Point2` `NULL_POINT2`
Specific point at (0,0).
`private static long` `serialVersionUID`
`double` `x`
X axis value.
`double` `y`
Y axis value.
• ### Constructor Summary

Constructors
Constructor and Description
`Point2()`
New 2D point at (0,0).
```Point2(double x, double y)```
New 2D point at (x,y).
`Point2(Point2 other)`
New copy of other.
• ### Method Summary

All Methods
Modifier and Type Method and Description
`void` `copy(Point2 other)`
Make this a copy of other.
`double` `distance(Point2 other)`
Distance between this and `other`.
`Point2` ```interpolate(Point2 other, double factor)```
Create a new point linear interpolation of this and `other`.
`boolean` `isZero()`
Are all components to zero?.
`void` ```make(double x, double y)```
New 2D point at (x,y).
`void` ```move(double dx, double dy)```
Move of given vector (dx,dy).
`void` `move(Point2 p)`
Move of given point `p`.
`void` ```moveTo(double x, double y)```
Move to absolute position (x,y).
`void` `moveX(double dx)`
Move horizontally of dx.
`void` `moveY(double dy)`
Move vertically of dy.
`void` ```scale(double sx, double sy)```
Scale of factor (sx,sy).
`void` `scale(Point2 s)`
Scale by factor s.
`void` ```set(double x, double y)```
Like #moveTo().
`void` `setX(double x)`
Change only abscissa at absolute coordinate x.
`void` `setY(double y)`
Change only ordinate at absolute coordinate y.
`void` `swap(Point2 other)`
Exchange the values of this and other.
`String` `toString()`
• ### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`
• ### Field Detail

• #### serialVersionUID

`private static final long serialVersionUID`
See Also:
Constant Field Values
• #### x

`public double x`
X axis value.
• #### y

`public double y`
Y axis value.
• #### NULL_POINT2

`public static final Point2 NULL_POINT2`
Specific point at (0,0).
• ### Constructor Detail

• #### Point2

`public Point2()`
New 2D point at (0,0).
• #### Point2

```public Point2(double x,
double y)```
New 2D point at (x,y).
• #### Point2

`public Point2(Point2 other)`
New copy of other.
• ### Method Detail

• #### make

```public void make(double x,
double y)```
New 2D point at (x,y).
• #### isZero

`public boolean isZero()`
Are all components to zero?.
• #### interpolate

```public Point2 interpolate(Point2 other,
double factor)```
Create a new point linear interpolation of this and `other`. The new point is located between this and `other` if `factor` is between 0 and 1 (0 yields this point, 1 yields the `other` point).
• #### distance

`public double distance(Point2 other)`
Distance between this and `other`.
• #### copy

`public void copy(Point2 other)`
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

`public void move(Point2 p)`
Move of given point `p`.
• #### 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

`public void scale(Point2 s)`
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

`public void swap(Point2 other)`
Exchange the values of this and other.
• #### toString

`public String toString()`
Overrides:
`toString` in class `Object`
Skip navigation links
Copyright (C) 2001-2021, Tom B. Gutwin

WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses