/// <summary> /// Returns a boundingbox of this polygon. /// </summary> /// <returns></returns> public BoundingBox2D GetBoundingBox() { if (Count < 2) { return(BoundingBox2D.NULL); } BoundingBox2D box = new BoundingBox2D(this[0], this[1]); for (int i = 2; i < Count; i++) { box.ExtendByPoint(this[i]); } return(box); }
/// <summary> /// Possibly extends the Min and Max by the /// Min and Max of parameter. /// </summary> /// <param name="Box"></param> public void ExtendByBoundingBox(BoundingBox2D Box) { ExtendByPoint(Box.Min); ExtendByPoint(Box.Max); }
/// <summary> /// Typed equals /// </summary> /// <param name="obj"></param> /// <returns></returns> public bool Equals(BoundingBox2D obj) { return (obj.Min == Min && obj.Max == Max); }
/// <summary> /// Calculates a two dimensional boundingbox for this room /// on the fly - either based on walls or editor walls. /// </summary> /// <param name="UseClientWalls"></param> /// <returns> /// If UseClientWalls=true, BoundingBox in 1:1024 scale based on RooWalls, /// else BoundingBox in 1:64 based on RooEditorWalls /// </returns> public BoundingBox2D GetBoundingBox2D(bool UseClientWalls = true) { BoundingBox2D box; // must have at least a wall 'or' editorwall if ((UseClientWalls && Walls.Count == 0) || (!UseClientWalls && WallsEditor.Count == 0)) return BoundingBox2D.NULL; // build based on clientwalls (1:1024) if (UseClientWalls) { box = new BoundingBox2D(Walls[0].P1, Walls[0].P2); for(int i = 1; i < Walls.Count; i++) { box.ExtendByPoint(Walls[i].P1); box.ExtendByPoint(Walls[i].P2); } } // build based on editorwalls (1:64) else { box = new BoundingBox2D(WallsEditor[0].P0, WallsEditor[0].P1); for(int i = 1; i < WallsEditor.Count; i++) { box.ExtendByPoint(WallsEditor[i].P0); box.ExtendByPoint(WallsEditor[i].P1); } } return box; }
/// <summary> /// Constructor by values /// </summary> /// <param name="RooVersion"></param> /// <param name="BoundingBox"></param> /// <param name="A"></param> /// <param name="B"></param> /// <param name="C"></param> /// <param name="Right"></param> /// <param name="Left"></param> /// <param name="LineDefReference"></param> public RooPartitionLine( uint RooVersion, BoundingBox2D BoundingBox, Real A, Real B, Real C, ushort Right, ushort Left, ushort LineDefReference) : base(RooVersion) { this.A = A; this.B = B; this.C = C; this.Right = Right; this.Left = Left; this.WallReference = LineDefReference; this.BoundingBox = BoundingBox; }
/// <summary> /// Typed equals /// </summary> /// <param name="obj"></param> /// <returns></returns> public bool Equals(BoundingBox2D obj) { return(obj.Min == Min && obj.Max == Max); }