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 @@ -513,6 +513,31 @@ public static Vector3 Negate(Vector3 value)
513513 return new Vector3 ( - value . X , - value . Y , - value . Z ) ;
514514 }
515515
516+ /// <summary>
517+ /// Returns per component absolute value of a vector
518+ /// </summary>
519+ /// <param name="value">Input vector</param>
520+ /// <param name="result">When the method completes, contains a vector with each component being the absolute value of the input component</param>
521+ public static void Abs ( ref Vector3 value , out Vector3 result )
522+ {
523+ result = new Vector3 ( value . X > 0.0f ? value . X : - value . X ,
524+ value . Y > 0.0f ? value . Y : - value . Y ,
525+ value . Z > 0.0f ? value . Z : - value . Z ) ;
526+ }
527+
528+ /// <summary>
529+ /// Returns per component absolute value of a vector
530+ /// </summary>
531+ /// <param name="value">Input vector</param>
532+ /// <returns>A vector with each component being the absolute value of the input component</returns>
533+ public static Vector3 Abs ( Vector3 value )
534+ {
535+ return new Vector3 (
536+ value . X > 0.0f ? value . X : - value . X ,
537+ value . Y > 0.0f ? value . Y : - value . Y ,
538+ value . Z > 0.0f ? value . Z : - value . Z ) ;
539+ }
540+
516541 /// <summary>
517542 /// Returns a <see cref="Vector3"/> containing the 3D Cartesian coordinates of a point specified in Barycentric coordinates relative to a 3D triangle.
518543 /// </summary>
You can’t perform that action at this time.
0 commit comments