The VectorN class stores "a point in n-dimensional space" - a sequence of real numbers - and defines operators for them. Based on public code from Vit Buchta, June 2007. More...
Public Member Functions | |
| VectorN (int n) | |
| A constructor. It defines a number of vector components and creates an real array with n elements. | |
| VectorN (VectorN a) | |
| A constructor which copies a given vector into itself. | |
| VectorN | Copy () |
| Copies itself into another object of VectorN type. | |
| double | Abs () |
| Absolute value. A method calculating the Euclidean norm of the vector. | |
Static Public Member Functions | |
| static VectorN | operator+ (VectorN a, VectorN b) |
| Addition of two vectors. | |
| static VectorN | operator- (VectorN a, VectorN b) |
| VectorN substraction. | |
| static VectorN | operator* (double c, VectorN a) |
| Multiplication of a vector by a real number from the left side. | |
| static VectorN | operator* (VectorN a, double c) |
| Multiplication of a vector by a real number from the right side. | |
| static VectorN | operator/ (double c, VectorN a) |
| Division operator. A real number is divided by a vector. | |
| static VectorN | operator/ (VectorN a, double c) |
| Division operator. A vector is divided by a real number. | |
Properties | |
| int | N [get] |
| Returns a number of vector components. | |
| double | this [int i] [get, set] |
| An indexer enabling to treat an object of VectorN type as an array. | |
The VectorN class stores "a point in n-dimensional space" - a sequence of real numbers - and defines operators for them. Based on public code from Vit Buchta, June 2007.
Definition at line 15 of file VectorN.cs.
| NewGamePhysics.Mathematics.VectorN.VectorN | ( | int | n | ) |
A constructor. It defines a number of vector components and creates an real array with n elements.
| n | Number of vector components |
Definition at line 32 of file VectorN.cs.
| NewGamePhysics.Mathematics.VectorN.VectorN | ( | VectorN | a | ) |
A constructor which copies a given vector into itself.
| a | A variable of VectorN type |
Definition at line 47 of file VectorN.cs.
| double NewGamePhysics.Mathematics.VectorN.Abs | ( | ) |
Absolute value. A method calculating the Euclidean norm of the vector.
Definition at line 116 of file VectorN.cs.
| VectorN NewGamePhysics.Mathematics.VectorN.Copy | ( | ) |
Copies itself into another object of VectorN type.
Definition at line 100 of file VectorN.cs.
Multiplication of a vector by a real number from the right side.
| a | A vector | |
| c | A real number |
Definition at line 196 of file VectorN.cs.
Multiplication of a vector by a real number from the left side.
| c | A real number | |
| a | A vector |
Definition at line 179 of file VectorN.cs.
Addition of two vectors.
| a | First vector | |
| b | Second vector |
Definition at line 135 of file VectorN.cs.
VectorN substraction.
| a | First vector | |
| b | Second vector |
Definition at line 157 of file VectorN.cs.
Division operator. A vector is divided by a real number.
| c | A real number. Should be different from zero. | |
| a | A vector |
Definition at line 232 of file VectorN.cs.
Division operator. A real number is divided by a vector.
| a | A vector. All components should be different from zero. | |
| c | A real number. |
Definition at line 207 of file VectorN.cs.
00208 { 00209 for (int i = 0; i < a.n; i++) 00210 { 00211 if (a[i] == 0.0) 00212 { 00213 throw new ArgumentOutOfRangeException("a", "All components must be non-zero"); 00214 } 00215 } 00216 00217 VectorN r = new VectorN(a.n); 00218 for (int i = 0; i < a.n; i++) 00219 { 00220 r.x[i] = c / a.x[i]; 00221 } 00222 00223 return r; 00224 }
int NewGamePhysics.Mathematics.VectorN.N [get] |
Returns a number of vector components.
Definition at line 61 of file VectorN.cs.
double NewGamePhysics.Mathematics.VectorN.this[int i] [get, set] |
An indexer enabling to treat an object of VectorN type as an array.
| i | Zero based index |
Definition at line 74 of file VectorN.cs.
1.6.2