public void UpdateBounds() { if (position == null || position.Count == 0) { Bound = new BoundingBox(); BoundingSphere = new BoundingSphere(); } else { Bound = BoundingBoxExtensions.FromPoints(Positions); BoundingSphere = BoundingSphereExtensions.FromPoints(Positions); } if (Bound.Maximum.IsUndefined() || Bound.Minimum.IsUndefined() || BoundingSphere.Center.IsUndefined()) { throw new Exception("Position vertex contains invalid value(Example: Float.NaN)."); } }
/// <summary> /// Returns a line geometry of the axis-aligned bounding-box of the given mesh. /// </summary> /// <param name="mesh">Input mesh for the computation of the b-box</param> /// <returns></returns> public static LineGeometry3D GenerateBoundingBox(Geometry3D mesh) { var bb = BoundingBoxExtensions.FromPoints(mesh.Positions); return(GenerateBoundingBox(bb)); }