2 * Copyright (c) 2007-2010 SlimDX Group
\r
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
\r
5 * of this software and associated documentation files (the "Software"), to deal
\r
6 * in the Software without restriction, including without limitation the rights
\r
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
\r
8 * copies of the Software, and to permit persons to whom the Software is
\r
9 * furnished to do so, subject to the following conditions:
\r
11 * The above copyright notice and this permission notice shall be included in
\r
12 * all copies or substantial portions of the Software.
\r
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
\r
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
\r
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
\r
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
\r
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
\r
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
\r
24 #include "../design/Vector2Converter.h"
\r
26 #include "Vector4.h"
\r
28 using System::Runtime::InteropServices::OutAttribute;
\r
32 value class Quaternion;
\r
34 value class Vector3;
\r
35 value class Viewport;
\r
38 /// Defines a two component vector.
\r
40 /// <unmanaged>D3DXVECTOR2</unmanaged>
\r
41 [System::Serializable]
\r
42 [System::Runtime::InteropServices::StructLayout( System::Runtime::InteropServices::LayoutKind::Sequential, Pack = 4 )]
\r
43 [System::ComponentModel::TypeConverter( SlimDX::Design::Vector2Converter::typeid )]
\r
44 public value class Vector2 : System::IEquatable<Vector2>
\r
48 /// Gets or sets the X component of the vector.
\r
50 /// <value>The X component of the vector.</value>
\r
54 /// Gets or sets the Y component of the vector.
\r
56 /// <value>The Y component of the vector.</value>
\r
59 property float default[int]
\r
61 float get( int index );
\r
62 void set( int index, float value );
\r
66 /// Gets a <see cref="Vector2"/> with all of its components set to zero.
\r
68 /// <value>A <see cref="Vector2"/> that has all of its components set to zero.</value>
\r
69 static property Vector2 Zero { Vector2 get() { return Vector2(0, 0); } }
\r
72 /// Gets the X unit <see cref="Vector2"/> (1, 0).
\r
74 /// <value>A <see cref="Vector2"/> that has a value of (1, 0).</value>
\r
75 static property Vector2 UnitX { Vector2 get() { return Vector2(1, 0); } }
\r
78 /// Gets the Y unit <see cref="Vector2"/> (0, 1).
\r
80 /// <value>A <see cref="Vector2"/> that has a value of (0, 1).</value>
\r
81 static property Vector2 UnitY { Vector2 get() { return Vector2(0, 1); } }
\r
84 /// Gets the size of the <see cref="Vector2"/> type, in bytes.
\r
86 static property int SizeInBytes { int get() { return System::Runtime::InteropServices::Marshal::SizeOf(Vector2::typeid); } }
\r
89 /// Initializes a new instance of the <see cref="Vector2"/> class.
\r
91 /// <param name="value">The value that will be assigned to all components.</param>
\r
92 Vector2( float value );
\r
95 /// Initializes a new instance of the <see cref="Vector2"/> class.
\r
97 /// <param name="x">Initial value for the X component of the vector.</param>
\r
98 /// <param name="y">Initial value for the Y component of the vector.</param>
\r
99 Vector2( float x, float y );
\r
102 /// Calculates the length of the vector.
\r
104 /// <returns>The length of the vector.</returns>
\r
108 /// Calculates the squared length of the vector.
\r
110 /// <returns>The squared length of the vector.</returns>
\r
111 float LengthSquared();
\r
114 /// Converts the vector into a unit vector.
\r
119 /// Adds two vectors.
\r
121 /// <param name="left">The first vector to add.</param>
\r
122 /// <param name="right">The second vector to add.</param>
\r
123 /// <returns>The sum of the two vectors.</returns>
\r
124 static Vector2 Add( Vector2 left, Vector2 right );
\r
127 /// Adds two vectors.
\r
129 /// <param name="left">The first vector to add.</param>
\r
130 /// <param name="right">The second vector to add.</param>
\r
131 /// <param name="result">When the method completes, contains the sum of the two vectors.</param>
\r
132 static void Add( Vector2% left, Vector2% right, [Out] Vector2% result );
\r
135 /// Subtracts two vectors.
\r
137 /// <param name="left">The first vector to subtract.</param>
\r
138 /// <param name="right">The second vector to subtract.</param>
\r
139 /// <returns>The difference of the two vectors.</returns>
\r
140 static Vector2 Subtract( Vector2 left, Vector2 right );
\r
143 /// Subtracts two vectors.
\r
145 /// <param name="left">The first vector to subtract.</param>
\r
146 /// <param name="right">The second vector to subtract.</param>
\r
147 /// <param name="result">When the method completes, contains the difference of the two vectors.</param>
\r
148 static void Subtract( Vector2% left, Vector2% right, [Out] Vector2% result );
\r
151 /// Scales a vector by the given value.
\r
153 /// <param name="value">The vector to scale.</param>
\r
154 /// <param name="scale">The amount by which to scale the vector.</param>
\r
155 /// <returns>The scaled vector.</returns>
\r
156 static Vector2 Multiply( Vector2 value, float scale );
\r
159 /// Scales a vector by the given value.
\r
161 /// <param name="vector">The vector to scale.</param>
\r
162 /// <param name="scale">The amount by which to scale the vector.</param>
\r
163 /// <param name="result">When the method completes, contains the scaled vector.</param>
\r
164 static void Multiply( Vector2% vector, float scale, [Out] Vector2% result );
\r
167 /// Modulates a vector by another.
\r
169 /// <param name="left">The first vector to modulate.</param>
\r
170 /// <param name="right">The second vector to modulate.</param>
\r
171 /// <returns>The modulated vector.</returns>
\r
172 static Vector2 Modulate( Vector2 left, Vector2 right );
\r
175 /// Modulates a vector by another.
\r
177 /// <param name="left">The first vector to modulate.</param>
\r
178 /// <param name="right">The second vector to modulate.</param>
\r
179 /// <param name="result">When the moethod completes, contains the modulated vector.</param>
\r
180 static void Modulate( Vector2% left, Vector2% right, [Out] Vector2% result );
\r
183 /// Scales a vector by the given value.
\r
185 /// <param name="value">The vector to scale.</param>
\r
186 /// <param name="scale">The amount by which to scale the vector.</param>
\r
187 /// <returns>The scaled vector.</returns>
\r
188 static Vector2 Divide( Vector2 value, float scale );
\r
191 /// Scales a vector by the given value.
\r
193 /// <param name="vector">The vector to scale.</param>
\r
194 /// <param name="scale">The amount by which to scale the vector.</param>
\r
195 /// <param name="result">When the method completes, contains the scaled vector.</param>
\r
196 static void Divide( Vector2% vector, float scale, [Out] Vector2% result );
\r
199 /// Reverses the direction of a given vector.
\r
201 /// <param name="value">The vector to negate.</param>
\r
202 /// <returns>A vector facing in the opposite direction.</returns>
\r
203 static Vector2 Negate( Vector2 value );
\r
206 /// Reverses the direction of a given vector.
\r
208 /// <param name="value">The vector to negate.</param>
\r
209 /// <param name="result">When the method completes, contains a vector facing in the opposite direction.</param>
\r
210 static void Negate( Vector2% value, [Out] Vector2% result );
\r
213 /// Returns a <see cref="Vector2"/> containing the 2D Cartesian coordinates of a point specified in Barycentric coordinates relative to a 2D triangle.
\r
215 /// <param name="value1">A <see cref="Vector2"/> containing the 2D Cartesian coordinates of vertex 1 of the triangle.</param>
\r
216 /// <param name="value2">A <see cref="Vector2"/> containing the 2D Cartesian coordinates of vertex 2 of the triangle.</param>
\r
217 /// <param name="value3">A <see cref="Vector2"/> containing the 2D Cartesian coordinates of vertex 3 of the triangle.</param>
\r
218 /// <param name="amount1">Barycentric coordinate b2, which expresses the weighting factor toward vertex 2 (specified in <paramref name="value2"/>).</param>
\r
219 /// <param name="amount2">Barycentric coordinate b3, which expresses the weighting factor toward vertex 3 (specified in <paramref name="value3"/>).</param>
\r
220 /// <returns>A new <see cref="Vector2"/> containing the 2D Cartesian coordinates of the specified point.</returns>
\r
221 static Vector2 Barycentric( Vector2 value1, Vector2 value2, Vector2 value3, float amount1, float amount2 );
\r
224 /// Returns a <see cref="Vector2"/> containing the 2D Cartesian coordinates of a point specified in Barycentric coordinates relative to a 2D triangle.
\r
226 /// <param name="value1">A <see cref="Vector2"/> containing the 2D Cartesian coordinates of vertex 1 of the triangle.</param>
\r
227 /// <param name="value2">A <see cref="Vector2"/> containing the 2D Cartesian coordinates of vertex 2 of the triangle.</param>
\r
228 /// <param name="value3">A <see cref="Vector2"/> containing the 2D Cartesian coordinates of vertex 3 of the triangle.</param>
\r
229 /// <param name="amount1">Barycentric coordinate b2, which expresses the weighting factor toward vertex 2 (specified in <paramref name="value2"/>).</param>
\r
230 /// <param name="amount2">Barycentric coordinate b3, which expresses the weighting factor toward vertex 3 (specified in <paramref name="value3"/>).</param>
\r
231 /// <param name="result">When the method completes, contains the 2D Cartesian coordinates of the specified point.</param>
\r
232 static void Barycentric( Vector2% value1, Vector2% value2, Vector2% value3, float amount1, float amount2, [Out] Vector2% result );
\r
235 /// Performs a Catmull-Rom interpolation using the specified positions.
\r
237 /// <param name="value1">The first position in the interpolation.</param>
\r
238 /// <param name="value2">The second position in the interpolation.</param>
\r
239 /// <param name="value3">The third position in the interpolation.</param>
\r
240 /// <param name="value4">The fourth position in the interpolation.</param>
\r
241 /// <param name="amount">Weighting factor.</param>
\r
242 /// <returns>A vector that is the result of the Catmull-Rom interpolation.</returns>
\r
243 static Vector2 CatmullRom( Vector2 value1, Vector2 value2, Vector2 value3, Vector2 value4, float amount );
\r
246 /// Performs a Catmull-Rom interpolation using the specified positions.
\r
248 /// <param name="value1">The first position in the interpolation.</param>
\r
249 /// <param name="value2">The second position in the interpolation.</param>
\r
250 /// <param name="value3">The third position in the interpolation.</param>
\r
251 /// <param name="value4">The fourth position in the interpolation.</param>
\r
252 /// <param name="amount">Weighting factor.</param>
\r
253 /// <param name="result">When the method completes, contains the result of the Catmull-Rom interpolation.</param>
\r
254 static void CatmullRom( Vector2% value1, Vector2% value2, Vector2% value3, Vector2% value4, float amount, [Out] Vector2% result );
\r
257 /// Restricts a value to be within a specified range.
\r
259 /// <param name="value">The value to clamp.</param>
\r
260 /// <param name="min">The minimum value.</param>
\r
261 /// <param name="max">The maximum value.</param>
\r
262 /// <returns>The clamped value.</returns>
\r
263 static Vector2 Clamp( Vector2 value, Vector2 min, Vector2 max );
\r
266 /// Restricts a value to be within a specified range.
\r
268 /// <param name="value">The value to clamp.</param>
\r
269 /// <param name="min">The minimum value.</param>
\r
270 /// <param name="max">The maximum value.</param>
\r
271 /// <param name="result">When the method completes, contains the clamped value.</param>
\r
272 static void Clamp( Vector2% value, Vector2% min, Vector2% max, [Out] Vector2% result );
\r
275 /// Performs a Hermite spline interpolation.
\r
277 /// <param name="value1">First source position vector.</param>
\r
278 /// <param name="tangent1">First source tangent vector.</param>
\r
279 /// <param name="value2">Second source position vector.</param>
\r
280 /// <param name="tangent2">Second source tangent vector.</param>
\r
281 /// <param name="amount">Weighting factor.</param>
\r
282 /// <returns>The result of the Hermite spline interpolation.</returns>
\r
283 static Vector2 Hermite( Vector2 value1, Vector2 tangent1, Vector2 value2, Vector2 tangent2, float amount );
\r
286 /// Performs a Hermite spline interpolation.
\r
288 /// <param name="value1">First source position vector.</param>
\r
289 /// <param name="tangent1">First source tangent vector.</param>
\r
290 /// <param name="value2">Second source position vector.</param>
\r
291 /// <param name="tangent2">Second source tangent vector.</param>
\r
292 /// <param name="amount">Weighting factor.</param>
\r
293 /// <param name="result">When the method completes, contains the result of the Hermite spline interpolation.</param>
\r
294 static void Hermite( Vector2% value1, Vector2% tangent1, Vector2% value2, Vector2% tangent2, float amount, [Out] Vector2% result );
\r
297 /// Performs a linear interpolation between two vectors.
\r
299 /// <param name="start">Start vector.</param>
\r
300 /// <param name="end">End vector.</param>
\r
301 /// <param name="amount">Value between 0 and 1 indicating the weight of <paramref name="end"/>.</param>
\r
302 /// <returns>The linear interpolation of the two vectors.</returns>
\r
304 /// This method performs the linear interpolation based on the following formula.
\r
305 /// <code>start + (end - start) * amount</code>
\r
306 /// Passing <paramref name="amount"/> a value of 0 will cause <paramref name="start"/> to be returned; a value of 1 will cause <paramref name="end"/> to be returned.
\r
308 static Vector2 Lerp( Vector2 start, Vector2 end, float amount );
\r
311 /// Performs a linear interpolation between two vectors.
\r
313 /// <param name="start">Start vector.</param>
\r
314 /// <param name="end">End vector.</param>
\r
315 /// <param name="amount">Value between 0 and 1 indicating the weight of <paramref name="end"/>.</param>
\r
316 /// <param name="result">When the method completes, contains the linear interpolation of the two vectors.</param>
\r
318 /// This method performs the linear interpolation based on the following formula.
\r
319 /// <code>start + (end - start) * amount</code>
\r
320 /// Passing <paramref name="amount"/> a value of 0 will cause <paramref name="start"/> to be returned; a value of 1 will cause <paramref name="end"/> to be returned.
\r
322 static void Lerp( Vector2% start, Vector2% end, float amount, [Out] Vector2% result );
\r
325 /// Performs a cubic interpolation between two vectors.
\r
327 /// <param name="start">Start vector.</param>
\r
328 /// <param name="end">End vector.</param>
\r
329 /// <param name="amount">Value between 0 and 1 indicating the weight of <paramref name="end"/>.</param>
\r
330 /// <returns>The cubic interpolation of the two vectors.</returns>
\r
331 static Vector2 SmoothStep( Vector2 start, Vector2 end, float amount );
\r
334 /// Performs a cubic interpolation between two vectors.
\r
336 /// <param name="start">Start vector.</param>
\r
337 /// <param name="end">End vector.</param>
\r
338 /// <param name="amount">Value between 0 and 1 indicating the weight of <paramref name="end"/>.</param>
\r
339 /// <param name="result">When the method completes, contains the cubic interpolation of the two vectors.</param>
\r
340 static void SmoothStep( Vector2% start, Vector2% end, float amount, [Out] Vector2% result );
\r
343 /// Calculates the distance between two vectors.
\r
345 /// <param name="value1">The first vector.</param>
\r
346 /// <param name="value2">The second vector.</param>
\r
347 /// <returns>The distance between the two vectors.</returns>
\r
348 static float Distance( Vector2 value1, Vector2 value2 );
\r
351 /// Calculates the squared distance between two vectors.
\r
353 /// <param name="value1">The first vector.</param>
\r
354 /// <param name="value2">The second vector.</param>
\r
355 /// <returns>The squared distance between the two vectors.</returns>
\r
356 /// <remarks>Distance squared is the value before taking the square root.
\r
357 /// Distance squared can often be used in place of distance if relative comparisons are being made.
\r
358 /// For example, consider three points A, B, and C. To determine whether B or C is further from A,
\r
359 /// compare the distance between A and B to the distance between A and C. Calculating the two distances
\r
360 /// involves two square roots, which are computationally expensive. However, using distance squared
\r
361 /// provides the same information and avoids calculating two square roots.
\r
363 static float DistanceSquared( Vector2 value1, Vector2 value2 );
\r
366 /// Calculates the dot product of two vectors.
\r
368 /// <param name="left">First source vector.</param>
\r
369 /// <param name="right">Second source vector.</param>
\r
370 /// <returns>The dot product of the two vectors.</returns>
\r
371 static float Dot( Vector2 left, Vector2 right );
\r
374 /// Converts the vector into a unit vector.
\r
376 /// <param name="vector">The vector to normalize.</param>
\r
377 /// <returns>The normalized vector.</returns>
\r
378 static Vector2 Normalize( Vector2 vector );
\r
381 /// Converts the vector into a unit vector.
\r
383 /// <param name="vector">The vector to normalize.</param>
\r
384 /// <param name="result">When the method completes, contains the normalized vector.</param>
\r
385 static void Normalize( Vector2% vector, [Out] Vector2% result );
\r
388 /// Transforms a 2D vector by the given <see cref="SlimDX::Matrix"/>.
\r
390 /// <param name="vector">The source vector.</param>
\r
391 /// <param name="transformation">The transformation <see cref="SlimDX::Matrix"/>.</param>
\r
392 /// <returns>The transformed <see cref="SlimDX::Vector4"/>.</returns>
\r
393 static Vector4 Transform( Vector2 vector, Matrix transformation );
\r
396 /// Transforms a 2D vector by the given <see cref="SlimDX::Matrix"/>.
\r
398 /// <param name="vector">The source vector.</param>
\r
399 /// <param name="transformation">The transformation <see cref="SlimDX::Matrix"/>.</param>
\r
400 /// <param name="result">When the method completes, contains the transformed <see cref="SlimDX::Vector4"/>.</param>
\r
401 static void Transform( Vector2% vector, Matrix% transformation, [Out] Vector4% result );
\r
404 /// Transforms an array of 2D vectors by the given <see cref="SlimDX::Matrix"/>.
\r
406 /// <param name="vectors">The source vectors.</param>
\r
407 /// <param name="transformation">The transformation <see cref="SlimDX::Matrix"/>.</param>
\r
408 /// <returns>The transformed <see cref="SlimDX::Vector4"/>s.</returns>
\r
409 static array<Vector4>^ Transform( array<Vector2>^ vectors, Matrix% transformation );
\r
412 /// Transforms a 2D vector by the given <see cref="SlimDX::Quaternion"/> rotation.
\r
414 /// <param name="vector">The vector to rotate.</param>
\r
415 /// <param name="rotation">The <see cref="SlimDX::Quaternion"/> rotation to apply.</param>
\r
416 /// <returns>The transformed <see cref="SlimDX::Vector4"/>.</returns>
\r
417 static Vector4 Transform( Vector2 vector, Quaternion rotation );
\r
420 /// Transforms a 2D vector by the given <see cref="SlimDX::Quaternion"/> rotation.
\r
422 /// <param name="vector">The vector to rotate.</param>
\r
423 /// <param name="rotation">The <see cref="SlimDX::Quaternion"/> rotation to apply.</param>
\r
424 /// <param name="result">When the method completes, contains the transformed <see cref="SlimDX::Vector4"/>.</param>
\r
425 static void Transform( Vector2% vector, Quaternion% rotation, [Out] Vector4% result );
\r
428 /// Transforms an array of 2D vectors by the given <see cref="SlimDX::Quaternion"/> rotation.
\r
430 /// <param name="vectors">The vectors to rotate.</param>
\r
431 /// <param name="rotation">The <see cref="SlimDX::Quaternion"/> rotation to apply.</param>
\r
432 /// <returns>The transformed <see cref="SlimDX::Vector4"/>.</returns>
\r
433 static array<Vector4>^ Transform( array<Vector2>^ vectors, Quaternion% rotation );
\r
436 /// Performs a coordinate transformation using the given <see cref="SlimDX::Matrix"/>.
\r
438 /// <param name="coordinate">The coordinate vector to transform.</param>
\r
439 /// <param name="transformation">The transformation <see cref="SlimDX::Matrix"/>.</param>
\r
440 /// <returns>The transformed coordinates.</returns>
\r
441 static Vector2 TransformCoordinate( Vector2 coordinate, Matrix transformation );
\r
444 /// Performs a coordinate transformation using the given <see cref="SlimDX::Matrix"/>.
\r
446 /// <param name="coordinate">The coordinate vector to transform.</param>
\r
447 /// <param name="transformation">The transformation <see cref="SlimDX::Matrix"/>.</param>
\r
448 /// <param name="result">When the method completes, contains the transformed coordinates.</param>
\r
449 static void TransformCoordinate( Vector2% coordinate, Matrix% transformation, [Out] Vector2% result );
\r
452 /// Performs a coordinate transformation using the given <see cref="SlimDX::Matrix"/>.
\r
454 /// <param name="coordinates">The coordinate vectors to transform.</param>
\r
455 /// <param name="transformation">The transformation <see cref="SlimDX::Matrix"/>.</param>
\r
456 /// <returns>The transformed coordinates.</returns>
\r
457 static array<Vector2>^ TransformCoordinate( array<Vector2>^ coordinates, Matrix% transformation );
\r
460 /// Performs a normal transformation using the given <see cref="SlimDX::Matrix"/>.
\r
462 /// <param name="normal">The normal vector to transform.</param>
\r
463 /// <param name="transformation">The transformation <see cref="SlimDX::Matrix"/>.</param>
\r
464 /// <returns>The transformed normal.</returns>
\r
465 static Vector2 TransformNormal( Vector2 normal, Matrix transformation );
\r
468 /// Performs a normal transformation using the given <see cref="SlimDX::Matrix"/>.
\r
470 /// <param name="normal">The normal vector to transform.</param>
\r
471 /// <param name="transformation">The transformation <see cref="SlimDX::Matrix"/>.</param>
\r
472 /// <param name="result">When the method completes, contains the transformed normal.</param>
\r
473 static void TransformNormal( Vector2% normal, Matrix% transformation, [Out] Vector2% result );
\r
476 /// Performs a normal transformation using the given <see cref="SlimDX::Matrix"/>.
\r
478 /// <param name="normals">The normal vectors to transform.</param>
\r
479 /// <param name="transformation">The transformation <see cref="SlimDX::Matrix"/>.</param>
\r
480 /// <returns>The transformed normals.</returns>
\r
481 static array<Vector2>^ TransformNormal( array<Vector2>^ normals, Matrix% transformation );
\r
484 /// Returns a vector containing the smallest components of the specified vectors.
\r
486 /// <param name="value1">The first source vector.</param>
\r
487 /// <param name="value2">The second source vector.</param>
\r
488 /// <returns>A vector containing the smallest components of the source vectors.</returns>
\r
489 static Vector2 Minimize( Vector2 value1, Vector2 value2 );
\r
492 /// Returns a vector containing the smallest components of the specified vectors.
\r
494 /// <param name="value1">The first source vector.</param>
\r
495 /// <param name="value2">The second source vector.</param>
\r
496 /// <param name="result">When the method completes, contains an new vector composed of the smallest components of the source vectors.</param>
\r
497 static void Minimize( Vector2% value1, Vector2% value2, [Out] Vector2% result );
\r
500 /// Returns a vector containing the largest components of the specified vectors.
\r
502 /// <param name="value1">The first source vector.</param>
\r
503 /// <param name="value2">The second source vector.</param>
\r
504 /// <returns>A vector containing the largest components of the source vectors.</returns>
\r
505 static Vector2 Maximize( Vector2 value1, Vector2 value2 );
\r
508 /// Returns a vector containing the smallest components of the specified vectors.
\r
510 /// <param name="value1">The first source vector.</param>
\r
511 /// <param name="value2">The second source vector.</param>
\r
512 /// <param name="result">When the method completes, contains an new vector composed of the largest components of the source vectors.</param>
\r
513 static void Maximize( Vector2% value1, Vector2% value2, [Out] Vector2% result );
\r
516 /// Adds two vectors.
\r
518 /// <param name="left">The first vector to add.</param>
\r
519 /// <param name="right">The second vector to add.</param>
\r
520 /// <returns>The sum of the two vectors.</returns>
\r
521 static Vector2 operator + ( Vector2 left, Vector2 right );
\r
524 /// Subtracts two vectors.
\r
526 /// <param name="left">The first vector to subtract.</param>
\r
527 /// <param name="right">The second vector to subtract.</param>
\r
528 /// <returns>The difference of the two vectors.</returns>
\r
529 static Vector2 operator - ( Vector2 left, Vector2 right );
\r
532 /// Reverses the direction of a given vector.
\r
534 /// <param name="value">The vector to negate.</param>
\r
535 /// <returns>A vector facing in the opposite direction.</returns>
\r
536 static Vector2 operator - ( Vector2 value );
\r
539 /// Scales a vector by the given value.
\r
541 /// <param name="vector">The vector to scale.</param>
\r
542 /// <param name="scale">The amount by which to scale the vector.</param>
\r
543 /// <returns>The scaled vector.</returns>
\r
544 static Vector2 operator * ( Vector2 vector, float scale );
\r
547 /// Scales a vector by the given value.
\r
549 /// <param name="vector">The vector to scale.</param>
\r
550 /// <param name="scale">The amount by which to scale the vector.</param>
\r
551 /// <returns>The scaled vector.</returns>
\r
552 static Vector2 operator * ( float scale, Vector2 vector );
\r
555 /// Scales a vector by the given value.
\r
557 /// <param name="vector">The vector to scale.</param>
\r
558 /// <param name="scale">The amount by which to scale the vector.</param>
\r
559 /// <returns>The scaled vector.</returns>
\r
560 static Vector2 operator / ( Vector2 vector, float scale );
\r
563 /// Tests for equality between two objects.
\r
565 /// <param name="left">The first value to compare.</param>
\r
566 /// <param name="right">The second value to compare.</param>
\r
567 /// <returns><c>true</c> if <paramref name="left"/> has the same value as <paramref name="right"/>; otherwise, <c>false</c>.</returns>
\r
568 static bool operator == ( Vector2 left, Vector2 right );
\r
571 /// Tests for inequality between two objects.
\r
573 /// <param name="left">The first value to compare.</param>
\r
574 /// <param name="right">The second value to compare.</param>
\r
575 /// <returns><c>true</c> if <paramref name="left"/> has a different value than <paramref name="right"/>; otherwise, <c>false</c>.</returns>
\r
576 static bool operator != ( Vector2 left, Vector2 right );
\r
579 /// Converts the value of the object to its equivalent string representation.
\r
581 /// <returns>The string representation of the value of this instance.</returns>
\r
582 virtual System::String^ ToString() override;
\r
585 /// Returns the hash code for this instance.
\r
587 /// <returns>A 32-bit signed integer hash code.</returns>
\r
588 virtual int GetHashCode() override;
\r
591 /// Returns a value that indicates whether the current instance is equal to a specified object.
\r
593 /// <param name="obj">Object to make the comparison with.</param>
\r
594 /// <returns><c>true</c> if the current instance is equal to the specified object; <c>false</c> otherwise.</returns>
\r
595 virtual bool Equals( System::Object^ obj ) override;
\r
598 /// Returns a value that indicates whether the current instance is equal to the specified object.
\r
600 /// <param name="other">Object to make the comparison with.</param>
\r
601 /// <returns><c>true</c> if the current instance is equal to the specified object; <c>false</c> otherwise.</returns>
\r
602 virtual bool Equals( Vector2 other );
\r
605 /// Determines whether the specified object instances are considered equal.
\r
607 /// <param name="value1">The first value to compare.</param>
\r
608 /// <param name="value2">The second value to compare.</param>
\r
609 /// <returns><c>true</c> if <paramref name="value1"/> is the same instance as <paramref name="value2"/> or
\r
610 /// if both are <c>null</c> references or if <c>value1.Equals(value2)</c> returns <c>true</c>; otherwise, <c>false</c>.</returns>
\r
611 static bool Equals( Vector2% value1, Vector2% value2 );
\r