Drag[en]gine Script Module DragonScript  1.23
Dragengine.Scenery.DVector Class Reference

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

Inheritance diagram for Dragengine.Scenery.DVector:

Public Member Functions

Constructors
DVector new ()
 Create vector with all components set to 0. More...
 
DVector new (float x, float y, float z)
 Create vector using the specified components. More...
 
DVector new (DVector v)
 Create copy of a DVector. More...
 
DVector 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...
 
DVector normalize ()
 Vector divided by length(). More...
 
DVector absolute ()
 Vector with absolute of all components. More...
 
DVector compMultiply (DVector v)
 Component wise multiplication. More...
 
DVector compDivide (DVector v)
 Component wise division. More...
 
DVector compSelect (bool x, bool y, bool z)
 Vector with components set to true copied while all others are set to 0. More...
 
DVector combine (DVector vector, bool x, bool y, bool z)
 Combine selected components of this vector with another. More...
 
DVector smallest (DVector v)
 Vector with all components set to the smallest value of two vectors. More...
 
DVector largest (DVector v)
 Vector with all components set to the largest value of two vectors. More...
 
DVector clamped (DVector min, DVector max)
 Vector with all components clamped to a range of two vectors. More...
 
Vector toVector ()
 Convert to single precision vector with possible loss of precision. More...
 
Point3 round ()
 Components rounded to nearest integer value. More...
 
DVector round (float unit)
 Components rounded to the nearest unit. More...
 
DVector mix (DVector other, float factor)
 Mix vector with another component wise. More...
 
bool isEqualTo (DVector 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
DVector operator- ()
 Negated vector. More...
 
DVector operator+ (DVector v)
 Sum of two vectors. More...
 
DVector operator- (DVector v)
 Difference of two vectors. More...
 
DVector operator* (float scalar)
 Vector scaled by scalar. More...
 
DVector operator/ (float scalar)
 Vector with each component divided by a value. More...
 
float operator* (DVector v)
 Dot-Product between two vectors. More...
 
DVector operator% (DVector v)
 Cross-Product between two vectors. More...
 
bool operator< (DVector v)
 Vector is less than another vector in all components. More...
 
bool operator<= (DVector v)
 Vector is less than or equal to another vector in all components. More...
 
bool operator> (DVector v)
 Vector is greater than another vector in all components. More...
 
bool operator>= (DVector 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 DVector 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()

DVector Dragengine.Scenery.DVector.absolute ( )

Vector with absolute of all components.

◆ clamped()

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

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

◆ combine()

DVector Dragengine.Scenery.DVector.combine ( DVector  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()

DVector Dragengine.Scenery.DVector.compDivide ( DVector  v)

Component wise division.

◆ compMultiply()

DVector Dragengine.Scenery.DVector.compMultiply ( DVector  v)

Component wise multiplication.

◆ compSelect()

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.

◆ equals()

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

Vector is equal to another object.

Implements Object.equals(Object).

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

◆ get()

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

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

◆ getLength()

float Dragengine.Scenery.DVector.getLength ( )

Length.

◆ getLengthSquared()

float Dragengine.Scenery.DVector.getLengthSquared ( )

Squared length.

◆ getX()

float Dragengine.Scenery.DVector.getX ( )

X-Component.

◆ getY()

float Dragengine.Scenery.DVector.getY ( )

Y-Component.

◆ getZ()

float Dragengine.Scenery.DVector.getZ ( )

Z-Component.

◆ hashCode()

int Dragengine.Scenery.DVector.hashCode ( )

Hash code for use as dictionary keys.

Implements Object.hashCode().

◆ isAtLeast()

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

All coordinates are at least of a minimal value.

◆ isAtMost()

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

All coordinates are at most of a maximal value.

◆ isEqualTo()

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

Two vectors are equal.

◆ isZero()

bool Dragengine.Scenery.DVector.isZero ( )

Vector is equal to zero vector.

◆ largest()

DVector Dragengine.Scenery.DVector.largest ( DVector  v)

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

◆ mix()

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

Mix vector with another component wise.

Version
1.10

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

◆ new() [1/4]

DVector Dragengine.Scenery.DVector.new ( )

Create vector with all components set to 0.

◆ new() [2/4]

DVector Dragengine.Scenery.DVector.new ( DVector  v)

Create copy of a DVector.

◆ new() [3/4]

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

Create vector using the specified components.

◆ new() [4/4]

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

Create DVetor from Vector.

◆ normalize()

DVector Dragengine.Scenery.DVector.normalize ( )

Vector divided by length().

Exceptions
EDivisionByZeroLength is 0.

◆ operator%()

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

Cross-Product between two vectors.

◆ operator*() [1/2]

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

Dot-Product between two vectors.

◆ operator*() [2/2]

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

Vector scaled by scalar.

◆ operator+()

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

Sum of two vectors.

◆ operator-() [1/2]

DVector Dragengine.Scenery.DVector.operator- ( )

Negated vector.

◆ operator-() [2/2]

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

Difference of two vectors.

◆ operator/()

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

Vector with each component divided by a value.

Exceptions
EDivisionByZeroscalar is 0.

◆ operator<()

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

Vector is less than another vector in all components.

◆ operator<=()

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

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

◆ operator>()

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

Vector is greater than another vector in all components.

◆ operator>=()

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

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

◆ readFromFile()

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

Read vector from a file reader.

◆ round() [1/2]

Point3 Dragengine.Scenery.DVector.round ( )

Components rounded to nearest integer value.

Version
1.8

◆ round() [2/2]

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

Components rounded to the nearest unit.

Version
1.8

◆ smallest()

DVector Dragengine.Scenery.DVector.smallest ( DVector  v)

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

◆ toString() [1/2]

String Dragengine.Scenery.DVector.toString ( )

String representation of vector.

Implements Object.toString()

◆ toString() [2/2]

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.

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

◆ toVector()

Vector Dragengine.Scenery.DVector.toVector ( )

Convert to single precision vector with possible loss of precision.

◆ writeToFile()

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

Write vector to a file writer.


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