IGLib 1.4
The IGLib base library for development of numerical, technical and business applications.

IG::Num::Vector3d Class Reference

Vector or point in a 3 dimensional space. More...

Inheritance diagram for IG::Num::Vector3d:
Collaboration diagram for IG::Num::Vector3d:

List of all members.

Public Member Functions

Vector3d GetCopyThis ()
 Creates and returns a copy of the current 3D vector, which is of the same type as the current vector.
override VectorBase GetCopyBase ()
 Creates and returns a copy of the current vector, which is of the same type as the current vector.
Vector3d GetNewThis (int length)
 Creates and returns a new vector of the specified dimension in such a way that the type of the returned vector is the same as that of the current vector.
override VectorBase GetNewBase (int length)
 Creates and returns a new 3D vector of the specified dimension in such a way that the type of the returned vector is the same as that of the current vector.
Vector3d GetNewThis ()
 Creates and returns a new vector with the same dimension and of the same type as the current vector.
override VectorBase GetNewBase ()
 Creates and returns a new vector with the same dimension and of the same type as the current vector.
virtual Matrix3d GetNewMatrixThis (int rowCount, int columnCount)
 Creates and returns a new 3D matrix with the specified dimensona, and of a type that is consistent with the type of the current vector.
override MatrixBase GetNewMatrixBase (int rowCount, int columnCount)
 Creates and returns a new 3D matrix with the specified dimensona, and of a type that is consistent with the type of the current vector.
Matrix3d GetNewMatrixThis ()
 Creates and returns a new matrix of a type that is consistent with the type of the current vector, and with both dimensions equal to the dimension of the current vector.
override MatrixBase GetNewMatrixBase ()
 Creates and returns a new matrix of a type that is consistent with the type of the current vector, and with both dimensions equal to the dimension of the current vector.
 Vector3d (Vector3d v)
 Copy constructor. Initializes components of a 3D vector with components of the specified vector.
 Vector3d (vec3 v)
 Initializes components of a 3D vector with components of the specified vector.
 Vector3d (double x, double y, double z)
 Initializes components of a 3D vector with the specified values.
 Vector3d (double comp)
 Initializes all component of a 3D vector with the specified value.
 Vector3d (double[] components)
 Constructs a vector from a 1-D array.
 Vector3d (IVector vec)
 Constructs a 3D vector from another vector.
override int GetHashCode ()
 Returns the hash code (hash function) of the current vector.
override bool Equals (Object obj)
 Returns a value indicating whether the specified object is equal to the current vector. True is returned if the object is a non-null vector (i.e. it implements the IVector interface), has the same dimension and equal elements as the current vector.
new Vector3d Normalized ()
 Normalizes this 3D vector.
Vector3d Normalized1 ()
 Normalizes this 3D vector in 1 norm.
Vector3d Normalized2 ()
 Normalizes this 3D vector in 2 norm.
Vector3d NormalizedInfinity ()
 Normalizes this 3D vector in infinity norm.
double ScalarProduct (Vector3d v)
 Returns scalar product of the current and the specified vector.
Vector3d VectorProduct (Vector3d v)
 Returns vector product of the current and the specified vector.
Vector3d CrossProduct (Vector3d v)
 Returns vector product of the current and the specified vector.
Vector3d Cross (Vector3d v)
 Returns vector product of the current and the specified vector.
Matrix3d DyadicProduct (Vector3d v)
 Returns dyadic product of the current and the specified vector.
double MixedProduct (Vector3d b, Vector3d c)
 Returns mixed product of the current and two other specified vectors. This equals the volume of the parallelepiped spanned by these vectors.
Vector3d Multiply (double k)
 Returns the current vector multiplied by the specified scalar.
Vector3d Add (Vector3d a)
 Returns sum of the current vector and the specified vector.
Vector3d Subtract (Vector3d a)
 Returns difference between the current vector and the specified vector.
override string ToString ()
 Returns string representation of the 3D vector.
void Read ()
 Reads 3D vector components from a console.
void Read (string name)
 Reads 3D vector components from a console.

Static Public Member Functions

static Vector3d Create (double[] components)
 Constructs a vector from a 1-D array.
static Vector3d Create (IVector vec)
 Constructs a 3D vector as a copy of another IVector object.
static Vector3d Random (int n)
 Generates vector with random elements uniformly distributed on [0, 1).
static Vector3d Ones (int n)
 Generates an d2-dimensional vector filled with 1.
static Vector3d Zeros (int n)
 Generates an d2-dimensional vector filled with 0.
static Vector3d BasisVector (int i)
 Generates an d2-dimensional unit vector for i-th coordinate.
static Vector3d Copy (Vector3d v)
 Returns a copy of the specified 3D vector.
static void Negate (Vector3d v, ref Vector3d res)
 Negates the specified vector and stores its copy in the resulting vector.
static Vector3d operator+ (Vector3d v)
 Unary plus, returns the operand.
static Vector3d operator- (Vector3d v)
 Unary negation, returns the negative operand.
static Vector3d operator+ (Vector3d a, Vector3d b)
 Vector addition.
static Vector3d operator- (Vector3d a, Vector3d b)
 Vector subtraction.
static double operator* (Vector3d a, Vector3d b)
 Scalar product of two 3D vectors.
static Vector3d operator* (Vector3d a, double b)
 Product of a 3D vector by a scalar.
static Vector3d operator* (double a, Vector3d b)
 Product of a 3D vector by a scalar.
static Vector3d operator/ (Vector3d a, double b)
 Vector subtraction.

Properties

override int Length [get]
 Gets dimension of the vector.
override double this [int i] [get, set]
 Gets or sets the element indexed by i in the 3D Vector.
vec3 Vec [get, set]
 Gets the struct representation of this 3D vector.
double X [get, set]
 1st component.
double Y [get, set]
 2nd component.
double Z [get, set]
 3rd component.
override double Norm [get]
 Gets a 2 norm of the current 3D vector.
override double Norm2 [get]
 Gets a 2 norm of the current 3D vector.
override double Norm1 [get]
 Gets an 1 norm of the current 3D vector - sum of absolute values of components.
override double NormInf [get]
 Gets an infinity norm of the current 3D vector - maximal absolute component value.

Private Member Functions

object ICloneable. Clone ()
 Returns a deep copy of a 3D vector.

Private Attributes

vec3 _v

Detailed Description

Vector or point in a 3 dimensional space.

$A Igor Jul08; Oct10; TODO: Consider whether Vector3d should ingerit from VectorBase!


Constructor & Destructor Documentation

IG::Num::Vector3d::Vector3d ( Vector3d  v) [inline]

Copy constructor. Initializes components of a 3D vector with components of the specified vector.

Parameters:
vVectr whose components are copied to the initialized vector.
IG::Num::Vector3d::Vector3d ( vec3  v) [inline]

Initializes components of a 3D vector with components of the specified vector.

Parameters:
vVector whose components are copied to the initialized vector.
IG::Num::Vector3d::Vector3d ( double  x,
double  y,
double  z 
) [inline]

Initializes components of a 3D vector with the specified values.

Parameters:
compValue assigned to all vector components.
IG::Num::Vector3d::Vector3d ( double  comp) [inline]

Initializes all component of a 3D vector with the specified value.

Parameters:
compValue assigned to all vector components.
IG::Num::Vector3d::Vector3d ( double[]  components) [inline]

Constructs a vector from a 1-D array.

Parameters:
vecOne-dimensional array of doubles.
See also:
Create
IG::Num::Vector3d::Vector3d ( IVector  vec) [inline]

Constructs a 3D vector from another vector.

Parameters:
vecVector whose copy is created.

Member Function Documentation

Vector3d IG::Num::Vector3d::GetCopyThis ( ) [inline]

Creates and returns a copy of the current 3D vector, which is of the same type as the current vector.

override VectorBase IG::Num::Vector3d::GetCopyBase ( ) [inline, virtual]

Creates and returns a copy of the current vector, which is of the same type as the current vector.

Implements IG::Num::VectorBase.

Vector3d IG::Num::Vector3d::GetNewThis ( int  length) [inline]

Creates and returns a new vector of the specified dimension in such a way that the type of the returned vector is the same as that of the current vector.

Parameters:
lengthDimension of the returned vector.
override VectorBase IG::Num::Vector3d::GetNewBase ( int  length) [inline, virtual]

Creates and returns a new 3D vector of the specified dimension in such a way that the type of the returned vector is the same as that of the current vector.

Parameters:
lengthDimension of the returned vector, must be 3.

Implements IG::Num::VectorBase.

Vector3d IG::Num::Vector3d::GetNewThis ( ) [inline]

Creates and returns a new vector with the same dimension and of the same type as the current vector.

override VectorBase IG::Num::Vector3d::GetNewBase ( ) [inline, virtual]

Creates and returns a new vector with the same dimension and of the same type as the current vector.

Implements IG::Num::VectorBase.

virtual Matrix3d IG::Num::Vector3d::GetNewMatrixThis ( int  rowCount,
int  columnCount 
) [inline, virtual]

Creates and returns a new 3D matrix with the specified dimensona, and of a type that is consistent with the type of the current vector.

Parameters:
rowCountNumber of rows of the returned matrix.
columnCountNumber of rows of the returned matrix.
Returns:
A matrix with specified dimensions, whose type is consistent with the type of the current vector.
override MatrixBase IG::Num::Vector3d::GetNewMatrixBase ( int  rowCount,
int  columnCount 
) [inline, virtual]

Creates and returns a new 3D matrix with the specified dimensona, and of a type that is consistent with the type of the current vector.

Parameters:
rowCountNumber of rows of the returned matrix.
columnCountNumber of rows of the returned matrix.
Returns:
A matrix with specified dimensions, whose type is consistent with the type of the current vector.

Implements IG::Num::VectorBase.

Matrix3d IG::Num::Vector3d::GetNewMatrixThis ( ) [inline]

Creates and returns a new matrix of a type that is consistent with the type of the current vector, and with both dimensions equal to the dimension of the current vector.

override MatrixBase IG::Num::Vector3d::GetNewMatrixBase ( ) [inline, virtual]

Creates and returns a new matrix of a type that is consistent with the type of the current vector, and with both dimensions equal to the dimension of the current vector.

Implements IG::Num::VectorBase.

object ICloneable. IG::Num::Vector3d::Clone ( ) [inline, private]

Returns a deep copy of a 3D vector.

static Vector3d IG::Num::Vector3d::Create ( double[]  components) [inline, static]

Constructs a vector from a 1-D array.

static Vector3d IG::Num::Vector3d::Create ( IVector  vec) [inline, static]

Constructs a 3D vector as a copy of another IVector object.

static Vector3d IG::Num::Vector3d::Random ( int  n) [inline, static]

Generates vector with random elements uniformly distributed on [0, 1).

Parameters:
d2Dimensionality of vector.
Returns:
An d2-dimensional vector with uniformly distributedrandom elements in [0, 1) interval.
static Vector3d IG::Num::Vector3d::Ones ( int  n) [inline, static]

Generates an d2-dimensional vector filled with 1.

Parameters:
d2Dimensionality of vector.
static Vector3d IG::Num::Vector3d::Zeros ( int  n) [inline, static]

Generates an d2-dimensional vector filled with 0.

Parameters:
d2Dimensionality of vector.
static Vector3d IG::Num::Vector3d::BasisVector ( int  i) [inline, static]

Generates an d2-dimensional unit vector for i-th coordinate.

Parameters:
d2Dimensionality of vector.
iCoordinate index.
override int IG::Num::Vector3d::GetHashCode ( ) [inline]

Returns the hash code (hash function) of the current vector.

This method calls the VectorBase.GetHashCode to calculate the hash code, which is standard for all implementations of the IVector interface.

Two vectors that have the same dimensions and equal elements will produce the same hash codes.

Probability that two different vectors will produce the same hash code is small but it exists.

Overrides the object.GetHashCode method.

Reimplemented from IG::Num::VectorBase.

override bool IG::Num::Vector3d::Equals ( Object  obj) [inline]

Returns a value indicating whether the specified object is equal to the current vector. True is returned if the object is a non-null vector (i.e. it implements the IVector interface), has the same dimension and equal elements as the current vector.

This method calls the VectorBase.Equals to obtain the returned value, which is standard for all implementations of the IVector function.

Overrides the object.Equals method.

Reimplemented from IG::Num::VectorBase.

new Vector3d IG::Num::Vector3d::Normalized ( ) [inline]

Normalizes this 3D vector.

Implements IG::Num::IVector.

Vector3d IG::Num::Vector3d::Normalized1 ( ) [inline]

Normalizes this 3D vector in 1 norm.

Vector3d IG::Num::Vector3d::Normalized2 ( ) [inline]

Normalizes this 3D vector in 2 norm.

Vector3d IG::Num::Vector3d::NormalizedInfinity ( ) [inline]

Normalizes this 3D vector in infinity norm.

double IG::Num::Vector3d::ScalarProduct ( Vector3d  v) [inline]

Returns scalar product of the current and the specified vector.

Vector3d IG::Num::Vector3d::VectorProduct ( Vector3d  v) [inline]

Returns vector product of the current and the specified vector.

Vector3d IG::Num::Vector3d::CrossProduct ( Vector3d  v) [inline]

Returns vector product of the current and the specified vector.

Vector3d IG::Num::Vector3d::Cross ( Vector3d  v) [inline]

Returns vector product of the current and the specified vector.

Matrix3d IG::Num::Vector3d::DyadicProduct ( Vector3d  v) [inline]

Returns dyadic product of the current and the specified vector.

double IG::Num::Vector3d::MixedProduct ( Vector3d  b,
Vector3d  c 
) [inline]

Returns mixed product of the current and two other specified vectors. This equals the volume of the parallelepiped spanned by these vectors.

Vector3d IG::Num::Vector3d::Multiply ( double  k) [inline]

Returns the current vector multiplied by the specified scalar.

Parameters:
kFactor by which the current vector is multiplied.
Vector3d IG::Num::Vector3d::Add ( Vector3d  a) [inline]

Returns sum of the current vector and the specified vector.

Vector3d IG::Num::Vector3d::Subtract ( Vector3d  a) [inline]

Returns difference between the current vector and the specified vector.

static Vector3d IG::Num::Vector3d::Copy ( Vector3d  v) [inline, static]

Returns a copy of the specified 3D vector.

Parameters:
vVector whose copy is returned.
static void IG::Num::Vector3d::Negate ( Vector3d  v,
ref Vector3d  res 
) [inline, static]

Negates the specified vector and stores its copy in the resulting vector.

Parameters:
vVectr to be negated.
resVector where the result is stored.
static Vector3d IG::Num::Vector3d::operator+ ( Vector3d  v) [inline, static]

Unary plus, returns the operand.

static Vector3d IG::Num::Vector3d::operator- ( Vector3d  v) [inline, static]

Unary negation, returns the negative operand.

static Vector3d IG::Num::Vector3d::operator+ ( Vector3d  a,
Vector3d  b 
) [inline, static]

Vector addition.

static Vector3d IG::Num::Vector3d::operator- ( Vector3d  a,
Vector3d  b 
) [inline, static]

Vector subtraction.

static double IG::Num::Vector3d::operator* ( Vector3d  a,
Vector3d  b 
) [inline, static]

Scalar product of two 3D vectors.

static Vector3d IG::Num::Vector3d::operator* ( Vector3d  a,
double  b 
) [inline, static]

Product of a 3D vector by a scalar.

static Vector3d IG::Num::Vector3d::operator* ( double  a,
Vector3d  b 
) [inline, static]

Product of a 3D vector by a scalar.

static Vector3d IG::Num::Vector3d::operator/ ( Vector3d  a,
double  b 
) [inline, static]

Vector subtraction.

override string IG::Num::Vector3d::ToString ( ) [inline]

Returns string representation of the 3D vector.

Implements IG::Num::IVector.

void IG::Num::Vector3d::Read ( ) [inline]

Reads 3D vector components from a console.

void IG::Num::Vector3d::Read ( string  name) [inline]

Reads 3D vector components from a console.

Parameters:
nameName of the vector to be read; it is written as orientation to the user and can be null.

Member Data Documentation


Property Documentation

override int IG::Num::Vector3d::Length [get]

Gets dimension of the vector.

Reimplemented from IG::Num::VectorBase.

override double IG::Num::Vector3d::this[int i] [get, set]

Gets or sets the element indexed by i in the 3D Vector.

Parameters:
iElement index, 0 - based, must be between 0 and 2.

Reimplemented from IG::Num::VectorBase.

vec3 IG::Num::Vector3d::Vec [get, set]

Gets the struct representation of this 3D vector.

double IG::Num::Vector3d::X [get, set]

1st component.

double IG::Num::Vector3d::Y [get, set]

2nd component.

double IG::Num::Vector3d::Z [get, set]

3rd component.

override double IG::Num::Vector3d::Norm [get]

Gets a 2 norm of the current 3D vector.

Reimplemented from IG::Num::VectorBase.

override double IG::Num::Vector3d::Norm2 [get]

Gets a 2 norm of the current 3D vector.

Reimplemented from IG::Num::VectorBase.

override double IG::Num::Vector3d::Norm1 [get]

Gets an 1 norm of the current 3D vector - sum of absolute values of components.

Reimplemented from IG::Num::VectorBase.

override double IG::Num::Vector3d::NormInf [get]

Gets an infinity norm of the current 3D vector - maximal absolute component value.

Reimplemented from IG::Num::VectorBase.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties Events