Esempio n. 1
0
        public static WavefrontFormat DrawCurve(this WavefrontFormat wf,
                                                string color,
                                                ICurve2 curve,
                                                int count = 100)
        {
            wf.UseMaterial(color);
            if (curve is ComposedCurve2)
            {
                int            i        = 0;
                ComposedCurve2 composed = (ComposedCurve2)curve;
                foreach (ICurve2 segment in composed.GetSegments())
                {
                    /*Vec2d pt = segment.GetPosition(segment.TMin);
                     * wf.DrawFigure(color, WaveFigure.X, pt, 1);
                     * wf.DrawString(color, pt, FontFamily.GenericSerif, FontStyle.Regular, 1000, "" + (i++));*/

                    //if (segment is CircleArc2)
                    {
                        wf.AddLines(MathUtils.For(segment.TMin, segment.TMax, count).Select(segment.GetPosition), false);
                    }
                }

                /*if (!curve.IsClosed)
                 * {
                 *  Vec2d pt = curve.GetPosition(curve.TMax);
                 *  wf.DrawFigure(color, WaveFigure.X, pt, 1);
                 *  wf.DrawString(color, pt, FontFamily.GenericSerif, FontStyle.Regular, 1000, "" + (i++));
                 * }*/
            }
            else
            {
                wf.AddLines(MathUtils.For(curve.TMin, curve.TMax, count).Select(curve.GetPosition), false);
            }
            return(wf);
        }
Esempio n. 2
0
 public static WavefrontFormat DrawCurve(this WavefrontFormat wf,
                                         string color,
                                         ICurve2 curve,
                                         int count = 100)
 {
     wf.UseMaterial(color);
     if (curve is ComposedCurve2)
     {
         int            i        = 0;
         ComposedCurve2 composed = (ComposedCurve2)curve;
         foreach (ICurve2 segment in composed.GetSegments())
         {
             wf.AddLines(MathUtils.For(segment.TMin, segment.TMax, count).Select(segment.GetPosition), false);
         }
     }
     else
     {
         wf.AddLines(MathUtils.For(curve.TMin, curve.TMax, count).Select(curve.GetPosition), false);
     }
     return(wf);
 }