예제 #1
0
        private Rectangle ToDisplayRect(Scenario.IScenarioMember obj, Rectangle rect, float scaleRadius = 1.0f)
        {
            PointF center       = obj.GetPosition();
            Point  centerRender = CoordinatesToDisplayPoint(center.X, center.Y, rect);

            int width  = (int)((float)rect.Width * obj.GetRadius() * scaleRadius / (HorizontalUnitsVisible / 2.0f));
            int height = (int)((float)rect.Height * obj.GetRadius() * scaleRadius / (VerticalUnitsVisible / 2.0f));

            return(new Rectangle(centerRender.X - (width / 2), centerRender.Y - (height / 2), width, height));
        }
예제 #2
0
        private bool HitTest(Scenario.IScenarioMember member, PointF simpt)
        {
            var simposition = member.GetPosition();

            float dx = simpt.X - simposition.X;
            float dy = simpt.Y - simposition.Y;

            float distanceSq = dx * dx + dy * dy;

            return(distanceSq <= member.GetRadius() * member.GetRadius());
        }