Пример #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);
        }
Пример #2
0
 // Token: 0x06000104 RID: 260 RVA: 0x000050EC File Offset: 0x000032EC
 public Edge3(Orientation orientation, ICurve3 curve, ICurve2 curveOnSurface, double startParameter, double endParameter)
 {
     this.Orientation    = orientation;
     this.Curve          = curve;
     this.CurveOnSurface = curveOnSurface;
     this.StartParameter = startParameter;
     this.EndParameter   = endParameter;
     this.StartVertex    = this.Curve.EvalAt(this.StartParameter);
     this.EndVertex      = this.Curve.EvalAt(this.EndParameter);
 }
Пример #3
0
 // Token: 0x06000105 RID: 261 RVA: 0x00005152 File Offset: 0x00003352
 public Edge3(Orientation orientation, ICurve3 curve, ICurve2 curveOnSurface, double startParameter, double endParameter, Vector3 startVertex, Vector3 endVertex)
 {
     this.Orientation    = orientation;
     this.Curve          = curve;
     this.CurveOnSurface = curveOnSurface;
     this.StartParameter = startParameter;
     this.EndParameter   = endParameter;
     this.StartVertex    = startVertex;
     this.EndVertex      = endVertex;
 }
Пример #4
0
        public static void TimeSubdivision(ICurve2 curve, int size, IList <Point2d> points)
        {
            Debug.Assert(size >= 2);
            Debug.Assert(points != null);

            double delta = (curve.TMax - curve.TMin) / (size - 1);
            double t     = curve.TMin;

            for (int i = 0; i < size; i++)
            {
                points.Add(curve.GetPosition(t));
                t += delta;
            }
        }
Пример #5
0
        public static void LengthSubdivision(ICurve2 curve, int size, IList <Point2d> puntos)
        {
            Debug.Assert(size >= 2);
            Debug.Assert(puntos != null);

            double delta    = curve.TotalLength / (size - 1);
            double longitud = 0;

            for (int i = 0; i < size; i++)
            {
                double t = curve.GetT(longitud);
                puntos.Add(curve.GetPosition(t));
                longitud += delta;
            }
        }
Пример #6
0
 public void Add(ICurve2 curve)
 {
     if (this.segments.Count == 0)
     {
         this.segments.Add(curve);
     }
     else
     {
         ICurve2 last = this.segments[this.segments.Count - 1];
         double  tmin = last.TMax;
         double  tlen = curve.TMax - curve.TMin;
         curve.SetTInterval(tmin, tmin + tlen);
         this.segments.Add(curve);
     }
 }
Пример #7
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);
 }
Пример #8
0
 private static IEnumerable <double> GetTimes(ICurve2 curve, double tinc)
 {
     if (curve is MultiCurve2)
     {
         TimeList    times = new TimeList();
         MultiCurve2 multi = (MultiCurve2)curve;
         for (int i = 0; i < multi.NumSegments; i++)
         {
             double tmin = multi.GetTMin(i);
             double tmax = multi.GetTMax(i);
             double t    = tmin;
             while (t < tmax)
             {
                 times.Add(t);
                 t += tinc;
             }
             times.Add(tmax);
         }
         return(times.GetTimes());
     }
     else if (curve is DisplacedCurve2)
     {
         DisplacedCurve2 displaced = (DisplacedCurve2)curve;
         return(MathUtils.ConcatSorted(GetTimes(displaced.Curve, tinc), GetTimes(displaced.Displacement, tinc)));
     }
     else
     {
         TimeList times = new TimeList();
         double   tmin  = curve.TMin;
         double   tmax  = curve.TMax;
         double   t     = tmin;
         while (t < tmax)
         {
             times.Add(t);
             t += tinc;
         }
         times.Add(tmax);
         return(times.GetTimes());
     }
 }
Пример #9
0
 public CurveEvaluator2(ICurve2 curve, double tinc)
 {
     this.curve = curve;
     this.tinc  = tinc;
 }
Пример #10
0
 public static ICurve2 Split(ICurve2 curve, double tmin, double tmax)
 {
     return(new SplitCurve2(curve, tmin, tmax));
 }
Пример #11
0
 public SplitCurve2(ICurve2 curve, double tmin, double tmax)
     : base(curve)
 {
     this.tmin = tmin;
     this.tmax = tmax;
 }
Пример #12
0
 public DisplacedCurve2(ICurve2 curve, ICurve1 displacement)
 {
     this.curve        = curve;
     this.displacement = displacement;
 }
Пример #13
0
 public WrapperCurve2(ICurve2 curve)
 {
     this.curve = curve;
 }