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

IG::Num::vec3 Struct Reference

3D vector, struct implementation. More...

Collaboration diagram for IG::Num::vec3:

List of all members.

Public Member Functions

 vec3 (vec3 v)
 Copy constructor. Initializes components of a 3D vector with components of the specified vector.
 vec3 (double x, double y, double z)
 Initializes components of a 3D vector with the specified values.
 vec3 (double comp)
 Initializes all component of a 3D vector with the specified value.
void Zero ()
 Sets components of the vector to 0.0.
void Set (double comp)
 Sets components of the vector to the specified value.
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 of type vec3) and has equal elements as the current vector.
vec3 Normalized ()
 Returns normalized this 3D vector.
vec3 Normalized1 ()
 Returns normalized this 3D vector in 1 norm.
vec3 Normalized2 ()
 Returns normalized this 3D vector in 2 norm.
vec3 NormalizedInfinity ()
 Returns normalized this 3D vector in infinity norm.
double ScalarProduct (vec3 v)
 Returns scalar product of the current and the specified vector.
vec3 VectorProduct (vec3 v)
 Returns vector product of the current and the specified vector.
vec3 CrossProduct (vec3 v)
 Returns vector product of the current and the specified vector.
vec3 Cross (vec3 v)
 Returns vector product of the current and the specified vector.
mat3 DyadicProduct (vec3 v)
 Returns dyadic product of the current and the specified vector.
double MixedProduct (vec3 b, vec3 c)
 Returns mixed product of the current and two other specified vectors. This equals the volume of the parallelepiped spanned by these vectors.
vec3 Multiply (double k)
 Returns the current vector multiplied by the specified scalar.
vec3 Add (vec3 a)
 Returns sum of the current vector and the specified vector.
vec3 Subtract (vec3 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 vec3 Copy (vec3 v)
 Returns a copy of the specified 3D vector.
static void Negate (vec3 v, ref vec3 res)
 Negates the specified vector and stores its copy in the resulting vector.
static vec3 operator+ (vec3 v)
 Unary plus, returns the operand.
static vec3 operator- (vec3 v)
 Unary negation, returns the negative operand.
static vec3 operator+ (vec3 a, vec3 b)
 Vector addition.
static vec3 operator- (vec3 a, vec3 b)
 Vector subtraction.
static double operator* (vec3 a, vec3 b)
 Scalar product of two 3D vectors.
static vec3 operator* (vec3 a, double b)
 Product of a 3D vector by a scalar.
static vec3 operator* (double a, vec3 b)
 Product of a 3D vector by a scalar.
static vec3 operator/ (vec3 a, double b)
 Vector subtraction.
static bool operator== (vec3 a, vec3 b)
 Vector comparison.
static bool operator!= (vec3 a, vec3 b)
 Vector comparison, returns true if vectors are different.

Public Attributes

double x
double y
double z

Properties

double this [int i] [get, set]
 Index operator.
double Norm [get]
 Gets a 2 norm of the current 3D vector.
double Norm2 [get]
 Gets a 2 norm of the current 3D vector.
double Norm1 [get]
 Gets an 1 norm of the current 3D vector - sum of absolute values of components.
double NormInf [get]
 Gets an infinity norm of the current 3D vector - maximal absolute component value.

Detailed Description

3D vector, struct implementation.

Name of this struct is not in line with conventions. This is intentional in order to prevent mistaking struct implementation for class interpretation. $A Igor Jul08; Oct10;


Constructor & Destructor Documentation

IG::Num::vec3::vec3 ( vec3  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::vec3::vec3 ( 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::vec3::vec3 ( double  comp) [inline]

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

Parameters:
compValue assigned to all vector components.

Member Function Documentation

void IG::Num::vec3::Zero ( ) [inline]

Sets components of the vector to 0.0.

void IG::Num::vec3::Set ( double  comp) [inline]

Sets components of the vector to the specified value.

override int IG::Num::vec3::GetHashCode ( ) [inline]

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

This method should be consistent with the VectorBase.GetHashCode method, which is standard for implementations of the IVector interface.

Two vectors that have equal all 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.

override bool IG::Num::vec3::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 of type vec3) and has equal elements as the current vector.

Overrides the object.Equals method.

vec3 IG::Num::vec3::Normalized ( ) [inline]

Returns normalized this 3D vector.

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

Returns normalized this 3D vector in 1 norm.

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

Returns normalized this 3D vector in 2 norm.

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

Returns normalized this 3D vector in infinity norm.

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

Returns scalar product of the current and the specified vector.

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

Returns vector product of the current and the specified vector.

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

Returns vector product of the current and the specified vector.

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

Returns vector product of the current and the specified vector.

mat3 IG::Num::vec3::DyadicProduct ( vec3  v) [inline]

Returns dyadic product of the current and the specified vector.

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

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

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

Returns the current vector multiplied by the specified scalar.

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

Returns sum of the current vector and the specified vector.

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

Returns difference between the current vector and the specified vector.

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

Returns a copy of the specified 3D vector.

Parameters:
vVector whose copy is returned.
static void IG::Num::vec3::Negate ( vec3  v,
ref vec3  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 vec3 IG::Num::vec3::operator+ ( vec3  v) [inline, static]

Unary plus, returns the operand.

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

Unary negation, returns the negative operand.

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

Vector addition.

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

Vector subtraction.

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

Scalar product of two 3D vectors.

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

Product of a 3D vector by a scalar.

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

Product of a 3D vector by a scalar.

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

Vector subtraction.

static bool IG::Num::vec3::operator== ( vec3  a,
vec3  b 
) [inline, static]

Vector comparison.

static bool IG::Num::vec3::operator!= ( vec3  a,
vec3  b 
) [inline, static]

Vector comparison, returns true if vectors are different.

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

Returns string representation of the 3D vector.

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

Reads 3D vector components from a console.

void IG::Num::vec3::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

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

Index operator.

Parameters:
iComponent index.
Returns:
The specified component of a 3D vector.
double IG::Num::vec3::Norm [get]

Gets a 2 norm of the current 3D vector.

double IG::Num::vec3::Norm2 [get]

Gets a 2 norm of the current 3D vector.

double IG::Num::vec3::Norm1 [get]

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

double IG::Num::vec3::NormInf [get]

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


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