This repository was archived by the owner on Mar 30, 2019. It is now read-only.
File tree Expand file tree Collapse file tree
Source/SharpDX.Mathematics Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -444,6 +444,29 @@ public static Vector2 Negate(Vector2 value)
444444 return new Vector2 ( - value . X , - value . Y ) ;
445445 }
446446
447+ /// <summary>
448+ /// Returns per component absolute value of a vector
449+ /// </summary>
450+ /// <param name="value">Input vector</param>
451+ /// <param name="result">When the method completes, contains a vector with each component being the absolute value of the input component</param>
452+ public static void Abs ( ref Vector2 value , out Vector2 result )
453+ {
454+ result = new Vector2 ( value . X > 0.0f ? value . X : - value . X ,
455+ value . Y > 0.0f ? value . Y : - value . Y ) ;
456+ }
457+
458+ /// <summary>
459+ /// Returns per component absolute value of a vector
460+ /// </summary>
461+ /// <param name="value">Input vector</param>
462+ /// <returns>A vector with each component being the absolute value of the input component</returns>
463+ public static Vector2 Abs ( Vector2 value )
464+ {
465+ return new Vector2 (
466+ value . X > 0.0f ? value . X : - value . X ,
467+ value . Y > 0.0f ? value . Y : - value . Y ) ;
468+ }
469+
447470 /// <summary>
448471 /// Returns a <see cref="Vector2"/> containing the 2D Cartesian coordinates of a point specified in Barycentric coordinates relative to a 2D triangle.
449472 /// </summary>
You can’t perform that action at this time.
0 commit comments