public override bool intersects(TezShape shape) { switch (shape.category) { case Category.Point: return(shape.originX >= originX && shape.originY >= originY && shape.originX <= maxX && shape.originY <= maxY); case Category.Circle: return(false); case Category.Rectangle: var rect = (TezRectangle)shape; return(!(rect.originX > maxX || rect.originY > maxY || rect.maxX < originX || rect.maxY < originY)); default: break; } return(false); }
private int calculateQuadrant(TezShape shape) { bool in_left = shape.originX <= bounds.midX; bool in_bottom = shape.originY <= bounds.midY; if (in_left) { if (in_bottom) { return(Quadrant_3); } else { return(Quadrant_2); } } else { if (in_bottom) { return(Quadrant_4); } else { return(Quadrant_1); } } }
public override bool contains(TezShape shape) { switch (shape.category) { case Category.Point: return(originX == shape.originX && originY == shape.originY); case Category.Rectangle: break; case Category.Circle: break; default: break; } return(false); }
private void retrieve(TezShape shape, ref List <TezQtEntry> result) { if (!bounds.intersects(shape)) { return; } if (m_Objects.Count > 0) { result.AddRange(m_Objects); } if (m_IsSubdivided) { m_Nodes[Quadrant_1].retrieve(shape, ref result); m_Nodes[Quadrant_2].retrieve(shape, ref result); m_Nodes[Quadrant_3].retrieve(shape, ref result); m_Nodes[Quadrant_4].retrieve(shape, ref result); } }
public override bool intersects(TezShape shape) { switch (shape.category) { case Category.Point: return(originX == shape.originX && originY == shape.originY); case Category.Rectangle: var rect = (TezRectangle)shape; return(originX >= rect.originX && originY >= rect.originY && originX <= rect.maxX && originY <= rect.maxY); case Category.Circle: break; default: break; } return(false); }
public override bool contains(TezShape shape) { switch (shape.category) { case Category.Point: return(shape.originX >= originX && shape.originY >= originY && shape.originX <= maxX && shape.originY <= maxY); case Category.Circle: var circle = (TezCircle)shape; var max_x = circle.originX + circle.radius; var max_y = circle.originY + circle.radius; var min_x = circle.originX - circle.radius; var min_y = circle.originY - circle.radius; return(min_x >= originX && min_y >= originY && max_x <= maxX && max_y <= maxY); case Category.Rectangle: var rect = (TezRectangle)shape; return(rect.originX >= originX && rect.originY >= originY && rect.maxX <= maxX && rect.maxY <= maxY); default: break; } return(false); }
public abstract bool intersects(TezShape shape);
public abstract bool contains(TezShape shape);
public override bool contains(TezShape circle) { return(false); }
public override bool intersects(TezShape shape) { return(false); }