public class Vec2f extends 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(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. |
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 Vec2f
public void set(float x, float y)
Vec2f
to the
specified float
coordinates.x
- the new X coordinate of this Vec2f
y
- the new Y coordinate of this Vec2f
public 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 Vec2f
vy
- the Y coordinate of the specified point to be measured
against this Vec2f
Vec2f
and the specified point.public float distanceSq(Vec2f v)
Vec2f
to a specified Vec2f
.v
- the specified point to be measured
against this Vec2f
Vec2f
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 Vec2f
vy
- the Y coordinate of the specified point to be measured
against this Vec2f
Vec2f
and a specified point.public float distance(Vec2f v)
Vec2f
to a
specified Vec2f
.v
- the specified point to be measured
against this Vec2f
Vec2f
and
the specified Vec2f
.public int hashCode()
Vec2f
.public boolean equals(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.Copyright © 2020. All rights reserved.