Jypeli 10
The simple game programming library
Interfaces.cs
Siirry tämän tiedoston dokumentaatioon.
1#region MIT License
2/*
3 * Copyright (c) 2005-2008 Jonathan Mark Porter. http://physics2d.googlepages.com/
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights to
8 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 * the Software, and to permit persons to whom the Software is furnished to do so,
10 * subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be
13 * included in all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
16 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
17 * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22#endregion
23
24
25
26
27#if UseDouble
28using Scalar = System.Double;
29#else
30using Scalar = System.Single;
31#endif
32using System;
33
34namespace AdvanceMath
35{
36 public interface IAdvanceValueType
37 {
41 int Count { get;}
42#if UNSAFE
48 Scalar this[int index] { get;set;}
49#endif
60 void CopyTo(Scalar[] array, int index);
66 void CopyFrom(Scalar[] array, int index);
72 string ToString(string format);
73 }
74 public interface IVector<V> : IAdvanceValueType, IEquatable<V>
75 where V : struct, IVector<V>
76 {
81 Scalar Magnitude { get;set;}
91 V Normalized { get;}
92 }
93 public interface IMatrix : IAdvanceValueType
94 {
98 int RowCount { get;}
102 int ColumnCount { get;}
103#if UNSAFE
110 Scalar this[int row, int column] { get;set;}
111#endif
131 void CopyTransposedTo(Scalar[] array, int index);
137 void CopyTransposedFrom(Scalar[] array, int index);
143 }
144
145 public interface IMatrix<M, VC, VR> : IMatrix, IAdvanceValueType, IEquatable<M>
146 where M : struct, IMatrix<M, VC, VR>
147 where VC : struct, IVector<VC>
148 where VR : struct, IVector<VR>
149 {
155 VC GetColumn(int columnIndex);
161 void SetColumn(int columnIndex, VC value);
167 VR GetRow(int rowIndex);
173 void SetRow(int rowIndex, VR value);
178 M Inverted { get;}
183 M Transposed { get;}
188 M Adjoint { get;}
192 M Cofactor { get;}
193 }
194
195
196
197}
System.Single Scalar
Definition: Clamped.cs:29
void CopyFrom(Scalar[] array, int index)
Copies all the elements of the IAdvanceValueType, of the specified one-dimensional Array to the IAdva...
Scalar[] ToArray()
Copies the elements of the IAdvanceValueType to a new array of Scalar .
void CopyTo(Scalar[] array, int index)
Copies all the elements of the IAdvanceValueType to the specified one-dimensional Array of Scalar.
int Count
Gets a 32-bit integer that represents the total number of elements in all the dimensions of IAdvanceV...
Definition: Interfaces.cs:41
string ToString(string format)
turns the object into a string representation of itself with a special format for each Scaler in it.
void CopyTransposedFrom(Scalar[] array, int index)
Copies all the elements, in a Transposed order, up to the IAdvanceValueType.Count of the IAdvanceValu...
M Cofactor
Gets the Cofactor (The Transpose of the Adjoint) of the IMatrix
Definition: Interfaces.cs:192
M Adjoint
Gets the Adjoint (Conjugate Transpose) of the IMatrix
Definition: Interfaces.cs:188
Scalar Determinant
Gets the Determinant of the IMatrix
Definition: Interfaces.cs:142
void SetColumn(int columnIndex, VC value)
Sets the VC at the specified Column.
Scalar[] ToTransposedArray()
Copies the elements, in a Transposed order, of the IMatrix to a new array of Scalar.
M Inverted
Gets the Inverse of the IMatrix
Definition: Interfaces.cs:178
Scalar[,] ToMatrixArray()
Copies the elements of the IMatrix to a new 2-dimensional array of Scalars.
int RowCount
Gets a 32-bit integer that represents the total number of Rows in the IMatrix.
Definition: Interfaces.cs:98
VC GetColumn(int columnIndex)
Gets the VC at the specified Column.
M Transposed
Gets the Transpose of the IMatrix
Definition: Interfaces.cs:183
int ColumnCount
Gets a 32-bit integer that represents the total number of Columns in the IMatrix.
Definition: Interfaces.cs:102
void SetRow(int rowIndex, VR value)
Sets the VR at the specified Row.
void CopyTransposedTo(Scalar[] array, int index)
Copies all the elements, in a Transposed order, of the IAdvanceValueType to the specified one-dimensi...
VR GetRow(int rowIndex)
Gets the VR at the specified Row.
Scalar Magnitude
Gets or Sets the Magnitude (Length of a Vector).
Definition: Interfaces.cs:81
V Normalized
Gets the Normalized Vector. (Unit Vector)
Definition: Interfaces.cs:91
Scalar MagnitudeSq
Gets the Squared Magnitude (IE Magnitude*Magnitude).
Definition: Interfaces.cs:86