public static BoundingBox2D FromTriangle(Vector2 v1, Vector2 v2, Vector2 v3) { var box = new BoundingBox2D(); box.min = v1; box.max = v1; box.ExpandTo(v2); box.ExpandTo(v3); return(box); }
public static BoundingBox2D FromVectices(Vector2 v1, Vector2 v2) { var box = new BoundingBox2D(); box.min = box.max = v1; box.ExpandTo(v2); return(box); }
public static BoundingBox2D FromVectices(IEnumerable <Vector2> vs) { var box = new BoundingBox2D(); if (vs.Count() < 1) { return(box); } box.min = vs.First(); box.max = box.min; if (vs.Count() < 2) { return(box); } foreach (var v in vs.Skip(1)) { box.ExpandTo(v); } return(box); }