Package com.sun.javafx.geom
Class Vec2d
java.lang.Object
com.sun.javafx.geom.Vec2d
A 2-dimensional, double-precision, floating-point vector.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondouble
distance
(double vx, double vy) Returns the distance from thisVec2d
to a specified point.static double
distance
(double x1, double y1, double x2, double y2) Returns the distance between two points.double
Returns the distance from thisVec2d
to a specifiedVec2d
.double
distanceSq
(double vx, double vy) Returns the square of the distance from thisVec2d
to a specified point.static double
distanceSq
(double x1, double y1, double x2, double y2) Returns the square of the distance between two points.double
distanceSq
(Vec2d v) Returns the square of the distance from thisVec2d
to a specifiedVec2d
.boolean
Determines whether or not two 2D points or vectors are equal.int
hashCode()
Returns the hashcode for thisVec2d
.void
set
(double x, double y) void
toString()
Returns aString
that represents the value of thisVec2d
.
-
Field Details
-
x
public double xThe x coordinate. -
y
public double yThe y coordinate.
-
-
Constructor Details
-
Vec2d
public Vec2d() -
Vec2d
public Vec2d(double x, double y) -
Vec2d
-
-
Method Details
-
set
-
set
public void set(double x, double y) -
distanceSq
public static double distanceSq(double x1, double y1, double x2, double y2) Returns the square of the distance between two points.- Parameters:
x1
- the X coordinate of the first specified pointy1
- the Y coordinate of the first specified pointx2
- the X coordinate of the second specified pointy2
- the Y coordinate of the second specified point- Returns:
- the square of the distance between the two sets of specified coordinates.
-
distance
public static double distance(double x1, double y1, double x2, double y2) Returns the distance between two points.- Parameters:
x1
- the X coordinate of the first specified pointy1
- the Y coordinate of the first specified pointx2
- the X coordinate of the second specified pointy2
- the Y coordinate of the second specified point- Returns:
- the distance between the two sets of specified coordinates.
-
distanceSq
public double distanceSq(double vx, double vy) Returns the square of the distance from thisVec2d
to a specified point.- Parameters:
vx
- the X coordinate of the specified point to be measured against thisVec2d
vy
- the Y coordinate of the specified point to be measured against thisVec2d
- Returns:
- the square of the distance between this
Vec2d
and the specified point.
-
distanceSq
Returns the square of the distance from thisVec2d
to a specifiedVec2d
.- Parameters:
v
- the specified point to be measured against thisVec2d
- Returns:
- the square of the distance between this
Vec2d
to a specifiedVec2d
.
-
distance
public double distance(double vx, double vy) Returns the distance from thisVec2d
to a specified point.- Parameters:
vx
- the X coordinate of the specified point to be measured against thisVec2d
vy
- the Y coordinate of the specified point to be measured against thisVec2d
- Returns:
- the distance between this
Vec2d
and a specified point.
-
distance
Returns the distance from thisVec2d
to a specifiedVec2d
.- Parameters:
v
- the specified point to be measured against thisVec2d
- Returns:
- the distance between this
Vec2d
and the specifiedVec2d
.
-
hashCode
public int hashCode()Returns the hashcode for thisVec2d
. -
equals
Determines whether or not two 2D points or vectors are equal. Two instances ofVec2d
are equal if the values of theirx
andy
member fields, representing their position in the coordinate space, are the same. -
toString
Returns aString
that represents the value of thisVec2d
.
-