|
JOGL v2.6.0-rc-20250712
JOGL, High-Performance Graphics Binding for Java (public API).
|
2D Vector based upon two float components. More...
Public Member Functions | |
| Vec2f () | |
| Vec2f (final Vec2f o) | |
| Vec2f (final Vec2i o) | |
| Vec2f (final Vec3f o) | |
| Creating new Vec2f using Vec3f, dropping z. More... | |
| Vec2f | copy () |
| Vec2f (final float[] xy) | |
| Vec2f (final float x, final float y) | |
| void | set (final Vec2f o) |
| this = o, returns this. More... | |
| void | set (final Vec2i o) |
| this = o (int -> float), returns this. More... | |
| void | set (final Vec3f o) |
| this = o while dropping z, returns this. More... | |
| void | set (final float x, final float y) |
| this = { x, y }, returns this. More... | |
| Vec2f | set (final float[] xy) |
| this = xy, returns this. More... | |
| Vec2f | toArray (final float[] xy) |
| xy[0..1] = this. More... | |
| void | set (final int i, final float val) |
| Sets the ith component, 0 <= i < 2. More... | |
| float[] | get (final float[] xy) |
| xy = this, returns xy. More... | |
| float | get (final int i) |
| Gets the ith component, 0 <= i < 2. More... | |
| float | x () |
| float | y () |
| void | setX (final float x) |
| void | setY (final float y) |
| Vec2f | max (final Vec2f m) |
| this = max(this, m), returns this. More... | |
| Vec2f | min (final Vec2f m) |
| this = min(this, m), returns this. More... | |
| Vec2f | mul (final float val) |
| Returns this * val; creates new vector. More... | |
| Vec2f | mul (final Vec2f a, final Vec2f b) |
| this = a * b, returns this. More... | |
| Vec2f | mul (final Vec2f s) |
| this = this * s, returns this. More... | |
| Vec2f | mul (final float sx, final float sy) |
| this = this * { sx, sy }, returns this. More... | |
| Vec2f | div (final Vec2f a, final Vec2f b) |
| this = a / b, returns this. More... | |
| Vec2f | div (final Vec2f a) |
| this = this / a, returns this. More... | |
| Vec2f | scale (final float s) |
| this = this * s, returns this. More... | |
| Vec2f | plus (final Vec2f arg) |
| Returns this + arg; creates new vector. More... | |
| Vec2f | plus (final Vec2f a, final Vec2f b) |
| this = a + b, returns this. More... | |
| Vec2f | add (final float dx, final float dy) |
| this = this + { dx, dy }, returns this. More... | |
| Vec2f | add (final Vec2f b) |
| this = this + b, returns this. More... | |
| Vec2f | minus (final Vec2f arg) |
| Returns this - arg; creates new vector. More... | |
| Vec2f | minus (final Vec2f a, final Vec2f b) |
| this = a - b, returns this. More... | |
| Vec2f | sub (final Vec2f b) |
| this = this - b, returns this. More... | |
| boolean | isZero () |
| Return true if all components are zero, i.e. More... | |
| void | rotate (final float radians, final Vec2f ctr) |
| void | rotate (final float sin, final float cos, final Vec2f ctr) |
| float | length () |
| Return the length of this vector, a.k.a the norm or magnitude More... | |
| float | lengthSq () |
| Return the squared length of this vector, a.k.a the squared norm or squared magnitude More... | |
| float | angle () |
| Return the direction angle of this vector in radians. More... | |
| Vec2f | normalize () |
| Normalize this vector in place. More... | |
| float | distSq (final Vec2f o) |
| Return the squared distance between this vector and the given one. More... | |
| float | dist (final Vec2f o) |
| Return the distance between this vector and the given one. More... | |
| float | dot (final Vec2f arg) |
| Return the dot product of this vector and the given one. More... | |
| float | cross (final Vec2f o) |
| Returns cross product of this vectors and the given one, i.e. More... | |
| float | cosAngle (final Vec2f o) |
| Return the cosines of the angle between two vectors. More... | |
| float | angle (final Vec2f o) |
| Return the angle between two vectors in radians. More... | |
| Vec2f | normal_ccw () |
| Return the counter-clock-wise (CCW) normal of this vector, i.e. More... | |
| boolean | isEqual (final Vec2f o, final float epsilon) |
Equals check using a given FloatUtil#EPSILON value and FloatUtil#isEqual(float, float, float). More... | |
| boolean | isEqual (final Vec2f o) |
Equals check using FloatUtil#EPSILON in FloatUtil#isEqual(float, float). More... | |
| boolean | equals (final Object o) |
| String | toString () |
Static Public Member Functions | |
| static Vec2f | from_length_angle (final float magnitude, final float radians) |
2D Vector based upon two float components.
Implementation borrowed from gfxbox2 and its data layout from JOAL's Vec3f.
Definition at line 37 of file Vec2f.java.
| com.jogamp.math.Vec2f.Vec2f | ( | ) |
| com.jogamp.math.Vec2f.Vec2f | ( | final Vec2f | o | ) |
Definition at line 47 of file Vec2f.java.
| com.jogamp.math.Vec2f.Vec2f | ( | final Vec2i | o | ) |
Definition at line 51 of file Vec2f.java.
| com.jogamp.math.Vec2f.Vec2f | ( | final Vec3f | o | ) |
Creating new Vec2f using Vec3f, dropping z.
Definition at line 56 of file Vec2f.java.
| com.jogamp.math.Vec2f.Vec2f | ( | final float[] | xy | ) |
Definition at line 64 of file Vec2f.java.
| com.jogamp.math.Vec2f.Vec2f | ( | final float | x, |
| final float | y | ||
| ) |
Definition at line 68 of file Vec2f.java.
| Vec2f com.jogamp.math.Vec2f.add | ( | final float | dx, |
| final float | dy | ||
| ) |
this = this + { dx, dy }, returns this.
Definition at line 210 of file Vec2f.java.
this = this + b, returns this.
Definition at line 217 of file Vec2f.java.
| float com.jogamp.math.Vec2f.angle | ( | ) |
Return the direction angle of this vector in radians.
Definition at line 278 of file Vec2f.java.
| float com.jogamp.math.Vec2f.angle | ( | final Vec2f | o | ) |
Return the angle between two vectors in radians.
Definition at line 349 of file Vec2f.java.
| Vec2f com.jogamp.math.Vec2f.copy | ( | ) |
| float com.jogamp.math.Vec2f.cosAngle | ( | final Vec2f | o | ) |
Return the cosines of the angle between two vectors.
Definition at line 342 of file Vec2f.java.
| float com.jogamp.math.Vec2f.cross | ( | final Vec2f | o | ) |
Returns cross product of this vectors and the given one, i.e.
*this x o.
The 2D cross product is identical with the 2D perp dot product.
Definition at line 335 of file Vec2f.java.
| float com.jogamp.math.Vec2f.dist | ( | final Vec2f | o | ) |
Return the distance between this vector and the given one.
Definition at line 315 of file Vec2f.java.
| float com.jogamp.math.Vec2f.distSq | ( | final Vec2f | o | ) |
Return the squared distance between this vector and the given one.
When comparing the relative distance between two points it is usually sufficient to compare the squared distances, thus avoiding an expensive square root operation.
Definition at line 306 of file Vec2f.java.
this = this / a, returns this.
Definition at line 184 of file Vec2f.java.
this = a / b, returns this.
Definition at line 177 of file Vec2f.java.
| float com.jogamp.math.Vec2f.dot | ( | final Vec2f | arg | ) |
Return the dot product of this vector and the given one.
Definition at line 324 of file Vec2f.java.
| boolean com.jogamp.math.Vec2f.equals | ( | final Object | o | ) |
|
static |
| float[] com.jogamp.math.Vec2f.get | ( | final float[] | xy | ) |
xy = this, returns xy.
Definition at line 120 of file Vec2f.java.
| float com.jogamp.math.Vec2f.get | ( | final int | i | ) |
Gets the ith component, 0 <= i < 2.
Definition at line 127 of file Vec2f.java.
| boolean com.jogamp.math.Vec2f.isEqual | ( | final Vec2f | o | ) |
Equals check using FloatUtil#EPSILON in FloatUtil#isEqual(float, float).
Implementation considers following corner cases:
| o | comparison value |
FloatUtil#EPSILON, otherwise false. Definition at line 394 of file Vec2f.java.
| boolean com.jogamp.math.Vec2f.isEqual | ( | final Vec2f | o, |
| final float | epsilon | ||
| ) |
Equals check using a given FloatUtil#EPSILON value and FloatUtil#isEqual(float, float, float).
Implementation considers following corner cases:
| o | comparison value |
| epsilon | consider using FloatUtil#EPSILON |
epsilon, otherwise false. Definition at line 373 of file Vec2f.java.
| boolean com.jogamp.math.Vec2f.isZero | ( | ) |
Return true if all components are zero, i.e.
it's absolute value < EPSILON.
Definition at line 243 of file Vec2f.java.
| float com.jogamp.math.Vec2f.length | ( | ) |
Return the length of this vector, a.k.a the norm or magnitude
Definition at line 264 of file Vec2f.java.
| float com.jogamp.math.Vec2f.lengthSq | ( | ) |
Return the squared length of this vector, a.k.a the squared norm or squared magnitude
Definition at line 271 of file Vec2f.java.
this = max(this, m), returns this.
Definition at line 142 of file Vec2f.java.
this = min(this, m), returns this.
Definition at line 148 of file Vec2f.java.
this = a - b, returns this.
Definition at line 229 of file Vec2f.java.
Returns this - arg; creates new vector.
Definition at line 224 of file Vec2f.java.
| Vec2f com.jogamp.math.Vec2f.mul | ( | final float | sx, |
| final float | sy | ||
| ) |
this = this * { sx, sy }, returns this.
Definition at line 170 of file Vec2f.java.
| Vec2f com.jogamp.math.Vec2f.mul | ( | final float | val | ) |
Returns this * val; creates new vector.
Definition at line 155 of file Vec2f.java.
this = a * b, returns this.
Definition at line 160 of file Vec2f.java.
this = this * s, returns this.
Definition at line 167 of file Vec2f.java.
| Vec2f com.jogamp.math.Vec2f.normal_ccw | ( | ) |
Return the counter-clock-wise (CCW) normal of this vector, i.e.
perp(endicular) vector
Definition at line 356 of file Vec2f.java.
| Vec2f com.jogamp.math.Vec2f.normalize | ( | ) |
Normalize this vector in place.
Definition at line 286 of file Vec2f.java.
this = a + b, returns this.
Definition at line 203 of file Vec2f.java.
Returns this + arg; creates new vector.
Definition at line 198 of file Vec2f.java.
| void com.jogamp.math.Vec2f.rotate | ( | final float | radians, |
| final Vec2f | ctr | ||
| ) |
Definition at line 247 of file Vec2f.java.
| void com.jogamp.math.Vec2f.rotate | ( | final float | sin, |
| final float | cos, | ||
| final Vec2f | ctr | ||
| ) |
Definition at line 253 of file Vec2f.java.
| Vec2f com.jogamp.math.Vec2f.scale | ( | final float | s | ) |
this = this * s, returns this.
Definition at line 191 of file Vec2f.java.
| void com.jogamp.math.Vec2f.set | ( | final float | x, |
| final float | y | ||
| ) |
this = { x, y }, returns this.
Definition at line 91 of file Vec2f.java.
| Vec2f com.jogamp.math.Vec2f.set | ( | final float[] | xy | ) |
this = xy, returns this.
Definition at line 97 of file Vec2f.java.
| void com.jogamp.math.Vec2f.set | ( | final int | i, |
| final float | val | ||
| ) |
Sets the ith component, 0 <= i < 2.
Definition at line 111 of file Vec2f.java.
| void com.jogamp.math.Vec2f.set | ( | final Vec2f | o | ) |
this = o, returns this.
Definition at line 73 of file Vec2f.java.
| void com.jogamp.math.Vec2f.set | ( | final Vec2i | o | ) |
this = o (int -> float), returns this.
Definition at line 79 of file Vec2f.java.
| void com.jogamp.math.Vec2f.set | ( | final Vec3f | o | ) |
this = o while dropping z, returns this.
Definition at line 85 of file Vec2f.java.
| void com.jogamp.math.Vec2f.setX | ( | final float | x | ) |
| void com.jogamp.math.Vec2f.setY | ( | final float | y | ) |
this = this - b, returns this.
Definition at line 236 of file Vec2f.java.
| Vec2f com.jogamp.math.Vec2f.toArray | ( | final float[] | xy | ) |
| String com.jogamp.math.Vec2f.toString | ( | ) |
Definition at line 413 of file Vec2f.java.
| float com.jogamp.math.Vec2f.x | ( | ) |
Definition at line 135 of file Vec2f.java.
| float com.jogamp.math.Vec2f.y | ( | ) |
Definition at line 136 of file Vec2f.java.