IGLib
1.7.2
The IGLib base library for development of numerical, technical and business applications.
|
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... | |
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;
|
inline |
Copy constructor. Initializes components of a 2D vector with components of the specified vector.
v | Vectr whose components are copied to the initialized vector. |
References IG.Num.vec2.x, and IG.Num.vec2.y.
|
inline |
Initializes components of a 2D vector with the specified values.
x | Value assigned to the first component. |
y | Value assigned to the second component. |
|
inline |
Initializes all component of a 2D vector with the specified value.
comp | Value assigned to all vector components. |
|
inline |
Sets components of the vector to 0.0.
|
inline |
Sets components of the vector to the specified value.
|
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.
|
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.
|
inline |
Returns normalized this 2D vector.
|
inline |
Returns normalized this 2D vector in 1 norm.
|
inline |
Returns normalized this 2D vector in 2 norm.
|
inline |
Returns normalized this 2D vector in infinity norm.
|
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*().
Returns vector product of the current and the specified vector.
References IG.Num.vec2.x, and IG.Num.vec2.y.
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.
References IG.Num.vec2.x, and IG.Num.vec2.y.
|
inline |
Returns the current vector multiplied by the specified scalar.
k | Factor by which the current vector is multiplied. |
Referenced by IG.Num.vec2.operator*().
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().
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-().
Returns a copy of the specified 2D vector.
v | Vector whose copy is returned. |
Referenced by IG.Num.vec2.operator+().
Negates the specified vector and stores its copy in the resulting vector.
v | Vectr to be negated. |
res | Vector where the result is stored. |
References IG.Num.vec2.x, and IG.Num.vec2.y.
Unary plus, returns the operand.
References IG.Num.vec2.Copy().
Unary negation, returns the negative operand.
References IG.Num.vec2.x, and IG.Num.vec2.y.
Vector addition.
References IG.Num.vec2.Add().
Vector subtraction.
References IG.Num.vec2.Subtract().
Scalar product of two 2D vectors.
References IG.Num.vec2.ScalarProduct().
Product of a 2D vector by a scalar.
References IG.Num.vec2.Multiply().
Product of a 2D vector by a scalar.
References IG.Num.vec2.Multiply().
Vector subtraction.
References IG.Num.vec2.x, and IG.Num.vec2.y.
Vector comparison.
References IG.Num.vec2.x, and IG.Num.vec2.y.
Vector comparison, returns true if vectors are different.
References IG.Num.vec2.x, and IG.Num.vec2.y.
|
inline |
Returns string representation of the 2D vector.
|
inline |
Reads 2D vector components from a console.
Referenced by IG.Num.mat2.Example().
|
inline |
Reads 2D 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. |
References IG.Lib.UtilConsole.Read().
double IG.Num.vec2.x |
Referenced by IG.Num.vec2.Add(), IG.Num.vec2.DyadicProduct(), IG.Num.Func2dBase.Gradient(), IG.Num.Func2dVectorFormBase.Gradient(), IG.Num.Func2dBasePlain_ToConsider.Gradient(), IG.Num.Func3d2dBase.Gradient1(), IG.Num.Func3d2dBase.Gradient2(), IG.Num.Func3d2dBase.Gradient3(), IG.Num.Func2dBase.Hessian(), IG.Num.Func2dBasePlain_ToConsider.Hessian(), IG.Num.Func3d2dBase.Hessian1(), IG.Num.Func3d2dBase.Hessian2(), IG.Num.Func3d2dBase.Hessian3(), IG.Num.Field< TElement >.MapCoordinates1dPlain(), IG.Num.mat2.mat2(), IG.Num.mat2.Multiply(), IG.Num.vec2.Negate(), IG.Num.vec2.operator!=(), IG.Num.vec2.operator-(), IG.Num.vec2.operator/(), IG.Num.vec2.operator==(), IG.Num.vec2.ScalarProduct(), IG.Forms.WindowPositioner.SetToCurrentPosition(), IG.Num.vec2.Subtract(), IG.Forms.WindowShiftControlNumeric.txtWindowShiftRelX_Validated(), IG.Forms.WindowShiftControlText.txtWindowShiftRelX_Validated(), IG.Gr.PlotZedgraphCurve.Update(), IG.Num.BoundingBox2d.Update(), IG.Num.Field< TElement >.UpdateBounds(), IG.Num.Func2dBase.Value(), IG.Num.Func2dBasePlain_ToConsider.Value(), IG.Num.Func3d2dBase.Value1(), IG.Num.Func3d2dBase.Value2(), IG.Num.Func3d2dBase.Value3(), IG.Num.vec2.vec2(), IG.Num.Vector2d.Vector2d(), and IG.Num.vec2.VectorProduct().
double IG.Num.vec2.y |
Referenced by IG.Num.vec2.Add(), IG.Num.vec2.DyadicProduct(), IG.Num.Func2dBase.Gradient(), IG.Num.Func2dVectorFormBase.Gradient(), IG.Num.Func2dBasePlain_ToConsider.Gradient(), IG.Num.Func3d2dBase.Gradient1(), IG.Num.Func3d2dBase.Gradient2(), IG.Num.Func3d2dBase.Gradient3(), IG.Num.Func2dBase.Hessian(), IG.Num.Func2dBasePlain_ToConsider.Hessian(), IG.Num.Func3d2dBase.Hessian1(), IG.Num.Func3d2dBase.Hessian2(), IG.Num.Func3d2dBase.Hessian3(), IG.Num.mat2.mat2(), IG.Num.mat2.Multiply(), IG.Num.vec2.Negate(), IG.Num.vec2.operator!=(), IG.Num.vec2.operator-(), IG.Num.vec2.operator/(), IG.Num.vec2.operator==(), IG.Num.vec2.ScalarProduct(), IG.Forms.WindowPositioner.SetToCurrentPosition(), IG.Num.vec2.Subtract(), IG.Forms.WindowShiftControlNumeric.txtWindowShiftRelY_Validated(), IG.Forms.WindowShiftControlText.txtWindowShiftRelY_Validated(), IG.Gr.PlotZedgraphCurve.Update(), IG.Num.BoundingBox2d.Update(), IG.Num.Field< TElement >.UpdateBounds(), IG.Num.Func2dBase.Value(), IG.Num.Func2dBasePlain_ToConsider.Value(), IG.Num.Func3d2dBase.Value1(), IG.Num.Func3d2dBase.Value2(), IG.Num.Func3d2dBase.Value3(), IG.Num.vec2.vec2(), IG.Num.Vector2d.Vector2d(), and IG.Num.vec2.VectorProduct().
|
getset |
Index operator.
i | Component index. |
|
get |
Gets a 2 norm of the current 2D vector.
|
get |
Gets a 2 norm of the current 2D vector.
|
get |
Gets an 1 norm of the current 2D vector - sum of absolute values of components.
|
get |
Gets an infinity norm of the current 2D vector - maximal absolute component value.