Drag[en]gine Script Module DragonScript Script API  1.0
Vector Class Reference

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

Inheritance diagram for 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 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 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...
 
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 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...
 
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.

Author
Roland Pl├╝ss
Version
1.0
Date
2015

Member Function Documentation

§ clamped()

Vector clamped ( Vector  min,
Vector  max 
)

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

§ compDivide()

Vector compDivide ( Vector  v)

Component wise division.

§ compMultiply()

Vector compMultiply ( Vector  v)

Component wise multiplication.

§ compSelect()

Vector compSelect ( bool  x,
bool  y,
bool  z 
)

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

§ equals()

bool 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 get ( int  component)

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

§ getLength()

float getLength ( )

Length.

§ getLengthSquared()

float getLengthSquared ( )

Squared length.

§ getX()

float getX ( )

X-Component.

§ getY()

float getY ( )

Y-Component.

§ getZ()

float getZ ( )

Z-Component.

§ hashCode()

int hashCode ( )

Hash code for use as dictionary keys.

Implements Object.hashCode().

§ isAtLeast()

bool isAtLeast ( float  value)

All coordinates are at least of a minimal value.

§ isAtMost()

bool isAtMost ( float  value)

All coordinates are at most of a maximal value.

§ isEqualTo()

bool isEqualTo ( Vector  v,
float  delta 
)

Two vectors are equal.

§ largest()

Vector largest ( Vector  v)

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

§ new() [1/3]

Vector new ( )

Create vector with all components set to 0.

§ new() [2/3]

Vector new ( float  x,
float  y,
float  z 
)

Create vector using the specified components.

§ new() [3/3]

Vector new ( Vector  v)

Create DVetor from Vector.

§ normalize()

Vector normalize ( )

Vector divided by length().

Exceptions
EDivisionByZeroLength is 0.

§ operator%()

Vector operator% ( Vector  v)

Cross-Product between two vectors.

§ operator*() [1/2]

Vector operator* ( float  scalar)

Vector scaled by scalar.

§ operator*() [2/2]

float operator* ( Vector  v)

Dot-Product between two vectors.

§ operator+()

Vector operator+ ( Vector  v)

Sum of two vectors.

§ operator-() [1/2]

Vector operator- ( )

Negated vector.

§ operator-() [2/2]

Vector operator- ( Vector  v)

Difference of two vectors.

§ operator/()

Vector operator/ ( float  scalar)

Vector with each component divided by a value.

Exceptions
EDivisionByZeroscalar is 0.

§ operator<()

bool operator< ( Vector  v)

Vector is less than another vector in all components.

§ operator<=()

bool operator<= ( Vector  v)

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

§ operator>()

bool operator> ( Vector  v)

Vector is greater than another vector in all components.

§ operator>=()

bool operator>= ( Vector  v)

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

§ readFromFile()

static Vector readFromFile ( FileReader  reader)
static

Read vector from a file reader.

§ smallest()

Vector smallest ( Vector  v)

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

§ toString()

String toString ( )

String representation of vector.

Implements Object.toString()

§ writeToFile()

void writeToFile ( FileWriter  writer)

Write vector to a file writer.


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