public class Vec2f
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
float |
x
The x coordinate.
|
float |
y
The y coordinate.
|
| Constructor and Description |
|---|
Vec2f() |
Vec2f(float x,
float y) |
Vec2f(Vec2f v) |
| Modifier and Type | Method and Description |
|---|---|
float |
distance(float vx,
float vy)
Returns the distance from this
Vec2f to
a specified point. |
static float |
distance(float x1,
float y1,
float x2,
float y2)
Returns the distance between two points.
|
float |
distance(Vec2f v)
Returns the distance from this
Vec2f to a
specified Vec2f. |
float |
distanceSq(float vx,
float vy)
Returns the square of the distance from this
Vec2f to a specified point. |
static float |
distanceSq(float x1,
float y1,
float x2,
float y2)
Returns the square of the distance between two points.
|
float |
distanceSq(Vec2f v)
Returns the square of the distance from this
Vec2f to a specified Vec2f. |
boolean |
equals(java.lang.Object obj)
Determines whether or not two 2D points or vectors are equal.
|
int |
hashCode()
Returns the hashcode for this
Vec2f. |
void |
set(float x,
float y)
Sets the location of this
Vec2f to the
specified float coordinates. |
void |
set(Vec2f v)
Sets the location of this
Vec2f to the same
coordinates as the specified Vec2f object. |
java.lang.String |
toString()
Returns a
String that represents the value
of this Vec2f. |
public Vec2f()
public Vec2f(float x,
float y)
public Vec2f(Vec2f v)
public void set(Vec2f v)
Vec2f to the same
coordinates as the specified Vec2f object.v - the specified Vec2f to which to set
this Vec2fpublic void set(float x,
float y)
Vec2f to the
specified float coordinates.x - the new X coordinate of this Vec2fy - the new Y coordinate of this Vec2fpublic static float distanceSq(float x1,
float y1,
float x2,
float y2)
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 pointpublic static float distance(float x1,
float y1,
float x2,
float y2)
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 pointpublic float distanceSq(float vx,
float vy)
Vec2f to a specified point.vx - the X coordinate of the specified point to be measured
against this Vec2fvy - the Y coordinate of the specified point to be measured
against this Vec2fVec2f and the specified point.public float distanceSq(Vec2f v)
Vec2f to a specified Vec2f.v - the specified point to be measured
against this Vec2fVec2f to a specified Vec2f.public float distance(float vx,
float vy)
Vec2f to
a specified point.vx - the X coordinate of the specified point to be measured
against this Vec2fvy - the Y coordinate of the specified point to be measured
against this Vec2fVec2f
and a specified point.public float distance(Vec2f v)
Vec2f to a
specified Vec2f.v - the specified point to be measured
against this Vec2fVec2f and
the specified Vec2f.public int hashCode()
Vec2f.hashCode in class java.lang.ObjectVec2f.public boolean equals(java.lang.Object obj)
Vec2f are equal if the values of their
x and y member fields, representing
their position in the coordinate space, are the same.equals in class java.lang.Objectobj - an object to be compared with this Vec2ftrue if the object to be compared is
an instance of Vec2f and has
the same values; false otherwise.public java.lang.String toString()
String that represents the value
of this Vec2f.toString in class java.lang.ObjectVec2f.