public interface Vector2d
Modifier and Type | Field and Description |
---|---|
static Vector2d |
NEG_UNIT_X
The vector (-1, 0).
|
static Vector2d |
NEG_UNIT_Y
The vector (0, -1).
|
static Vector2d |
UNIT_X
The vector (1, 0).
|
static Vector2d |
UNIT_Y
The vector (0, 1).
|
static Vector2d |
ZERO
The vector (0, 0).
|
Modifier and Type | Method and Description |
---|---|
MVector2d |
add(Vector2d vector)
Returns the sum of this vector and the given vector.
|
double |
angle(Vector2d vector)
Returns the minimum angle between this vector and the given vector.
|
static Vector2d |
create(double x,
double y)
Returns a 2-dimensional vector with the given component values.
|
static Vector2d |
create(Vector2d vec)
Returns a 2-dimensional vector with the X and Y values set to those of
the given vector.
|
double |
distance(Vector2d other)
Returns the distance between this vector and the other vector in the
XY-plane.
|
double |
distanceSquared(Vector2d other)
Returns the square of the distance between this vector and the other
vector in the XY-plane.
|
double |
dotProduct(Vector2d vector)
Returns the dot product between this vector and the given vector.
|
boolean |
equalsWithTolerance(Vector2d other,
double tolerance)
Returns true if this vector is within distance of tolerance to other.
|
double |
getClockwiseAngle()
This method retrieves the clockwise angle from the positive x-axis to the
vector in radians.
|
double |
getLength()
Returns the length of this vector.
|
double |
getLengthSquared()
Returns the squared length of this vector.
|
double |
getX()
Returns the X component of this vector.
|
double |
getY()
Returns the Y component of this vector.
|
MVector2d |
interpolate(Vector2d vector,
double alpha)
Returns a vector that is the interpolation between this vector and the
given vector so that the weight of the given vector is alpha (result is (1 -
alpha) * this + alpha * vector).
|
MVector2d |
negate()
Returns a negated copy of this vector.
|
MVector2d |
normalize()
Returns a normalized copy of this vector.
|
MVector2d |
scale(double scalar)
Returns a copy of this vector scaled by the given scalar.
|
MVector2d |
subtract(Vector2d vector)
Returns the difference of this vector and the given vector.
|
static List<Vector2d> |
to2dVectors(List<? extends Vector3d> vectors)
Returns the vectors in the given list projected to the XY-plane.
|
MVector3d |
to3dVector()
Returns a new 3-dimensional vector with the X and Y components of this
vector and the Z-component set to 0.
|
static final Vector2d ZERO
static final Vector2d UNIT_X
static final Vector2d NEG_UNIT_X
static final Vector2d UNIT_Y
static final Vector2d NEG_UNIT_Y
static Vector2d create(double x, double y)
x
- the value of the X componenty
- the value of the Y componentstatic Vector2d create(Vector2d vec)
vec
- the vector used for setting the values of the created vectorstatic List<Vector2d> to2dVectors(List<? extends Vector3d> vectors)
vectors
- vectors that are projected to the XY-planeMVector2d subtract(Vector2d vector)
vector
- the vector on the right side of the differenceMVector2d add(Vector2d vector)
vector
- the vector that is added to this to get the returned vectordouble angle(Vector2d vector)
vector
- the vector between which the angle is computeddouble dotProduct(Vector2d vector)
vector
- the vector with which the dot product is computedboolean equalsWithTolerance(Vector2d other, double tolerance)
other
- the point that is compared for near equality in the XY-planetolerance
- the allowed distance between this vector and otherdouble distance(Vector2d other)
other
- the vector to which the distance is computed in the
XY-plane.double distanceSquared(Vector2d other)
other
- the vector to which the squared distance is computed in the
XY-plane.double getLength()
double getLengthSquared()
MVector2d interpolate(Vector2d vector, double alpha)
vector
- the vector with which this is interpolatedalpha
- the interpolation factorMVector2d negate()
MVector2d normalize()
double getX()
double getY()
MVector2d scale(double scalar)
scalar
- the scalar by which the returned vector is scaledMVector3d to3dVector()
double getClockwiseAngle()
Copyright © 2019 Solibri, Inc.. All rights reserved.