public static Extents3D GetExtentsOfPointArray(Vector3[] points, Vector3 axisX, Vector3 axisY, Vector3 axisZ, Vector3 origin) { var min = new Vector3(float.PositiveInfinity, float.PositiveInfinity, float.PositiveInfinity); var max = new Vector3(float.NegativeInfinity, float.NegativeInfinity, float.NegativeInfinity); for (var i = 0; i < points.Length; i++) { var distance = SnappingUtility.WorldPointToDistances(points[i], axisX, axisY, axisZ, origin); min.x = Mathf.Min(min.x, distance.x); min.y = Mathf.Min(min.y, distance.y); min.z = Mathf.Min(min.z, distance.z); max.x = Mathf.Max(max.x, distance.x); max.y = Mathf.Max(max.y, distance.y); max.z = Mathf.Max(max.z, distance.z); } return(new Extents3D(min, max)); }
public static Extents3D CreateExtent(Vector3 point, Vector3 axisX, Vector3 axisY, Vector3 axisZ, Vector3 origin) { var distance = SnappingUtility.WorldPointToDistances(point, axisX, axisY, axisZ, origin); return(new Extents3D(distance, distance)); }