Contains() public method

public Contains ( DVector2 other ) : bool
other DVector2
return bool
Exemplo n.º 1
0
        public void Draw(Graphics graphics, RectangleD cameraBounds, IMapRenderable orbitingBody)
        {
            var traceBounds = new List<RectangleF>();

            for (int i = 1; i < _points.Count; i++)
            {
                DVector2 orbitPoint = _points[i];

                if (cameraBounds.Contains(orbitPoint))
                {
                    PointF localPoint = RenderUtils.WorldToScreen(orbitPoint, cameraBounds);

                    if (i == _apogeeIndex && i > 1)
                    {
                        RenderApogee(graphics, localPoint);
                    }
                    else if (i == _perigeeIndex)
                    {
                        RenderPerigee(graphics, localPoint);
                    }
                    else
                    {
                        traceBounds.Add(new RectangleF(localPoint.X, localPoint.Y, 2, 2));
                    }
                }
            }

            if (_points.Count > 0 && cameraBounds.Contains(_points[0]))
            {
                RenderStart(graphics, cameraBounds, orbitingBody, _points[0]);
            }

            RenderUtils.DrawRectangles(graphics, traceBounds, orbitingBody.IconColor);
        }
Exemplo n.º 2
0
        public void Draw(Graphics graphics, RectangleD cameraBounds)
        {
            var particleBounds = new List<RectangleF>();

            float particleScale;

            // Scale particle size with viewport width
            if (cameraBounds.Width > 1000)
            {
                particleScale = 1;
            }
            else
            {
                particleScale = (float)(1.22e-6 * cameraBounds.Width * cameraBounds.Width - 4.8e-3 * cameraBounds.Width + 4.4);
            }

            float halfParticleScale = particleScale * 0.5f;

            foreach (Particle particle in _particles)
            {
                if (particle.IsActive)
                {
                    if (cameraBounds.Contains(particle.Position))
                    {
                        PointF localPoint = RenderUtils.WorldToScreen(particle.Position, cameraBounds);

                        particleBounds.Add(new RectangleF(localPoint.X - halfParticleScale,
                                                          localPoint.Y - halfParticleScale,
                                                          particleScale, particleScale));
                    }
                }
            }

            RenderUtils.DrawRectangles(graphics, particleBounds, _color);
        }
Exemplo n.º 3
0
        public void Draw(Graphics graphics, RectangleD cameraBounds, IMassiveBody parentBody)
        {
            var poweredTrails = new List<RectangleF>();
            var coastTrails = new List<RectangleF>();

            for (int i = 0; i < _trailAngles.Count; i++)
            {
                double angle = _trailAngles[i] + parentBody.Pitch;
                double distance = _trailDistances[i];

                DVector2 worldPoint = DVector2.FromAngle(angle) * distance + parentBody.Position;

                if (cameraBounds.Contains(worldPoint))
                {
                    PointF localPoint = RenderUtils.WorldToScreen(worldPoint, cameraBounds);

                    if (_trailPowered[i])
                    {
                        poweredTrails.Add(new RectangleF(localPoint.X, localPoint.Y, 2, 2));
                    }
                    else
                    {
                        coastTrails.Add(new RectangleF(localPoint.X, localPoint.Y, 2, 2));
                    }
                }
            }

            RenderUtils.DrawRectangles(graphics, poweredTrails, Color.Red);
            RenderUtils.DrawRectangles(graphics, coastTrails, Color.White);
        }
Exemplo n.º 4
0
        public void Draw(Graphics graphics, RectangleD cameraBounds, IIconRenderable orbitingBody)
        {
            var traceBounds = new List<RectangleF>();

            for (int i = 1; i < _points.Count; i++)
            {
                DVector2 orbitPoint = _points[i];

                if (cameraBounds.Contains(orbitPoint))
                {
                    PointF localPoint = RenderUtils.WorldToScreen(orbitPoint, cameraBounds);

                    if (i == _apogeeIndex)
                    {
                        RenderApogee(graphics, localPoint);
                    }
                    else if (i == _perigeeIndex)
                    {
                        RenderPerigee(graphics, localPoint);
                    }
                    else
                    {
                        traceBounds.Add(new RectangleF(localPoint.X, localPoint.Y, 2, 2));
                    }
                }
            }

               if (cameraBounds.Contains(_points[0]))
            {
                double visibility = orbitingBody.Visibility(cameraBounds);

                if (visibility < 1)
                {
                    PointF iconPoint = RenderUtils.WorldToScreen(_points[0], cameraBounds);

                    var iconBounds = new RectangleF(iconPoint.X - 5, iconPoint.Y - 5, 10, 10);

                    var iconColor = Color.FromArgb((int)((1 - visibility) * 255),
                                                   orbitingBody.IconColor.R,
                                                   orbitingBody.IconColor.G,
                                                   orbitingBody.IconColor.B);

                    graphics.FillEllipse(new SolidBrush(iconColor), iconBounds);
                }
            }

               RenderUtils.DrawRectangles(graphics, traceBounds, orbitingBody.IconColor);
        }
Exemplo n.º 5
0
        public void Draw(Graphics graphics, RectangleD cameraBounds)
        {
            var particleBounds = new List<RectangleF>();

            foreach (Particle particle in _particles)
            {
                if (particle.IsActive)
                {
                    if (cameraBounds.Contains(particle.Position))
                    {
                        PointF localPoint = RenderUtils.WorldToScreen(particle.Position, cameraBounds);

                        particleBounds.Add(new RectangleF(localPoint.X - 1.5f, localPoint.Y - 1.5f, 3, 3));
                    }
                }
            }

            RenderUtils.DrawRectangles(graphics, particleBounds, Color.FromArgb(50, 255, 255, 0));
        }