Vector2D.Sum, Vector2D.Unit
Modifier and Type | Field and Description |
---|---|
static Vector2D.Unit |
MINUS_X
Negation of unit vector (coordinates: -1, 0).
|
static Vector2D.Unit |
MINUS_Y
Negation of unit vector (coordinates: 0, -1).
|
static Vector2D.Unit |
PLUS_X
Unit vector (coordinates: 1, 0).
|
static Vector2D.Unit |
PLUS_Y
Unit vector (coordinates: 0, 1).
|
COORDINATE_ASCENDING_ORDER, NaN, NEGATIVE_INFINITY, POSITIVE_INFINITY, ZERO
Modifier and Type | Method and Description |
---|---|
static Vector2D.Unit |
from(double x,
double y)
Create a normalized vector.
|
static Vector2D.Unit |
from(Vector2D v)
Create a normalized vector.
|
Vector2D.Unit |
negate() |
double |
norm() |
Vector2D.Unit |
normalize() |
Vector2D.Unit |
normalizeOrNull() |
double |
normSq() |
Vector2D.Unit |
orthogonal()
Get a unit vector orthogonal to the instance.
|
Vector2D |
withNorm(double mag) |
add, add, angle, centroid, centroid, directionTo, distance, distanceSq, dot, eq, equals, getDimension, getX, getY, getZero, hashCode, isFinite, isInfinite, isNaN, lerp, max, max, min, min, multiply, of, of, orthogonal, parse, project, reject, signedArea, subtract, subtract, toArray, toString, transform, vectorTo
getCheckedNorm, isZero
public static final Vector2D.Unit PLUS_X
public static final Vector2D.Unit MINUS_X
public static final Vector2D.Unit PLUS_Y
public static final Vector2D.Unit MINUS_Y
public double norm()
public double normSq()
public Vector2D.Unit normalize()
public Vector2D.Unit normalizeOrNull()
normalizeOrNull
in interface Vector<Vector2D>
normalizeOrNull
in class Vector2D
public Vector2D.Unit orthogonal()
pi/2
radians
counterclockwise around the origin and normalizing. For example, if this method is
called on a vector pointing along the positive x-axis, then a unit vector representing
the positive y-axis is returned.orthogonal
in class Vector2D
public Vector2D.Unit negate()
public static Vector2D.Unit from(double x, double y)
x
- Vector coordinate.y
- Vector coordinate.IllegalArgumentException
- if the norm of the given value is zero, NaN,
or infinitepublic static Vector2D.Unit from(Vector2D v)
v
- Vector.IllegalArgumentException
- if the norm of the given value is zero, NaN,
or infiniteCopyright © 2016–2021 The Apache Software Foundation. All rights reserved.