public class Vec2d extends Object
Modifier and Type | Field and Description |
---|---|
double |
x
The x coordinate.
|
double |
y
The y coordinate.
|
Constructor and Description |
---|
Vec2d() |
Vec2d(double x,
double y) |
Vec2d(Vec2d v) |
Vec2d(Vec2f v) |
Modifier and Type | Method and Description |
---|---|
double |
distance(double vx,
double vy)
Returns the distance from this
Vec2d to
a specified point. |
static double |
distance(double x1,
double y1,
double x2,
double y2)
Returns the distance between two points.
|
double |
distance(Vec2d v)
Returns the distance from this
Vec2d to a
specified Vec2d . |
double |
distanceSq(double vx,
double vy)
Returns the square of the distance from this
Vec2d 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 this
Vec2d to a specified Vec2d . |
boolean |
equals(Object obj)
Determines whether or not two 2D points or vectors are equal.
|
int |
hashCode()
Returns the hashcode for this
Vec2d . |
void |
set(double x,
double y) |
void |
set(Vec2d v) |
void |
set(Vec2f v) |
String |
toString()
Returns a
String that represents the value
of this Vec2d . |
public Vec2d()
public Vec2d(double x, double y)
public Vec2d(Vec2d v)
public Vec2d(Vec2f v)
public void set(Vec2d v)
public void set(Vec2f v)
public void set(double x, double y)
public static double distanceSq(double x1, double y1, double x2, double 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 double distance(double x1, double y1, double x2, double 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 double distanceSq(double vx, double vy)
Vec2d
to a specified point.vx
- the X coordinate of the specified point to be measured
against this Vec2d
vy
- the Y coordinate of the specified point to be measured
against this Vec2d
Vec2d
and the specified point.public double distanceSq(Vec2d v)
Vec2d
to a specified Vec2d
.v
- the specified point to be measured
against this Vec2d
Vec2d
to a specified Vec2d
.public double distance(double vx, double vy)
Vec2d
to
a specified point.vx
- the X coordinate of the specified point to be measured
against this Vec2d
vy
- the Y coordinate of the specified point to be measured
against this Vec2d
Vec2d
and a specified point.public double distance(Vec2d v)
Vec2d
to a
specified Vec2d
.v
- the specified point to be measured
against this Vec2d
Vec2d
and
the specified Vec2d
.public int hashCode()
Vec2d
.public boolean equals(Object obj)
Vec2d
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.