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