public static AxisAlignedBox2f Bounds(IEnumerable <Vector2f> positions) { AxisAlignedBox2f box = AxisAlignedBox2f.Empty; foreach (Vector2f v in positions) { box.Contain(v); } return(box); }
void SetBounds(AxisAlignedBox2f bounds) { m_bounds = bounds; m_fXShift = (bounds.Min.x < 0) ? bounds.Min.x : -bounds.Min.x; m_fYShift = (bounds.Min.y < 0) ? bounds.Min.y : -bounds.Min.y; m_fScale = (bounds.Width > bounds.Height) ? bounds.Width : bounds.Height; m_fCellSize = m_fScale / m_nCells; }
public AxisAlignedBox2f Intersect(AxisAlignedBox2f box) { AxisAlignedBox2f intersect = new AxisAlignedBox2f( Math.Max(Min.x, box.Min.x), Math.Max(Min.y, box.Min.y), Math.Min(Max.x, box.Max.x), Math.Min(Max.y, box.Max.y)); if (intersect.Height <= 0 || intersect.Width <= 0) { return(AxisAlignedBox2f.Empty); } else { return(intersect); } }
public MarchingQuads(int nSubdivisions, AxisAlignedBox2f bounds, float fIsoValue) { m_stroke = new DPolyLine2f(); m_bounds = new AxisAlignedBox2f(); m_nCells = nSubdivisions; SetBounds(bounds); m_cells = null; InitializeCells(); m_seedPoints = new ArrayList(); m_cellStack = new ArrayList(); m_bEdgeSigns = new bool[4]; m_fIsoValue = fIsoValue; }
public AxisAlignedBox2f(AxisAlignedBox2f o) { Min = new Vector2f(o.Min); Max = new Vector2f(o.Max); }
public bool Intersects(AxisAlignedBox2f box) { return(!((box.Max.x < Min.x) || (box.Min.x > Max.x) || (box.Max.y < Min.y) || (box.Min.y > Max.y))); }
public void Contain(AxisAlignedBox2f box) { Contain(box.Min); Contain(box.Max); }