IGLib 1.4
The IGLib base library for development of numerical, technical and business applications.
|
Vector or point in a 3 dimensional space. More...
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 |
Vector or point in a 3 dimensional space.
$A Igor Jul08; Oct10; TODO: Consider whether Vector3d should ingerit from VectorBase!
IG::Num::Vector3d::Vector3d | ( | Vector3d | v | ) | [inline] |
Copy constructor. Initializes components of a 3D vector with components of the specified vector.
v | Vectr 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.
v | Vector 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.
comp | Value assigned to all vector components. |
IG::Num::Vector3d::Vector3d | ( | double | comp | ) | [inline] |
Initializes all component of a 3D vector with the specified value.
comp | Value assigned to all vector components. |
IG::Num::Vector3d::Vector3d | ( | double[] | components | ) | [inline] |
Constructs a vector from a 1-D array.
vec | One-dimensional array of doubles. |
IG::Num::Vector3d::Vector3d | ( | IVector | vec | ) | [inline] |
Constructs a 3D vector from another vector.
vec | Vector whose copy is created. |
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.
length | Dimension 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.
length | Dimension 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.
rowCount | Number of rows of the returned matrix. |
columnCount | Number of rows of the returned matrix. |
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.
rowCount | Number of rows of the returned matrix. |
columnCount | Number of rows of the returned matrix. |
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.
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).
d2 | Dimensionality of vector. |
[0, 1)
interval.static Vector3d IG::Num::Vector3d::Ones | ( | int | n | ) | [inline, static] |
Generates an d2-dimensional vector filled with 1.
d2 | Dimensionality of vector. |
static Vector3d IG::Num::Vector3d::Zeros | ( | int | n | ) | [inline, static] |
Generates an d2-dimensional vector filled with 0.
d2 | Dimensionality of vector. |
static Vector3d IG::Num::Vector3d::BasisVector | ( | int | i | ) | [inline, static] |
Generates an d2-dimensional unit vector for i-th coordinate.
d2 | Dimensionality of vector. |
i | Coordinate 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.
Returns vector product of the current and the specified vector.
Returns vector product of the current and the specified vector.
Returns vector product of the current and the specified vector.
Returns dyadic product of the current and the specified vector.
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.
k | Factor by which the current vector is multiplied. |
Returns sum of the current vector and the specified vector.
Returns difference between the current vector and the specified vector.
Returns a copy of the specified 3D vector.
v | Vector whose copy is returned. |
Negates the specified vector and stores its copy in the resulting vector.
v | Vectr to be negated. |
res | Vector where the result is stored. |
Unary plus, returns the operand.
Unary negation, returns the negative operand.
Vector addition.
Vector subtraction.
Scalar product of two 3D vectors.
Product of a 3D vector by a scalar.
Product of a 3D vector by a scalar.
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.
name | Name of the vector to be read; it is written as orientation to the user and can be null. |
vec3 IG::Num::Vector3d::_v [private] |
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
.
i | Element 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.