예제 #1
0
 public void Draw(Renderer cam)
 {
     if (mean != null && covariance != null)
     {
         List <List <Vector2> > meanCpy = new List <List <Vector2> >(mean);
         foreach (List <Vector2> list in meanCpy)
         {
             if (drawMean)
             {
                 for (float i = width; i >= 0; i -= 0.1f)
                 {
                     GLUtility.DrawDiamond(new GLPen(meanColor, penThickness), list[0], i);
                 }
             }
             if (drawCov)
             {
                 try
                 {
                     GLUtility.DrawLineLoop(new GLPen(covColor, penThickness), covariance[meanCpy.IndexOf(list)].ToArray());
                 }
                 catch
                 { }
             }
         }
     }
 }
예제 #2
0
        public void Draw(Renderer cam)
        {
            Vector2 bodyPnt     = new Vector2(pose.x, pose.y);
            Vector2 bodyHeading = new Vector2(bodyPnt.X + Math.Cos(pose.yaw), bodyPnt.Y + Math.Sin(pose.yaw));

            GLUtility.DrawLineLoop(new GLPen(color, drawLineWidth), bodyPlygn.ToArray());

            // Draw heading
            GLUtility.DrawLine(new GLPen(Color.Red, drawLineWidth), bodyPnt, bodyHeading);
            // Draw the name
            GLUtility.DrawString(name, Color.Black, new PointF((float)bodyPnt.X, (float)bodyPnt.Y));
        }
예제 #3
0
        public void Draw(Renderer r)
        {
            float lineWidth = selected ? 2.0f : 1.0f;

            PointF bodyPnt     = new PointF(x, y);
            PointF bodyHeading = new PointF(bodyPnt.X + (float)Math.Cos(heading), bodyPnt.Y + (float)Math.Sin(heading));

            GLUtility.DrawLineLoop(new GLPen(color, lineWidth), bodyPlygn.ToArray());

            GLUtility.FillTriangle(color, 0.6f, bodyPlygn[0].ToPointF(), bodyPlygn[1].ToPointF(), bodyPlygn[2].ToPointF());
            GLUtility.FillTriangle(color, 0.6f, bodyPlygn[2].ToPointF(), bodyPlygn[3].ToPointF(), bodyPlygn[0].ToPointF());

            // Draw heading
            //GLUtility.DrawLine(new GLPen(Color.Red, lineWidth), Vector2.FromPointF(bodyPnt), Vector2.FromPointF(bodyHeading));
            GLUtility.DrawLine(new GLPen(Color.Red, lineWidth), bodyPnt, bodyHeading);

            //// Draw the name
            //if (modeString.Equals(""))
            //    GLUtility.DrawString(MythName + ": " + name, Color.Black, bodyPnt);
            //else if (modeQualifier.Equals(""))
            //    GLUtility.DrawString(name + ": " + modeString, Color.Black, bodyPnt);
            //else// if (defaultRenderer != null)
            //{
            //    try
            //    {
            //        GLUtility.DrawStringMultiLine(name + ": " + modeString + '\n' + "NOTE: " + modeQualifier, Color.Black, bodyPnt, r.CurrentCamera);
            //    }
            //    catch { GLUtility.DrawString(name + ": " + modeString, Color.Black, bodyPnt); }
            //}//else
            ////    GLUtility.DrawString(name + ": " + modeString +  "(NOTE: " + modeQualifier + ")", Color.Black, bodyPnt);

            GLUtility.DrawString(name, Color.Black, bodyPnt);

            DrawFlagLine(x, y, color);
            if (drawCameraView && IsSelected)
            {
                PointF p1 = bodyPnt;
                PointF p2 = new PointF(bodyPnt.X + 5 * (float)Math.Cos(heading - 0.5 * (cameraFOVangle * Math.PI / 180)), bodyPnt.Y + 5 * (float)Math.Sin(heading - 0.5 * (cameraFOVangle * Math.PI / 180)));
                PointF p3 = new PointF(bodyPnt.X + 5 * (float)Math.Cos(heading - 0.167 * (cameraFOVangle * Math.PI / 180)), bodyPnt.Y + 5 * (float)Math.Sin(heading - 0.167 * (cameraFOVangle * Math.PI / 180)));
                PointF p4 = new PointF(bodyPnt.X + 5 * (float)Math.Cos(heading + 0.167 * (cameraFOVangle * Math.PI / 180)), bodyPnt.Y + 5 * (float)Math.Sin(heading + 0.167 * (cameraFOVangle * Math.PI / 180)));
                PointF p5 = new PointF(bodyPnt.X + 5 * (float)Math.Cos(heading + 0.5 * (cameraFOVangle * Math.PI / 180)), bodyPnt.Y + 5 * (float)Math.Sin(heading + 0.5 * (cameraFOVangle * Math.PI / 180)));

                GLUtility.FillTriangle(color, 0.1f, p1, p2, p3);
                GLUtility.FillTriangle(color, 0.1f, p1, p3, p4);
                GLUtility.FillTriangle(color, 0.1f, p1, p4, p5);
                //GLUtility.FillTriangle(Color.BlueViolet, 0.3f, p1, p2, p3);
                //GLUtility.FillTriangle(Color.Blue, 0.3f, p1, p3, p4);
                //GLUtility.FillTriangle(Color.Turquoise, 0.3f, p1, p4, p5);
            }
        }
예제 #4
0
 public void Draw(Renderer cam)
 {
     lock (polygonListLock)
     {
         foreach (Polygon eachPolygon in polygonsToDraw)
         {
             //eachPolygon.Add(eachPolygon[0]);
             GLUtility.DrawLineLoop(new GLPen(c, 1.0f), eachPolygon.ToArray());
             //GLUtility.DrawLines(new GLPen(c[i++ & 100], 1.0f), eachPolygon.ToArray());
             //int j = 0;
             //foreach (Vector2 v in eachPolygon.ToArray())
             //{
             //	GLUtility.DrawString(i + ":" + j, Color.Black, v.ToPointF());
             //	j++;
             //}
             //i++;
             //foreach (Vector2 eachVector in eachPolygon)
             //  GLUtility.DrawCross(new GLPen(Color.Blue, 1.0f), eachVector, 1.0f);
         }
     }
 }
예제 #5
0
 public void Draw(Renderer cam)
 {
     GLUtility.DrawLineLoop(new GLPen(Color, selected ? 2.0f : 1.0f), Polygon.ToArray());
 }