APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.javafx.geom

public Class Point2D

extends Object
Class Inheritance

The Point2D class defines a point representing a location in (x,y) coordinate space.

Field Summary

Modifier and TypeField and Description
public float
x

The X coordinate of this Point2D.

public float
y

The Y coordinate of this Point2D.

Constructor Summary

AccessConstructor and Description
public
Point2D()

Constructs and initializes a Point2D with coordinates (0, 0).

public
Point2D(float
the X coordinate of the newly constructed Point2D
x
,
float
the Y coordinate of the newly constructed Point2D
y
)

Constructs and initializes a Point2D with the specified coordinates.

Method Summary

Modifier and TypeMethod and Description
public static float

Returns:

the distance between the two sets of specified coordinates.
distance
(float
the X coordinate of the first specified point
x1
,
float
the Y coordinate of the first specified point
y1
,
float
the X coordinate of the second specified point
x2
,
float
the Y coordinate of the second specified point
y2
)

Returns the distance between two points.

public float

Returns:

the distance between this Point2D and a specified point.
distance
(float
the X coordinate of the specified point to be measured against this Point2D
px
,
float
the Y coordinate of the specified point to be measured against this Point2D
py
)

Returns the distance from this Point2D to a specified point.

public float

Returns:

the distance between this Point2D and the specified Point2D.
distance
(Point2D
the specified point to be measured against this Point2D
pt
)

Returns the distance from this Point2D to a specified Point2D.

public static float

Returns:

the square of the distance between the two sets of specified coordinates.
distanceSq
(float
the X coordinate of the first specified point
x1
,
float
the Y coordinate of the first specified point
y1
,
float
the X coordinate of the second specified point
x2
,
float
the Y coordinate of the second specified point
y2
)

Returns the square of the distance between two points.

public float

Returns:

the square of the distance between this Point2D and the specified point.
distanceSq
(float
the X coordinate of the specified point to be measured against this Point2D
px
,
float
the Y coordinate of the specified point to be measured against this Point2D
py
)

Returns the square of the distance from this Point2D to a specified point.

public float

Returns:

the square of the distance between this Point2D to a specified Point2D.
distanceSq
(Point2D
the specified point to be measured against this Point2D
pt
)

Returns the square of the distance from this Point2D to a specified Point2D.

public boolean

Returns:

true if the object to be compared is an instance of Point2D and has the same values; false otherwise.
equals
(Object
an object to be compared with this Point2D
obj
)

Overrides java.lang.Object.equals.

Determines whether or not two points are equal.

public int

Returns:

a hash code for this Point2D.
hashCode
()

Overrides java.lang.Object.hashCode.

Returns the hashcode for this Point2D.

public void
setLocation(float
the new X coordinate of this Point2D
x
,
float
the new Y coordinate of this Point2D
y
)

Sets the location of this Point2D to the specified float coordinates.

public void
setLocation(Point2D
the specified Point2D to which to set this Point2D
p
)

Sets the location of this Point2D to the same coordinates as the specified Point2D object.

public String

Returns:

a string representation of this Point2D.
toString
()

Overrides java.lang.Object.toString.

Returns a String that represents the value of this Point2D.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

xback to summary
public float x

The X coordinate of this Point2D.

yback to summary
public float y

The Y coordinate of this Point2D.

Constructor Detail

Point2Dback to summary
public Point2D()

Constructs and initializes a Point2D with coordinates (0, 0).

Point2Dback to summary
public Point2D(float x, float y)

Constructs and initializes a Point2D with the specified coordinates.

Parameters
x:float

the X coordinate of the newly constructed Point2D

y:float

the Y coordinate of the newly constructed Point2D

Method Detail

distanceback to summary
public static float distance(float x1, float y1, float x2, float y2)

Returns the distance between two points.

Parameters
x1:float

the X coordinate of the first specified point

y1:float

the Y coordinate of the first specified point

x2:float

the X coordinate of the second specified point

y2:float

the Y coordinate of the second specified point

Returns:float

the distance between the two sets of specified coordinates.

distanceback to summary
public float distance(float px, float py)

Returns the distance from this Point2D to a specified point.

Parameters
px:float

the X coordinate of the specified point to be measured against this Point2D

py:float

the Y coordinate of the specified point to be measured against this Point2D

Returns:float

the distance between this Point2D and a specified point.

distanceback to summary
public float distance(Point2D pt)

Returns the distance from this Point2D to a specified Point2D.

Parameters
pt:Point2D

the specified point to be measured against this Point2D

Returns:float

the distance between this Point2D and the specified Point2D.

distanceSqback to summary
public static float distanceSq(float x1, float y1, float x2, float y2)

Returns the square of the distance between two points.

Parameters
x1:float

the X coordinate of the first specified point

y1:float

the Y coordinate of the first specified point

x2:float

the X coordinate of the second specified point

y2:float

the Y coordinate of the second specified point

Returns:float

the square of the distance between the two sets of specified coordinates.

distanceSqback to summary
public float distanceSq(float px, float py)

Returns the square of the distance from this Point2D to a specified point.

Parameters
px:float

the X coordinate of the specified point to be measured against this Point2D

py:float

the Y coordinate of the specified point to be measured against this Point2D

Returns:float

the square of the distance between this Point2D and the specified point.

distanceSqback to summary
public float distanceSq(Point2D pt)

Returns the square of the distance from this Point2D to a specified Point2D.

Parameters
pt:Point2D

the specified point to be measured against this Point2D

Returns:float

the square of the distance between this Point2D to a specified Point2D.

equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Determines whether or not two points are equal. Two instances of Point2D are equal if the values of their x and y member fields, representing their position in the coordinate space, are the same.

Parameters
obj:Object

an object to be compared with this Point2D

Returns:boolean

true if the object to be compared is an instance of Point2D and has the same values; false otherwise.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Returns the hashcode for this Point2D.

Returns:int

a hash code for this Point2D.

Annotations
@Override
setLocationback to summary
public void setLocation(float x, float y)

Sets the location of this Point2D to the specified float coordinates.

Parameters
x:float

the new X coordinate of this Point2D

y:float

the new Y coordinate of this Point2D

setLocationback to summary
public void setLocation(Point2D p)

Sets the location of this Point2D to the same coordinates as the specified Point2D object.

Parameters
p:Point2D

the specified Point2D to which to set this Point2D

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns a String that represents the value of this Point2D.

Returns:String

a string representation of this Point2D.

Annotations
@Override