|
Drag[en]gine Script Module DragonScript 1.35
|
Immutable 3-component double precision vector. More...
Public Member Functions | |
Constructors | |
| DVector | new () |
| Create vector with all components set to 0. | |
| DVector | new (float x, float y, float z) |
| Create vector using the specified components. | |
| DVector | new (DVector v) |
| Create copy of a DVector. | |
| DVector | new (Vector v) |
| Create DVetor from Vector. | |
Management | |
| float | getX () |
| X-Component. | |
| float | getY () |
| Y-Component. | |
| float | getZ () |
| Z-Component. | |
| float | get (int component) |
| Component (0=X, 1=Y, 2=Z). | |
| float | getLength () |
| Length. | |
| float | getLengthSquared () |
| Squared length. | |
| DVector | normalize () |
| Vector divided by length(). | |
| DVector | absolute () |
| Vector with absolute of all components. | |
| DVector | compMultiply (DVector v) |
| Component wise multiplication. | |
| DVector | compDivide (DVector v) |
| Component wise division. | |
| DVector | compSelect (bool x, bool y, bool z) |
| Vector with components set to true copied while all others are set to 0. | |
| DVector | combine (DVector vector, bool x, bool y, bool z) |
| Combine selected components of this vector with another. | |
| DVector | smallest (DVector v) |
| Vector with all components set to the smallest value of two vectors. | |
| DVector | largest (DVector v) |
| Vector with all components set to the largest value of two vectors. | |
| DVector | clamped (DVector min, DVector max) |
| Vector with all components clamped to a range of two vectors. | |
| Vector | toVector () |
| Convert to single precision vector with possible loss of precision. | |
| Point3 | round () |
| Components rounded to nearest integer value. | |
| DVector | round (float unit) |
| Components rounded to the nearest unit. | |
| DVector | mix (DVector other, float factor) |
| Mix vector with another component wise. | |
| bool | isEqualTo (DVector 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 | |
| DVector | operator- () |
| Negated vector. | |
| DVector | operator+ (DVector v) |
| Sum of two vectors. | |
| DVector | operator- (DVector v) |
| Difference of two vectors. | |
| DVector | operator* (float scalar) |
| Vector scaled by scalar. | |
| DVector | operator/ (float scalar) |
| Vector with each component divided by a value. | |
| float | operator* (DVector v) |
| Dot-Product between two vectors. | |
| DVector | operator% (DVector v) |
| Cross-Product between two vectors. | |
| bool | operator< (DVector v) |
| Vector is less than another vector in all components. | |
| bool | operator<= (DVector v) |
| Vector is less than or equal to another vector in all components. | |
| bool | operator> (DVector v) |
| Vector is greater than another vector in all components. | |
| bool | operator>= (DVector 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 DVector | readFromFile (FileReader reader) |
| Read vector from a file reader. | |
Immutable 3-component double precision vector.
This is a native class. It can not be subclassed.
| DVector Dragengine.Scenery.DVector.absolute | ( | ) |
Vector with all components clamped to a range of two vectors.
Referenced by isAtLeast().
Combine selected components of this vector with another.
For each component use this vector if value is true otherwise use vector component.
Referenced by round().
Component wise division.
Referenced by toVector().
| DVector Dragengine.Scenery.DVector.compSelect | ( | bool | x, |
| bool | y, | ||
| bool | z ) |
Vector with components set to true copied while all others are set to 0.
References normalize().
Referenced by round().
| bool Dragengine.Scenery.DVector.equals | ( | Object | other | ) |
Vector is equal to another object.
Implements Object.equals(Object).
Referenced by operator*().
| float Dragengine.Scenery.DVector.get | ( | int | component | ) |
| float Dragengine.Scenery.DVector.getLength | ( | ) |
| float Dragengine.Scenery.DVector.getLengthSquared | ( | ) |
| float Dragengine.Scenery.DVector.getX | ( | ) |
X-Component.
Referenced by getY().
| float Dragengine.Scenery.DVector.getZ | ( | ) |
Z-Component.
Referenced by getLength().
| int Dragengine.Scenery.DVector.hashCode | ( | ) |
Hash code for use as dictionary keys.
Implements Object.hashCode().
References round().
Referenced by operator/().
| bool Dragengine.Scenery.DVector.isAtLeast | ( | float | value | ) |
| bool Dragengine.Scenery.DVector.isAtMost | ( | float | value | ) |
All coordinates are at most of a maximal value.
Referenced by writeToFile().
| bool Dragengine.Scenery.DVector.isEqualTo | ( | DVector | v, |
| float | delta ) |
Two vectors are equal.
Referenced by toString().
| bool Dragengine.Scenery.DVector.isZero | ( | ) |
Vector with all components set to the largest value of two vectors.
References compMultiply().
Referenced by mix().
Mix vector with another component wise.
Factor 0 uses this vector, factor 1 the other vector.
References largest().
Referenced by toString().
| DVector Dragengine.Scenery.DVector.new | ( | ) |
| DVector Dragengine.Scenery.DVector.new | ( | float | x, |
| float | y, | ||
| float | z ) |
Create vector using the specified components.
References new().
| DVector Dragengine.Scenery.DVector.normalize | ( | ) |
| float Dragengine.Scenery.DVector.operator* | ( | DVector | v | ) |
Dot-Product between two vectors.
| DVector Dragengine.Scenery.DVector.operator* | ( | float | scalar | ) |
| DVector Dragengine.Scenery.DVector.operator- | ( | ) |
Negated vector.
| DVector Dragengine.Scenery.DVector.operator/ | ( | float | scalar | ) |
Vector with each component divided by a value.
| EDivisionByZero | scalar is 0. |
References hashCode().
| bool Dragengine.Scenery.DVector.operator< | ( | DVector | v | ) |
Vector is less than another vector in all components.
References toString().
| bool Dragengine.Scenery.DVector.operator<= | ( | DVector | v | ) |
Vector is less than or equal to another vector in all components.
| bool Dragengine.Scenery.DVector.operator> | ( | DVector | v | ) |
Vector is greater than another vector in all components.
| bool Dragengine.Scenery.DVector.operator>= | ( | DVector | v | ) |
Vector is greater than or equal to another vector in all components.
References readFromFile(), toString(), and writeToFile().
|
static |
Read vector from a file reader.
Referenced by operator>=().
| Point3 Dragengine.Scenery.DVector.round | ( | ) |
Components rounded to nearest integer value.
References compSelect().
Referenced by hashCode(), and isZero().
| DVector Dragengine.Scenery.DVector.round | ( | float | unit | ) |
Vector with all components set to the smallest value of two vectors.
References absolute().
Referenced by round().
| String Dragengine.Scenery.DVector.toString | ( | ) |
String representation of vector.
Implements Object.toString()
References mix().
Referenced by operator<(), and operator>=().
| String Dragengine.Scenery.DVector.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 17 inclusive. |
| EInvalidParam | precision is less than 0 or larger than 17. |
References isAtLeast(), and isEqualTo().
| Vector Dragengine.Scenery.DVector.toVector | ( | ) |
Convert to single precision vector with possible loss of precision.
References compDivide().
Referenced by isZero().
| void Dragengine.Scenery.DVector.writeToFile | ( | FileWriter | writer | ) |