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

public Class Vec2f

extends Object
Class Inheritance

A 2-dimensional, single-precision, floating-point vector.

Field Summary

Modifier and TypeField and Description
public float
x

The x coordinate.

public float
y

The y coordinate.

Constructor Summary

AccessConstructor and Description
public
public
Vec2f(float x, float y)

public

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 Vec2f and a specified point.
distance
(float
the X coordinate of the specified point to be measured against this Vec2f
vx
,
float
the Y coordinate of the specified point to be measured against this Vec2f
vy
)

Returns the distance from this Vec2f to a specified point.

public float

Returns:

the distance between this Vec2f and the specified Vec2f.
distance
(Vec2f
the specified point to be measured against this Vec2f
v
)

Returns the distance from this Vec2f to a specified Vec2f.

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 Vec2f and the specified point.
distanceSq
(float
the X coordinate of the specified point to be measured against this Vec2f
vx
,
float
the Y coordinate of the specified point to be measured against this Vec2f
vy
)

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

public float

Returns:

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

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

public boolean

Returns:

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

Overrides java.lang.Object.equals.

Determines whether or not two 2D points or vectors are equal.

public int

Returns:

a hash code for this Vec2f.
hashCode
()

Overrides java.lang.Object.hashCode.

Returns the hashcode for this Vec2f.

public void
set(Vec2f
the specified Vec2f to which to set this Vec2f
v
)

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

public void
set(float
the new X coordinate of this Vec2f
x
,
float
the new Y coordinate of this Vec2f
y
)

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

public String

Returns:

a string representation of this Vec2f.
toString
()

Overrides java.lang.Object.toString.

Returns a String that represents the value of this Vec2f.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

xback to summary
public float x

The x coordinate.

yback to summary
public float y

The y coordinate.

Constructor Detail

Vec2fback to summary
public Vec2f()
Vec2fback to summary
public Vec2f(float x, float y)
Vec2fback to summary
public Vec2f(Vec2f v)

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 vx, float vy)

Returns the distance from this Vec2f to a specified point.

Parameters
vx:float

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

vy:float

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

Returns:float

the distance between this Vec2f and a specified point.

distanceback to summary
public float distance(Vec2f v)

Returns the distance from this Vec2f to a specified Vec2f.

Parameters
v:Vec2f

the specified point to be measured against this Vec2f

Returns:float

the distance between this Vec2f and the specified Vec2f.

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 vx, float vy)

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

Parameters
vx:float

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

vy:float

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

Returns:float

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

distanceSqback to summary
public float distanceSq(Vec2f v)

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

Parameters
v:Vec2f

the specified point to be measured against this Vec2f

Returns:float

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

equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Determines whether or not two 2D points or vectors are equal. Two instances of Vec2f 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 Vec2f

Returns:boolean

true if the object to be compared is an instance of Vec2f 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 Vec2f.

Returns:int

a hash code for this Vec2f.

Annotations
@Override
setback to summary
public void set(Vec2f v)

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

Parameters
v:Vec2f

the specified Vec2f to which to set this Vec2f

setback to summary
public void set(float x, float y)

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

Parameters
x:float

the new X coordinate of this Vec2f

y:float

the new Y coordinate of this Vec2f

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns a String that represents the value of this Vec2f.

Returns:String

a string representation of this Vec2f.

Annotations
@Override