Drag[en]gine Script Module DragonScript
1.23
|
Immutable 2-component vector. More...
Public Member Functions | |
Constructors | |
Vector2 | new () |
Create Vector2 with all components set to 0. More... | |
Vector2 | new (float x, float y) |
Create Vector2 using the specified components. More... | |
Vector2 | new (Vector2 v) |
Create copy of a Vector2. More... | |
Vector2 | new (Point p) |
Create Vector2 from Point. More... | |
Management | |
float | getX () |
X-Component. More... | |
float | getY () |
Y-Component. More... | |
float | getComponentAt (int component) |
Component by index (0=X, 1=Y). More... | |
float | getLength () |
Length. More... | |
Vector2 | normalize () |
Vector divided by length(). More... | |
Vector2 | absolute () |
Vector with absolute of all components. More... | |
Vector2 | smallest (Vector2 v) |
Vector with all components set to the smallest value of two vectors. More... | |
Vector2 | largest (Vector2 v) |
Vector with all components set to the largest value of two vectors. More... | |
Vector2 | clamped (Vector2 min, Vector2 max) |
Vector with all components clamped to a range of two vectors. More... | |
Point | round () |
Convert to point rounding to the nearest integer value. More... | |
Vector2 | round (float unit) |
Components rounded to the nearest unit. More... | |
Vector2 | mix (Vector2 other, float factor) |
Mix vector with another component wise. More... | |
bool | isEqualTo (Vector2 v, float delta) |
Two vectors are equal. More... | |
bool | isAtLeast (float value) |
All coordinates are at least of a minimal value. More... | |
bool | isAtMost (float value) |
All coordinates are at most of a maximal value. More... | |
bool | isZero () |
Vector is equal to zero vector. More... | |
bool | equals (Object other) |
Vector is equal to another object. More... | |
int | hashCode () |
Hash code for use as dictionary keys. More... | |
String | toString () |
String representation of vector. More... | |
String | toString (int precision) |
String representation of vector with precision. More... | |
Operators | |
Vector2 | operator- () |
Negated vector. More... | |
Vector2 | operator+ (Vector2 v) |
Sum of two vectors. More... | |
Vector2 | operator- (Vector2 v) |
Difference between two vectors. More... | |
Vector2 | operator* (float scalar) |
Vector multiplied by scalar. More... | |
Vector2 | operator/ (float scalar) |
Vector divided by scalar. More... | |
float | operator* (Vector2 v) |
Dot-Product between two vectors. More... | |
bool | operator< (Vector2 v) |
Vector is less than another vector in all components. More... | |
bool | operator<= (Vector2 v) |
Vector is less than or equal to another vector in all components. More... | |
bool | operator> (Vector2 v) |
Vector is greater than another vector in all components. More... | |
bool | operator>= (Vector2 v) |
Vector is greater than or equal to another vector in all components. More... | |
File Handling | |
void | writeToFile (FileWriter writer) |
Write vector to a file writer. More... | |
static Vector2 | readFromFile (FileReader reader) |
Read vector from a file reader. More... | |
Immutable 2-component vector.
This is a native class. It can not be subclassed.
Vector with all components clamped to a range of two vectors.
bool Dragengine.Scenery.Vector2.equals | ( | Object | other | ) |
float Dragengine.Scenery.Vector2.getComponentAt | ( | int | component | ) |
Component by index (0=X, 1=Y).
float Dragengine.Scenery.Vector2.getLength | ( | ) |
Length.
float Dragengine.Scenery.Vector2.getX | ( | ) |
X-Component.
float Dragengine.Scenery.Vector2.getY | ( | ) |
Y-Component.
int Dragengine.Scenery.Vector2.hashCode | ( | ) |
Hash code for use as dictionary keys.
Implements Object.hashCode().
bool Dragengine.Scenery.Vector2.isAtLeast | ( | float | value | ) |
All coordinates are at least of a minimal value.
bool Dragengine.Scenery.Vector2.isAtMost | ( | float | value | ) |
All coordinates are at most of a maximal value.
bool Dragengine.Scenery.Vector2.isEqualTo | ( | Vector2 | v, |
float | delta | ||
) |
Two vectors are equal.
bool Dragengine.Scenery.Vector2.isZero | ( | ) |
Vector is equal to zero vector.
Vector with all components set to the largest value of two vectors.
Mix vector with another component wise.
Factor 0 uses this vector, factor 1 the other vector.
Vector2 Dragengine.Scenery.Vector2.new | ( | float | x, |
float | y | ||
) |
Create Vector2 using the specified components.
Vector2 Dragengine.Scenery.Vector2.normalize | ( | ) |
Vector divided by length().
EDivisionByZero | Length is 0. |
float Dragengine.Scenery.Vector2.operator* | ( | Vector2 | v | ) |
Dot-Product between two vectors.
Vector2 Dragengine.Scenery.Vector2.operator- | ( | ) |
Negated vector.
Vector2 Dragengine.Scenery.Vector2.operator/ | ( | float | scalar | ) |
Vector divided by scalar.
EDivisionByZero | scalar is 0. |
bool Dragengine.Scenery.Vector2.operator< | ( | Vector2 | v | ) |
Vector is less than another vector in all components.
bool Dragengine.Scenery.Vector2.operator<= | ( | Vector2 | v | ) |
Vector is less than or equal to another vector in all components.
bool Dragengine.Scenery.Vector2.operator> | ( | Vector2 | v | ) |
Vector is greater than another vector in all components.
bool Dragengine.Scenery.Vector2.operator>= | ( | Vector2 | v | ) |
Vector is greater than or equal to another vector in all components.
|
static |
Read vector from a file reader.
Point Dragengine.Scenery.Vector2.round | ( | ) |
Convert to point rounding to the nearest integer value.
Vector2 Dragengine.Scenery.Vector2.round | ( | float | unit | ) |
Components rounded to the nearest unit.
Vector with all components set to the smallest value of two vectors.
String Dragengine.Scenery.Vector2.toString | ( | ) |
String representation of vector.
Implements Object.toString()
String Dragengine.Scenery.Vector2.toString | ( | int | precision | ) |
String representation of vector with precision.
Same as toString() except the count of digits of each component is precision.
precision | Precision in digits in the range from 0 to 9 inclusive. |
EInvalidParam | precision is less than 0 or larger than 9. |
void Dragengine.Scenery.Vector2.writeToFile | ( | FileWriter | writer | ) |
Write vector to a file writer.