Drag[en]gine Script Module DragonScript  1.21
Dragengine.Scenery.Vector Class Reference

Immutable 3-component double precision vector. More...

Inheritance diagram for Dragengine.Scenery.Vector:

Public Member Functions

Constructors
Vector new ()
 Create vector with all components set to 0. More...
 
Vector new (float x, float y, float z)
 Create vector using the specified components. More...
 
Vector new (Vector v)
 Create DVetor from Vector. More...
 
Management
float getX ()
 X-Component. More...
 
float getY ()
 Y-Component. More...
 
float getZ ()
 Z-Component. More...
 
float get (int component)
 Component (0=X, 1=Y, 2=Z). More...
 
float getLength ()
 Length. More...
 
float getLengthSquared ()
 Squared length. More...
 
Vector normalize ()
 Vector divided by length(). More...
 
Vector absolute ()
 Vector with absolute value of each component. More...
 
Vector compMultiply (Vector v)
 Component wise multiplication. More...
 
Vector compDivide (Vector v)
 Component wise division. More...
 
Vector compSelect (bool x, bool y, bool z)
 Vector with components set to true copied while all others are set to 0. More...
 
Vector combine (Vector vector, bool x, bool y, bool z)
 Combine selected components of this vector with another. More...
 
Vector smallest (Vector v)
 Vector with all components set to the smallest value of two vectors. More...
 
Vector largest (Vector v)
 Vector with all components set to the largest value of two vectors. More...
 
Vector clamped (Vector min, Vector max)
 Vector with all components clamped to a range of two vectors. More...
 
Point3 round ()
 Components rounded to nearest integer value. More...
 
Vector round (float unit)
 Components rounded to the nearest unit. More...
 
Vector mix (Vector other, float factor)
 Mix vector with another component wise. More...
 
bool isEqualTo (Vector 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
Vector operator- ()
 Negated vector. More...
 
Vector operator+ (Vector v)
 Sum of two vectors. More...
 
Vector operator- (Vector v)
 Difference of two vectors. More...
 
Vector operator* (float scalar)
 Vector scaled by scalar. More...
 
Vector operator/ (float scalar)
 Vector with each component divided by a value. More...
 
float operator* (Vector v)
 Dot-Product between two vectors. More...
 
Vector operator% (Vector v)
 Cross-Product between two vectors. More...
 
bool operator< (Vector v)
 Vector is less than another vector in all components. More...
 
bool operator<= (Vector v)
 Vector is less than or equal to another vector in all components. More...
 
bool operator> (Vector v)
 Vector is greater than another vector in all components. More...
 
bool operator>= (Vector 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 Vector readFromFile (FileReader reader)
 Read vector from a file reader. More...
 

Detailed Description

Immutable 3-component double precision vector.

This is a native class. It can not be subclassed.

Member Function Documentation

◆ absolute()

Vector Dragengine.Scenery.Vector.absolute ( )

Vector with absolute value of each component.

◆ clamped()

Vector Dragengine.Scenery.Vector.clamped ( Vector  min,
Vector  max 
)

Vector with all components clamped to a range of two vectors.

◆ combine()

Vector Dragengine.Scenery.Vector.combine ( Vector  vector,
bool  x,
bool  y,
bool  z 
)

Combine selected components of this vector with another.

For each component use this vector if value is true otherwise use vector component.

◆ compDivide()

Vector Dragengine.Scenery.Vector.compDivide ( Vector  v)

Component wise division.

◆ compMultiply()

Vector Dragengine.Scenery.Vector.compMultiply ( Vector  v)

Component wise multiplication.

◆ compSelect()

Vector Dragengine.Scenery.Vector.compSelect ( bool  x,
bool  y,
bool  z 
)

Vector with components set to true copied while all others are set to 0.

◆ equals()

bool Dragengine.Scenery.Vector.equals ( Object  other)

Vector is equal to another object.

Implements Object.equals(Object).

Returns
true if other is of type Vector and components are equal.

◆ get()

float Dragengine.Scenery.Vector.get ( int  component)

Component (0=X, 1=Y, 2=Z).

◆ getLength()

float Dragengine.Scenery.Vector.getLength ( )

Length.

◆ getLengthSquared()

float Dragengine.Scenery.Vector.getLengthSquared ( )

Squared length.

◆ getX()

float Dragengine.Scenery.Vector.getX ( )

X-Component.

◆ getY()

float Dragengine.Scenery.Vector.getY ( )

Y-Component.

◆ getZ()

float Dragengine.Scenery.Vector.getZ ( )

Z-Component.

◆ hashCode()

int Dragengine.Scenery.Vector.hashCode ( )

Hash code for use as dictionary keys.

Implements Object.hashCode().

◆ isAtLeast()

bool Dragengine.Scenery.Vector.isAtLeast ( float  value)

All coordinates are at least of a minimal value.

◆ isAtMost()

bool Dragengine.Scenery.Vector.isAtMost ( float  value)

All coordinates are at most of a maximal value.

◆ isEqualTo()

bool Dragengine.Scenery.Vector.isEqualTo ( Vector  v,
float  delta 
)

Two vectors are equal.

◆ isZero()

bool Dragengine.Scenery.Vector.isZero ( )

Vector is equal to zero vector.

◆ largest()

Vector Dragengine.Scenery.Vector.largest ( Vector  v)

Vector with all components set to the largest value of two vectors.

◆ mix()

Vector Dragengine.Scenery.Vector.mix ( Vector  other,
float  factor 
)

Mix vector with another component wise.

Version
1.10

Factor 0 uses this vector, factor 1 the other vector.

◆ new() [1/3]

Vector Dragengine.Scenery.Vector.new ( )

Create vector with all components set to 0.

◆ new() [2/3]

Vector Dragengine.Scenery.Vector.new ( float  x,
float  y,
float  z 
)

Create vector using the specified components.

◆ new() [3/3]

Vector Dragengine.Scenery.Vector.new ( Vector  v)

Create DVetor from Vector.

◆ normalize()

Vector Dragengine.Scenery.Vector.normalize ( )

Vector divided by length().

Exceptions
EDivisionByZeroLength is 0.

◆ operator%()

Vector Dragengine.Scenery.Vector.operator% ( Vector  v)

Cross-Product between two vectors.

◆ operator*() [1/2]

Vector Dragengine.Scenery.Vector.operator* ( float  scalar)

Vector scaled by scalar.

◆ operator*() [2/2]

float Dragengine.Scenery.Vector.operator* ( Vector  v)

Dot-Product between two vectors.

◆ operator+()

Vector Dragengine.Scenery.Vector.operator+ ( Vector  v)

Sum of two vectors.

◆ operator-() [1/2]

Vector Dragengine.Scenery.Vector.operator- ( )

Negated vector.

◆ operator-() [2/2]

Vector Dragengine.Scenery.Vector.operator- ( Vector  v)

Difference of two vectors.

◆ operator/()

Vector Dragengine.Scenery.Vector.operator/ ( float  scalar)

Vector with each component divided by a value.

Exceptions
EDivisionByZeroscalar is 0.

◆ operator<()

bool Dragengine.Scenery.Vector.operator< ( Vector  v)

Vector is less than another vector in all components.

◆ operator<=()

bool Dragengine.Scenery.Vector.operator<= ( Vector  v)

Vector is less than or equal to another vector in all components.

◆ operator>()

bool Dragengine.Scenery.Vector.operator> ( Vector  v)

Vector is greater than another vector in all components.

◆ operator>=()

bool Dragengine.Scenery.Vector.operator>= ( Vector  v)

Vector is greater than or equal to another vector in all components.

◆ readFromFile()

static Vector Dragengine.Scenery.Vector.readFromFile ( FileReader  reader)
static

Read vector from a file reader.

◆ round() [1/2]

Point3 Dragengine.Scenery.Vector.round ( )

Components rounded to nearest integer value.

Version
1.8

◆ round() [2/2]

Vector Dragengine.Scenery.Vector.round ( float  unit)

Components rounded to the nearest unit.

Version
1.8

◆ smallest()

Vector Dragengine.Scenery.Vector.smallest ( Vector  v)

Vector with all components set to the smallest value of two vectors.

◆ toString() [1/2]

String Dragengine.Scenery.Vector.toString ( )

String representation of vector.

Implements Object.toString()

◆ toString() [2/2]

String Dragengine.Scenery.Vector.toString ( int  precision)

String representation of vector with precision.

Same as toString() except the count of digits of each component is precision.

Parameters
precisionPrecision in digits in the range from 0 to 9 inclusive.
Exceptions
EInvalidParamprecision is less than 0 or larger than 9.

◆ writeToFile()

void Dragengine.Scenery.Vector.writeToFile ( FileWriter  writer)

Write vector to a file writer.


The documentation for this class was generated from the following file: