UnityMol  1.0.25beta
BenTools.Mathematics.Vector Class Reference

A vector class, implementing all interesting features of vectors More...

Inheritance diagram for BenTools.Mathematics.Vector:

Public Member Functions

 Vector (int dim)
 Build a new vector More...
 
 Vector (params float[] X)
 Build a new vector More...
 
 Vector (Vector O)
 Build a new vector as a copy of an existing one More...
 
 Vector (string S)
 Build a new vector from a string More...
 
void Randomize (float Min, float Max)
 Reset all elements with ransom values from the given range More...
 
void Randomize (Vector[] MinMax)
 Reset all elements with ransom values from the given range More...
 
void Multiply (float r)
 Scale all elements by r More...
 
void Add (Vector V)
 Add another vector More...
 
void Add (float d)
 Add a constant to all elements More...
 
override string ToString ()
 Convert the vector into a reconstructable string representation More...
 
override bool Equals (object obj)
 Compares this vector with another one More...
 
override int GetHashCode ()
 Retrieves a hashcode that is dependent on the elements More...
 
int CompareTo (object obj)
 Compare two vectors More...
 
virtual Vector Clone ()
 Get a copy of one vector More...
 

Static Public Member Functions

static Vector operator - (Vector A, Vector B)
 Subtract two vectors More...
 
static Vector operator+ (Vector A, Vector B)
 Add two vectors More...
 
static float operator * (Vector A, Vector B)
 Get the scalar product of two vectors More...
 
static Vector operator * (Vector A, float B)
 Scale one vector More...
 
static Vector operator * (float A, Vector B)
 Scale one vector More...
 
static operator float[] (Vector A)
 Interprete the vector as a float-array More...
 
static float Dist (Vector V1, Vector V2)
 Get the distance of two vectors More...
 

Public Attributes

object Tag = null
 

Static Public Attributes

static int Precision = 10
 Global precision for any calculation More...
 

Properties

float this[int i] [get, set]
 Gets or sets the value of the vector at the given index More...
 
int Dim [get]
 The dimension of the vector More...
 
float SquaredLength [get]
 The squared length of the vector More...
 
float ElementSum [get]
 The sum of all elements in the vector More...
 

Detailed Description

A vector class, implementing all interesting features of vectors

Constructor & Destructor Documentation

◆ Vector() [1/4]

BenTools.Mathematics.Vector.Vector ( int  dim)

Build a new vector

Parameters
dimThe dimension

◆ Vector() [2/4]

BenTools.Mathematics.Vector.Vector ( params float []  X)

Build a new vector

Parameters
XThe elements of the vector

◆ Vector() [3/4]

BenTools.Mathematics.Vector.Vector ( Vector  O)

Build a new vector as a copy of an existing one

Parameters
OThe existing vector

◆ Vector() [4/4]

BenTools.Mathematics.Vector.Vector ( string  S)

Build a new vector from a string

Parameters
SA string, as produced by ToString

Member Function Documentation

◆ Add() [1/2]

void BenTools.Mathematics.Vector.Add ( Vector  V)

Add another vector

Parameters
VV

◆ Add() [2/2]

void BenTools.Mathematics.Vector.Add ( float  d)

Add a constant to all elements

Parameters
dThe constant

◆ Clone()

virtual Vector BenTools.Mathematics.Vector.Clone ( )
virtual

Get a copy of one vector

Returns

◆ CompareTo()

int BenTools.Mathematics.Vector.CompareTo ( object  obj)

Compare two vectors

◆ Dist()

static float BenTools.Mathematics.Vector.Dist ( Vector  V1,
Vector  V2 
)
static

Get the distance of two vectors

◆ Equals()

override bool BenTools.Mathematics.Vector.Equals ( object  obj)

Compares this vector with another one

Parameters
obj
Returns

data[i].Equals(B.data[i]) &&

◆ GetHashCode()

override int BenTools.Mathematics.Vector.GetHashCode ( )

Retrieves a hashcode that is dependent on the elements

Returns
The hashcode

◆ Multiply()

void BenTools.Mathematics.Vector.Multiply ( float  r)

Scale all elements by r

Parameters
rThe scalar

◆ operator *() [1/3]

static float BenTools.Mathematics.Vector.operator * ( Vector  A,
Vector  B 
)
static

Get the scalar product of two vectors

◆ operator *() [2/3]

static Vector BenTools.Mathematics.Vector.operator * ( Vector  A,
float  B 
)
static

Scale one vector

◆ operator *() [3/3]

static Vector BenTools.Mathematics.Vector.operator * ( float  A,
Vector  B 
)
static

Scale one vector

◆ operator -()

static Vector BenTools.Mathematics.Vector.operator - ( Vector  A,
Vector  B 
)
static

Subtract two vectors

◆ operator float[]()

static BenTools.Mathematics.Vector.operator float[] ( Vector  A)
explicitstatic

Interprete the vector as a float-array

◆ operator+()

static Vector BenTools.Mathematics.Vector.operator+ ( Vector  A,
Vector  B 
)
static

Add two vectors

◆ Randomize() [1/2]

void BenTools.Mathematics.Vector.Randomize ( float  Min,
float  Max 
)

Reset all elements with ransom values from the given range

Parameters
MinMin
MaxMax

◆ Randomize() [2/2]

void BenTools.Mathematics.Vector.Randomize ( Vector []  MinMax)

Reset all elements with ransom values from the given range

Parameters
MinMaxMinMax[0] - Min MinMax[1] - Max

◆ ToString()

override string BenTools.Mathematics.Vector.ToString ( )

Convert the vector into a reconstructable string representation

Returns
A string from which the vector can be rebuilt

Member Data Documentation

◆ Precision

int BenTools.Mathematics.Vector.Precision = 10
static

Global precision for any calculation

◆ Tag

object BenTools.Mathematics.Vector.Tag = null

Property Documentation

◆ Dim

int BenTools.Mathematics.Vector.Dim
get

The dimension of the vector

◆ ElementSum

float BenTools.Mathematics.Vector.ElementSum
get

The sum of all elements in the vector

◆ SquaredLength

float BenTools.Mathematics.Vector.SquaredLength
get

The squared length of the vector

◆ this[int i]

float BenTools.Mathematics.Vector.this[int i]
getset

Gets or sets the value of the vector at the given index


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