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

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events
Public Member Functions | Static Public Member Functions | Public Attributes | Properties | List of all members
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 hash code (hash 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

  v | Vectr 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

  comp | Value assigned to all vector components.

IG.Num.vec2.vec2 | ( | double | comp | ) |
| inline

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

Parameters

  comp | Value 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 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.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 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

  k | Factor 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 | ) |
| inline static

Returns a copy of the specified 2D vector.

Parameters

  v | Vector whose copy is returned.

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

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

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

Parameters

  v | Vectr to be negated.
  res | Vector where the result is stored.

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

static vec2 IG.Num.vec2.operator+ | ( | vec2 | v | ) |
| inline static

Unary plus, returns the operand.

References IG.Num.vec2.Copy().

static vec2 IG.Num.vec2.operator- | ( | vec2 | v | ) |
| inline static

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
| ) |  |
| inline static

Vector addition.

References IG.Num.vec2.Add().

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

Vector subtraction.

References IG.Num.vec2.Subtract().

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

Scalar product of two 2D vectors.

References IG.Num.vec2.ScalarProduct().

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

Product of a 2D vector by a scalar.

References IG.Num.vec2.Multiply().

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

Product of a 2D vector by a scalar.

References IG.Num.vec2.Multiply().

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

Vector subtraction.

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

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

Vector comparison.

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

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

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

  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().

## Member Data Documentation

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().

## Property Documentation

double IG.Num.vec2.this[int i]
| get set

Index operator.

Parameters

  i | Component 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:

- igbase/numeric/geometry/Matrix2D.cs