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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubledistance(double vx, double vy) Returns the distance from thisVec2dto a specified point.static doubledistance(double x1, double y1, double x2, double y2) Returns the distance between two points.doubleReturns the distance from thisVec2dto a specifiedVec2d.doubledistanceSq(double vx, double vy) Returns the square of the distance from thisVec2dto a specified point.static doubledistanceSq(double x1, double y1, double x2, double y2) Returns the square of the distance between two points.doubledistanceSq(Vec2d v) Returns the square of the distance from thisVec2dto a specifiedVec2d.booleanDetermines whether or not two 2D points or vectors are equal.inthashCode()Returns the hashcode for thisVec2d.voidset(double x, double y) voidtoString()Returns aStringthat 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 thisVec2dto a specified point.- Parameters:
vx- the X coordinate of the specified point to be measured against thisVec2dvy- the Y coordinate of the specified point to be measured against thisVec2d- Returns:
- the square of the distance between this
Vec2dand the specified point.
-
distanceSq
Returns the square of the distance from thisVec2dto a specifiedVec2d.- Parameters:
v- the specified point to be measured against thisVec2d- Returns:
- the square of the distance between this
Vec2dto a specifiedVec2d.
-
distance
public double distance(double vx, double vy) Returns the distance from thisVec2dto a specified point.- Parameters:
vx- the X coordinate of the specified point to be measured against thisVec2dvy- the Y coordinate of the specified point to be measured against thisVec2d- Returns:
- the distance between this
Vec2dand a specified point.
-
distance
Returns the distance from thisVec2dto a specifiedVec2d.- Parameters:
v- the specified point to be measured against thisVec2d- Returns:
- the distance between this
Vec2dand 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 ofVec2dare equal if the values of theirxandymember fields, representing their position in the coordinate space, are the same. -
toString
Returns aStringthat represents the value of thisVec2d.
-