|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ReadonlyVec2D
Readonly, immutable interface wrapper for Vec2D instances. Used throughout the library for safety purposes.
Method Summary | |
---|---|
Vec2D |
add(float a,
float b)
Adds vector {a,b,c} and returns result as new vector. |
Vec2D |
add(ReadonlyVec2D v)
Add vector v and returns result as new vector. |
float |
angleBetween(ReadonlyVec2D v)
Computes the angle between this vector and vector V. |
float |
angleBetween(ReadonlyVec2D v,
boolean forceNormalize)
Computes the angle between this vector and vector V |
Vec3D |
bisect(Vec2D p)
Computes the perpendicular bisector of two points. |
int |
compareTo(ReadonlyVec2D v)
Compares the length of the vector with another one. |
Vec2D |
copy()
|
float |
cross(ReadonlyVec2D v)
Calculates the cross-product with the given vector. |
float |
distanceTo(ReadonlyVec2D v)
Calculates distance to another vector |
float |
distanceToSquared(ReadonlyVec2D v)
Calculates the squared distance to another vector |
float |
dot(ReadonlyVec2D v)
Computes the scalar product (dot product) with the given vector. |
boolean |
equals(java.lang.Object obj)
|
boolean |
equalsWithTolerance(ReadonlyVec2D v,
float tolerance)
Compares this vector with the one given. |
Vec2D |
getAbs()
|
float |
getComponent(int id)
|
float |
getComponent(Vec2D.Axis id)
|
Vec2D |
getConstrained(Rect r)
Creates a copy of the vector which forcefully fits in the given rectangle. |
Vec2D |
getFloored()
Creates a new vector whose components are the integer value of their current values |
Vec2D |
getFrac()
Creates a new vector whose components are the fractional part of their current values |
Vec2D |
getInverted()
Scales vector uniformly by factor -1 ( v = -v ) |
Vec2D |
getLimited(float lim)
Creates a copy of the vector with its magnitude limited to the length given |
Vec2D |
getNormalized()
Produces the normalized version as a new vector |
Vec2D |
getNormalizedTo(float len)
Produces a new vector normalized to the given length. |
Vec2D |
getPerpendicular()
|
Vec2D |
getReciprocal()
|
Vec2D |
getReflected(ReadonlyVec2D normal)
|
Vec2D |
getRotated(float theta)
Creates a new vector rotated by the given angle around the Z axis. |
Vec2D |
getSignum()
Creates a new vector in which all components are replaced with the signum of their original values. |
float |
heading()
Computes the vector's direction in the XY plane (for example for 2D points). |
Vec2D |
interpolateTo(ReadonlyVec2D v,
float f)
Interpolates the vector towards the given target vector, using linear interpolation |
Vec2D |
interpolateTo(ReadonlyVec2D v,
float f,
InterpolateStrategy s)
Interpolates the vector towards the given target vector, using the given InterpolateStrategy |
boolean |
isInCircle(ReadonlyVec2D sO,
float sR)
Checks if the point is inside the given sphere. |
boolean |
isInRectangle(Rect r)
Checks if the point is inside the given rectangle. |
boolean |
isInTriangle(Vec2D a,
Vec2D b,
Vec2D c)
Checks if point vector is inside the triangle created by the points a, b and c. |
boolean |
isMajorAxis(float tolerance)
Checks if the vector is parallel with either the X or Y axis (any direction). |
boolean |
isZeroVector()
Checks if vector has a magnitude equals or close to zero (tolerance used is MathUtils.EPS ). |
float |
magnitude()
Calculates the magnitude/eucledian length of the vector |
float |
magSquared()
Calculates only the squared magnitude/length of the vector. |
Vec2D |
max(Vec2D v)
Constructs a new vector consisting of the largest components of both vectors. |
Vec2D |
min(Vec2D v)
Constructs a new vector consisting of the smallest components of both vectors. |
Vec2D |
scale(float s)
Scales vector uniformly and returns result as new vector. |
Vec2D |
scale(float a,
float b)
Scales vector non-uniformly and returns result as new vector. |
Vec2D |
scale(ReadonlyVec2D s)
|
Vec2D |
scale(Vec2D s)
Scales vector non-uniformly by vector v and returns result as new vector |
Vec2D |
sub(float a,
float b)
Subtracts vector {a,b,c} and returns result as new vector. |
Vec2D |
sub(ReadonlyVec2D v)
|
Vec2D |
sub(Vec2D v)
Subtracts vector v and returns result as new vector. |
Vec2D |
tangentNormalOfEllipse(Vec2D eO,
Vec2D eR)
Calculates the normal vector on the given ellipse in the direction of the current point. |
Vec3D |
to3DXY()
Creates a 3D version of this vector in the XY plane. |
Vec3D |
to3DXZ()
Creates a 3D version of this vector in the XZ plane. |
Vec3D |
to3DYZ()
Creates a 3D version of this vector in the YZ plane. |
float[] |
toArray()
|
Vec2D |
toCartesian()
Converts the vector from polar to Cartesian space. |
Vec2D |
toPolar()
Converts the current vector into polar coordinates. |
float |
x()
|
float |
y()
|
Method Detail |
---|
Vec2D add(float a, float b)
a
- X coordinateb
- Y coordinate
Vec2D add(ReadonlyVec2D v)
v
- vector to add
float angleBetween(ReadonlyVec2D v)
angleBetween(ReadonlyVec2D, boolean)
v
- vector
float angleBetween(ReadonlyVec2D v, boolean forceNormalize)
v
- vectorforceNormalize
- true, if normalized versions of the vectors are to be used
(Note: only copies will be used, original vectors will not be
altered by this method)
Vec3D bisect(Vec2D p)
p
- other point
Vec3D
int compareTo(ReadonlyVec2D v)
v
- vector to compare with
Vec2D copy()
float cross(ReadonlyVec2D v)
v
- vector
float distanceTo(ReadonlyVec2D v)
v
- non-null vector
float distanceToSquared(ReadonlyVec2D v)
v
- non-null vector
magSquared()
float dot(ReadonlyVec2D v)
v
-
boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
boolean equalsWithTolerance(ReadonlyVec2D v, float tolerance)
v
- the vtolerance
- the tolerance
Vec2D getAbs()
float getComponent(Vec2D.Axis id)
float getComponent(int id)
Vec2D getConstrained(Rect r)
r
-
Vec2D getFloored()
Vec2D getFrac()
Vec2D getInverted()
Vec2D getLimited(float lim)
lim
- new maximum magnitude
Vec2D getNormalized()
Vec2D getNormalizedTo(float len)
len
- new desired length
Vec2D getPerpendicular()
Vec2D getReciprocal()
Vec2D getReflected(ReadonlyVec2D normal)
Vec2D getRotated(float theta)
theta
-
Vec2D getSignum()
float heading()
Vec2D interpolateTo(ReadonlyVec2D v, float f)
v
- target vectorf
- interpolation factor (should be in the range 0..1)
Vec2D interpolateTo(ReadonlyVec2D v, float f, InterpolateStrategy s)
InterpolateStrategy
v
- target vectorf
- interpolation factor (should be in the range 0..1)s
- InterpolateStrategy instance
boolean isInCircle(ReadonlyVec2D sO, float sR)
sO
- circle origin/centresR
- circle radius
boolean isInRectangle(Rect r)
r
- bounding rectangle
boolean isInTriangle(Vec2D a, Vec2D b, Vec2D c)
boolean isMajorAxis(float tolerance)
tolerance
-
boolean isZeroVector()
MathUtils.EPS
).
float magnitude()
float magSquared()
Vec2D max(Vec2D v)
v
-
Vec2D min(Vec2D v)
v
- comparing vector
Vec2D scale(float s)
s
- scale factor
Vec2D scale(float a, float b)
a
- scale factor for X coordinateb
- scale factor for Y coordinate
Vec2D scale(ReadonlyVec2D s)
Vec2D scale(Vec2D s)
s
- scale vector
Vec2D sub(float a, float b)
a
- X coordinateb
- Y coordinate
Vec2D sub(ReadonlyVec2D v)
Vec2D sub(Vec2D v)
v
- vector to be subtracted
Vec2D tangentNormalOfEllipse(Vec2D eO, Vec2D eR)
eO
- ellipse origin/centreeR
- ellipse radii
Vec3D to3DXY()
Vec3D to3DXZ()
Vec3D to3DYZ()
float[] toArray()
Vec2D toCartesian()
Vec2D toPolar()
float x()
float y()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |