public GeometricObject() { rendering = false; initialized = false; pointAppearance = new Stack <Appearance> (); pointAppearance.Push(new Appearance(Color.red, Color.red, 60f, 1f, 1f)); lineAppearance = new Stack <Appearance> (); lineAppearance.Push(new Appearance(Color.blue, Color.blue, 60f, 1f, 1f)); surfaceAppearance = new Stack <Appearance> (); surfaceAppearance.Push(new Appearance(Color.green, Color.grey, 60f, 1f, 1f)); primitives = new List <PrimitiveBase> (); ptp = new PointPrimitive(); primitives.Add(ptp); lp = new LinePrimitive(); primitives.Add(lp); pp = new PolygonPrimitive(); primitives.Add(pp); sp = new SpherePrimitive(); primitives.Add(sp); mp = new MeshPrimitive(); primitives.Add(mp); }
public DiagnosticInfo(Game game, SpriteBatch spriteBatch, IAssetLoader assetLoader) { _logs = new Queue <string>(); _retain = 15; SetLogLevel(LogLevel.Trace); //Logger.Write.AddLogger(this); _game = game; _spriteBatch = spriteBatch; _font = assetLoader.Get <SpriteFont>("ui/fonts/bold_12.fnt"); _updateTimer = new Stopwatch(); _drawTimer = new Stopwatch(); _backgroundBarOutline = new PolygonPrimitive(spriteBatch.GraphicsDevice, Color.White); _backgroundBar = new PolygonPrimitive(spriteBatch.GraphicsDevice, Color.Black); _textBackground = new PolygonPrimitive(spriteBatch.GraphicsDevice, Color.Black * 0.5f); _updateBar = new PolygonPrimitive(spriteBatch.GraphicsDevice, Color.Blue); _drawBar = new PolygonPrimitive(spriteBatch.GraphicsDevice, Color.Yellow); }
public GeometricObject() { rendering = false; initialized = false; primitives = new List <PrimitiveBase> (); ptp = new PointPrimitive(); primitives.Add(ptp); lp = new LinePrimitive(); primitives.Add(lp); pp = new PolygonPrimitive(); primitives.Add(pp); sp = new SpherePrimitive(); primitives.Add(sp); mp = new MeshPrimitive(); primitives.Add(mp); }
private static bool HasSeparatingAxis(PolygonPrimitive polygon, PolygonPrimitive otherPolygon) { // ReSharper disable once ForCanBeConvertedToForeach for (var index = 0; index < polygon.Edges.Count; index++) { var direction = polygon.Edges[index].Direction.GetNormal(); var projections = polygon.Vertices.Select(p => p.ProjectScalar(direction)).ToArray(); var otherProjections = otherPolygon.Vertices.Select(p => p.ProjectScalar(direction)).ToArray(); float min, max; projections.MinMax(out min, out max); float otherMin, otherMax; otherProjections.MinMax(out otherMin, out otherMax); if (min > otherMax || max < otherMin) { return(true); } } return(false); }