public static void DrawExtent(this SpriteBatch spriteBatch, IExtent extent, Color color, Matrix transformFromWorldToCamera) { ICompositeExtent composite = extent as ICompositeExtent; if (null != composite) { DrawCompositeExtent(spriteBatch, composite, color, transformFromWorldToCamera); return; } IPolygonExtent poly = extent as IPolygonExtent; if (null != poly) { DrawPolygon(spriteBatch, poly, color, transformFromWorldToCamera); return; } ICircularExtent circle = extent as ICircularExtent; if (null != circle) { DrawCircle(spriteBatch, circle, color, transformFromWorldToCamera); return; } throw new NotImplementedException("can only draw extents that are either polygons or circles"); }
public static bool AreInIntersectionExtentVsExtent(IPolygonExtent a, IExtent b) { ICompositeExtent composite = b as ICompositeExtent; if (null != composite) { return(a.Intersects(composite)); } composite = a as ICompositeExtent; if (null != composite) { return(b.Intersects(composite)); } ICircularExtent circle = b as ICircularExtent; if (null != circle) { _tempCircleB.Reset(b); return(circle.Intersects(_tempCircleB)); } IPolygonExtent polygon = b as IPolygonExtent; if (null != polygon) { return(a.Intersects(polygon)); } throw new InvalidOperationException("Extent must be a circle or polygon"); }
public bool Intersects(IExtent other) { if (null == other) { return(false); } ICompositeExtent composite = other as ICompositeExtent; if (null != composite) { return(Intersects(composite)); } IPolygonExtent polygon = other as IPolygonExtent; if (null != polygon) { return(Intersects(polygon)); } ICircularExtent circle = other as ICircularExtent; if (null != circle) { return(Intersects(circle)); } throw new NotImplementedException("otherExtent must be either circle or polygon"); }
public override bool Intersects(ICompositeExtent other) { foreach (var child in Items) { if (child.Intersects(other)) { return(true); } } return(false); }
private static void DrawCompositeExtent(this SpriteBatch spriteBatch, ICompositeExtent extent, Color color, Matrix transformFromWorldToCamera) { //for( int i = 0; i < extent.ReferenceRegion.NumSides; i++ ) //{ // _extentTraceVertices[ i ] = Vector2.Transform( extent.ReferenceRegion.Vertices[ i ], extent.TranslateFrom ); //} //spriteBatch.DrawPolygon( _extentTraceVertices, extent.NumSides, color, transformFromWorldToCamera ); foreach (var child in extent.Items) { DrawExtent(spriteBatch, child, color, transformFromWorldToCamera); } }
public override bool Intersects(ICompositeExtent other) { return(other.Intersects(this)); }
private static void DrawCompositeExtent(this SpriteBatch spriteBatch, ICompositeExtent extent, Color color) { DrawCompositeExtent(spriteBatch, extent, color, Matrix.Identity); }
public abstract bool Intersects(ICompositeExtent other);