IGLib  1.7.2
The IGLib base library for development of numerical, technical and business applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
IG.Num.vec2 Struct Reference

2D vector, struct implementation. More...

Public Member Functions

 vec2 (vec2 v)
 Copy constructor. Initializes components of a 2D vector with components of the specified vector. More...
 
 vec2 (double x, double y)
 Initializes components of a 2D vector with the specified values. More...
 
 vec2 (double comp)
 Initializes all component of a 2D vector with the specified value. More...
 
void Zero ()
 Sets components of the vector to 0.0. More...
 
void Set (double comp)
 Sets components of the vector to the specified value. More...
 
override int GetHashCode ()
 Returns the hashRet code (hashRet function) of the current vector. More...
 
override bool Equals (Object obj)
 Returns a value indicating whether the specified object is equal to the current vector. More...
 
vec2 Normalized ()
 Returns normalized this 2D vector. More...
 
vec2 Normalized1 ()
 Returns normalized this 2D vector in 1 norm. More...
 
vec2 Normalized2 ()
 Returns normalized this 2D vector in 2 norm. More...
 
vec2 NormalizedInfinity ()
 Returns normalized this 2D vector in infinity norm. More...
 
double ScalarProduct (vec2 v)
 Returns scalar product of the current and the specified vector. More...
 
vec3 VectorProduct (vec2 v)
 Returns vector product of the current and the specified vector. More...
 
vec3 CrossProduct (vec2 v)
 Returns vector product of the current and the specified vector. More...
 
vec3 Cross (vec2 v)
 Returns vector product of the current and the specified vector. More...
 
mat2 DyadicProduct (vec2 v)
 Returns dyadic product of the current and the specified vector. More...
 
vec2 Multiply (double k)
 Returns the current vector multiplied by the specified scalar. More...
 
vec2 Add (vec2 a)
 Returns sum of the current vector and the specified vector. More...
 
vec2 Subtract (vec2 a)
 Returns difference between the current vector and the specified vector. More...
 
override string ToString ()
 Returns string representation of the 2D vector. More...
 
void Read ()
 Reads 2D vector components from a console. More...
 
void Read (string name)
 Reads 2D vector components from a console. More...
 

Static Public Member Functions

static vec2 Copy (vec2 v)
 Returns a copy of the specified 2D vector. More...
 
static void Negate (vec2 v, ref vec2 res)
 Negates the specified vector and stores its copy in the resulting vector. More...
 
static vec2 operator+ (vec2 v)
 Unary plus, returns the operand. More...
 
static vec2 operator- (vec2 v)
 Unary negation, returns the negative operand. More...
 
static vec2 operator+ (vec2 a, vec2 b)
 Vector addition. More...
 
static vec2 operator- (vec2 a, vec2 b)
 Vector subtraction. More...
 
static double operator* (vec2 a, vec2 b)
 Scalar product of two 2D vectors. More...
 
static vec2 operator* (vec2 a, double b)
 Product of a 2D vector by a scalar. More...
 
static vec2 operator* (double a, vec2 b)
 Product of a 2D vector by a scalar. More...
 
static vec2 operator/ (vec2 a, double b)
 Vector subtraction. More...
 
static bool operator== (vec2 a, vec2 b)
 Vector comparison. More...
 
static bool operator!= (vec2 a, vec2 b)
 Vector comparison, returns true if vectors are different. More...
 

Public Attributes

double x
 
double y
 

Properties

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

Detailed Description

2D 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.vec2.vec2 ( vec2  v)
inline

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

Parameters
vVectr whose components are copied to the initialized vector.

References IG.Num.vec2.x, and IG.Num.vec2.y.

IG.Num.vec2.vec2 ( double  x,
double  y 
)
inline

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

Parameters
xValue assigned to the first component.
yValue assigned to the second component.
IG.Num.vec2.vec2 ( double  comp)
inline

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

Parameters
compValue assigned to all vector components.

Member Function Documentation

void IG.Num.vec2.Zero ( )
inline

Sets components of the vector to 0.0.

void IG.Num.vec2.Set ( double  comp)
inline

Sets components of the vector to the specified value.

override int IG.Num.vec2.GetHashCode ( )
inline

Returns the hashRet code (hashRet 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 hashRet codes.

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

Overrides the object.GetHashCode method.

override bool IG.Num.vec2.Equals ( Object  obj)
inline

Returns a value indicating whether the specified object is equal to the current vector.

True is returned if the object of type vec2) and has equal elements as the current vector.

Overrides the object.Equals(object) method.

vec2 IG.Num.vec2.Normalized ( )
inline

Returns normalized this 2D vector.

vec2 IG.Num.vec2.Normalized1 ( )
inline

Returns normalized this 2D vector in 1 norm.

vec2 IG.Num.vec2.Normalized2 ( )
inline

Returns normalized this 2D vector in 2 norm.

vec2 IG.Num.vec2.NormalizedInfinity ( )
inline

Returns normalized this 2D vector in infinity norm.

double IG.Num.vec2.ScalarProduct ( vec2  v)
inline

Returns scalar product of the current and the specified vector.

References IG.Num.vec2.x, and IG.Num.vec2.y.

Referenced by IG.Num.vec2.operator*().

vec3 IG.Num.vec2.VectorProduct ( vec2  v)
inline

Returns vector product of the current and the specified vector.

References IG.Num.vec2.x, and IG.Num.vec2.y.

vec3 IG.Num.vec2.CrossProduct ( vec2  v)
inline

Returns vector product of the current and the specified vector.

vec3 IG.Num.vec2.Cross ( vec2  v)
inline

Returns vector product of the current and the specified vector.

mat2 IG.Num.vec2.DyadicProduct ( vec2  v)
inline

Returns dyadic product of the current and the specified vector.

References IG.Num.vec2.x, and IG.Num.vec2.y.

vec2 IG.Num.vec2.Multiply ( double  k)
inline

Returns the current vector multiplied by the specified scalar.

Parameters
kFactor by which the current vector is multiplied.

Referenced by IG.Num.vec2.operator*().

vec2 IG.Num.vec2.Add ( vec2  a)
inline

Returns sum of the current vector and the specified vector.

References IG.Num.vec2.x, and IG.Num.vec2.y.

Referenced by IG.Num.vec2.operator+(), and IG.Gr.PlotZedgraphCurve.Update().

vec2 IG.Num.vec2.Subtract ( vec2  a)
inline

Returns difference between the current vector and the specified vector.

References IG.Num.vec2.x, and IG.Num.vec2.y.

Referenced by IG.Num.vec2.operator-().

static vec2 IG.Num.vec2.Copy ( vec2  v)
inlinestatic

Returns a copy of the specified 2D vector.

Parameters
vVector whose copy is returned.

Referenced by IG.Num.vec2.operator+().

static void IG.Num.vec2.Negate ( vec2  v,
ref vec2  res 
)
inlinestatic

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

Parameters
vVectr to be negated.
resVector where the result is stored.

References IG.Num.vec2.x, and IG.Num.vec2.y.

static vec2 IG.Num.vec2.operator+ ( vec2  v)
inlinestatic

Unary plus, returns the operand.

References IG.Num.vec2.Copy().

static vec2 IG.Num.vec2.operator- ( vec2  v)
inlinestatic

Unary negation, returns the negative operand.

References IG.Num.vec2.x, and IG.Num.vec2.y.

static vec2 IG.Num.vec2.operator+ ( vec2  a,
vec2  b 
)
inlinestatic

Vector addition.

References IG.Num.vec2.Add().

static vec2 IG.Num.vec2.operator- ( vec2  a,
vec2  b 
)
inlinestatic

Vector subtraction.

References IG.Num.vec2.Subtract().

static double IG.Num.vec2.operator* ( vec2  a,
vec2  b 
)
inlinestatic

Scalar product of two 2D vectors.

References IG.Num.vec2.ScalarProduct().

static vec2 IG.Num.vec2.operator* ( vec2  a,
double  b 
)
inlinestatic

Product of a 2D vector by a scalar.

References IG.Num.vec2.Multiply().

static vec2 IG.Num.vec2.operator* ( double  a,
vec2  b 
)
inlinestatic

Product of a 2D vector by a scalar.

References IG.Num.vec2.Multiply().

static vec2 IG.Num.vec2.operator/ ( vec2  a,
double  b 
)
inlinestatic

Vector subtraction.

References IG.Num.vec2.x, and IG.Num.vec2.y.

static bool IG.Num.vec2.operator== ( vec2  a,
vec2  b 
)
inlinestatic

Vector comparison.

References IG.Num.vec2.x, and IG.Num.vec2.y.

static bool IG.Num.vec2.operator!= ( vec2  a,
vec2  b 
)
inlinestatic

Vector comparison, returns true if vectors are different.

References IG.Num.vec2.x, and IG.Num.vec2.y.

override string IG.Num.vec2.ToString ( )
inline

Returns string representation of the 2D vector.

void IG.Num.vec2.Read ( )
inline

Reads 2D vector components from a console.

Referenced by IG.Num.mat2.Example().

void IG.Num.vec2.Read ( string  name)
inline

Reads 2D 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.

References IG.Lib.UtilConsole.Read().

Member Data Documentation

Property Documentation

double IG.Num.vec2.this[int i]
getset

Index operator.

Parameters
iComponent index.
Returns
The specified component of a 2D vector.
double IG.Num.vec2.Norm
get

Gets a 2 norm of the current 2D vector.

double IG.Num.vec2.Norm2
get

Gets a 2 norm of the current 2D vector.

double IG.Num.vec2.Norm1
get

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

double IG.Num.vec2.NormInf
get

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


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