Neodroid  0.2.0
Machine Learning Environment Prototyping Tool
VectorSpace.cs
Go to the documentation of this file.
1 using System.Runtime.CompilerServices;
2 using UnityEngine;
3 
4 namespace droid.Runtime.Utilities.GameObjects.BoundingBoxes.Experimental {
8  public static class VectorSpace {
15  [MethodImpl(MethodImplOptions.AggressiveInlining)]
16  public static void GetMinMax(this Vector2 point, ref Vector2 min, ref Vector2 max) {
17  min = new Vector2(min.x >= point.x ? point.x : min.x, min.y >= point.y ? point.y : min.y);
18  max = new Vector2(max.x <= point.x ? point.x : max.x, max.y <= point.y ? point.y : max.y);
19  }
20 
27  [MethodImpl(MethodImplOptions.AggressiveInlining)]
28  public static void GetMinMax(this Vector3 point, ref Vector3 min, ref Vector3 max) {
29  min = new Vector3(min.x >= point.x ? point.x : min.x,
30  min.y >= point.y ? point.y : min.y,
31  min.z >= point.z ? point.z : min.z);
32  max = new Vector3(max.x <= point.x ? point.x : max.x,
33  max.y <= point.y ? point.y : max.y,
34  max.z <= point.z ? point.z : max.z);
35  }
36  }
37 }