当前位置: 首页>>代码示例>>C#>>正文


C# ICurve类代码示例

本文整理汇总了C#中ICurve的典型用法代码示例。如果您正苦于以下问题:C# ICurve类的具体用法?C# ICurve怎么用?C# ICurve使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ICurve类属于命名空间,在下文中一共展示了ICurve类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HermiteCurveEvaluator

 /// <summary>
 /// Default constructor</summary>
 /// <param name="curve">Curve for which evaluator created</param>
 public HermiteCurveEvaluator(ICurve curve)
 {
     if (curve == null)
         throw new ArgumentNullException("curve");
     m_curve = curve;            
     Reset();
 }
开发者ID:BeRo1985,项目名称:LevelEditor,代码行数:10,代码来源:HermiteCurveEvaluator.cs

示例2: TangentsAroundCurve

  static IEnumerable<CurveTangent> TangentsAroundCurve(ICurve iCurve) {
     Curve c = iCurve as Curve;
     if (c != null) {
         foreach (ICurve seg in c.Segments)
             foreach (CurveTangent ct in TangentsAroundCurve(seg))
                 yield return ct;
     } else {
         LineSegment ls = iCurve as LineSegment;
         if (ls != null)
             yield return new CurveTangent(ls.Start, ls.Derivative(0));
         else {
             Ellipse ellipse = iCurve as Ellipse;
             if (ellipse != null) {
                 foreach (CurveTangent ct in TangentsOfEllipse(ellipse))
                     yield return ct;
             } else {
                 CubicBezierSegment bez = iCurve as CubicBezierSegment;
                 if (bez != null)
                     foreach (CurveTangent ct in TangentsOfBezier(bez))
                         yield return ct;
                 }
         }
         
     }
 }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:25,代码来源:PenetrationDepth.cs

示例3: Flatten

        /// <summary>
        /// Flattens the specified curve. See <see cref="ICurve{TParam, TPoint}.Flatten"/>.
        /// </summary>
        /// <remarks>
        /// This method cannot be used for curves that contain gaps!
        /// </remarks>
        internal static void Flatten(ICurve<float, Vector3F> curve, ICollection<Vector3F> points, int maxNumberOfIterations, float tolerance)
        {
            if (tolerance <= 0)
            throw new ArgumentOutOfRangeException("tolerance", "The tolerance must be greater than zero.");

              float totalLength = curve.GetLength(0, 1, maxNumberOfIterations, tolerance);

              // No line segments if the curve has zero length.
              if (totalLength == 0)
            return;

              // A single line segment if the curve's length is less than the tolerance.
              if (totalLength < tolerance)
              {
            points.Add(curve.GetPoint(0));
            points.Add(curve.GetPoint(1));
            return;
              }

              var list = ResourcePools<Vector3F>.Lists.Obtain();

              Flatten(curve, list, 0, 1, curve.GetPoint(0), curve.GetPoint(1), 0, totalLength, 1, maxNumberOfIterations, tolerance);

              foreach (var point in list)
            points.Add(point);

              ResourcePools<Vector3F>.Lists.Recycle(list);
        }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:34,代码来源:CurveHelper_Flatten.cs

示例4: WithinEpsilon

        static bool WithinEpsilon(ICurve bc, double start, double end) {
            int n = 3; //hack !!!!
            double d = (end - start)/n;
            P2 s = bc[start];
            P2 e = bc[end];

            return DistToSegm(bc[start + d], s, e) < epsilon && DistToSegm(bc[start + d*(n - 1)], s, e) < epsilon;
        }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:8,代码来源:Tesselator.cs

示例5: OffsetCurve

 /// <summary>
 /// Offsets curve</summary>
 /// <param name="curve">Curve</param>
 /// <param name="x">X offset</param>
 /// <param name="y">Y offset</param>
 public static void OffsetCurve(ICurve curve, float x, float y)
 {
     foreach (IControlPoint cpt in curve.ControlPoints)
     {
         cpt.X += x;
         cpt.Y += y;
     }
 }
开发者ID:BeRo1985,项目名称:LevelEditor,代码行数:13,代码来源:CurveUtils.cs

示例6: PolylineAroundClosedCurve

 public static Polyline PolylineAroundClosedCurve(ICurve curve) {
     Polyline poly = new Polyline();
     foreach (Point point in PointsOnAroundPolyline(curve))
         poly.AddPoint(point);
     if (Point.GetTriangleOrientation(poly.StartPoint.Point, poly.StartPoint.Next.Point, poly.StartPoint.Next.Next.Point) == TriangleOrientation.Counterclockwise)
         poly = (Polyline)poly.Reverse();
     poly.Closed = true;
     return poly;
 }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:9,代码来源:PenetrationDepth.cs

示例7: WeierstrassCurvePoint

        public WeierstrassCurvePoint(FiniteFieldElement x, FiniteFieldElement y, ICurve curve)
        {
            if (!(curve is WeierstrassCurve))
                throw new ArgumentException("A weierstrass curve point should only be placed on a weierstrass curve, but was placed on " + curve + ".", "curve");

            _x = x;
            _y = y;
            _curve = curve as WeierstrassCurve;
        }
开发者ID:hypesystem,项目名称:OpenECC,代码行数:9,代码来源:WeierstrassCurvePoint.cs

示例8: Rail

        internal Rail(ICurve curveSegment, LgEdgeInfo topRankedEdgeInfoOfTheRail, int zoomLevel)
#if DEBUG
            : this()
#endif
        {
            TopRankedEdgeInfoOfTheRail = topRankedEdgeInfoOfTheRail;
            this.ZoomLevel = zoomLevel;
            Geometry = curveSegment;
        }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:9,代码来源:Rail.cs

示例9: BundleBase

 /// <summary>
 /// constructor
 /// </summary>
 internal BundleBase(int count, ICurve boundaryCurve, Point position, bool belongsToRealNode, int stationIndex) {
     BelongsToRealNode = belongsToRealNode;
     Curve = boundaryCurve;
     Position = position;
     this.stationIndex = stationIndex;
     points = new Point[count];
     tangents = new Point[count];
     OrientedHubSegments = new OrientedHubSegment[count];
     ParameterSpan = Curve.ParEnd - Curve.ParStart;
 }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:13,代码来源:BundleBase.cs

示例10: PortEntryOnCurve

        public PortEntryOnCurve(ICurve entryCurve, IEnumerable<Tuple<double, double>> parameterSpans) {
            EntryCurve = entryCurve;
#if TEST_MSAGL
            var polyline = entryCurve as Polyline;
            curveIsClosed = (polyline != null) ? polyline.Closed : ApproximateComparer.Close(EntryCurve.Start, EntryCurve.End);
#endif
            Spans = parameterSpans;
#if TEST_MSAGL
            TestSpans(entryCurve, parameterSpans, curveIsClosed);
#endif
        }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:11,代码来源:PortEntryOnCurve.cs

示例11: CreateCurveEvaluator

 /// <summary>
 /// Creates a curve evaluator for a curve</summary>
 /// <param name="curve">Curve</param>
 /// <returns>Curve evaluator</returns>
 /// <remarks>A curve evaluator calculates y-coordinates from x-coordinates using appropriate interpolation for a curve</remarks>
 public static ICurveEvaluator CreateCurveEvaluator(ICurve curve)
 {
     ICurveEvaluator cv = null;
     if (curve.CurveInterpolation == InterpolationTypes.Linear)
         cv = new LinearCurveEvaluator(curve);
     else if (curve.CurveInterpolation == InterpolationTypes.Hermite)
         cv = new HermiteCurveEvaluator(curve);
     else
         throw new NotImplementedException("CurveEvaluator not implement for "
             + curve.CurveInterpolation);
     return cv;
 }
开发者ID:BeRo1985,项目名称:LevelEditor,代码行数:17,代码来源:CurveUtils.cs

示例12: KinectPilotProcessor

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="steeringCurve">Steering curve</param>
        /// <param name="pushCurve">Push amount curve</param>
        /// <param name="elevationCurve">Elevation curve</param>
        public KinectPilotProcessor(ICurve steeringCurve, ICurve pushCurve, ICurve elevationCurve)
        {
            if (steeringCurve == null)
                throw new ArgumentNullException("steeringCurve");
            if (pushCurve == null)
                throw new ArgumentNullException("pushCurve");
            if (elevationCurve == null)
                throw new ArgumentNullException("elevationCurve");

            this.steeringCurve = steeringCurve;
            this.pushCurve = pushCurve;
            this.elevationCurve = elevationCurve;
        }
开发者ID:semihguresci,项目名称:kgp,代码行数:19,代码来源:KinectPilotProcessor.cs

示例13: IntersectionInfo

        internal IntersectionInfo(double pr0, double pr1, Point x, ICurve s0, ICurve s1) {
            par0 = pr0;
            par1 = pr1;
            this.x = x;
            seg0 = s0;
            seg1 = s1;
#if DETAILED_DEBUG
            System.Diagnostics.Debug.Assert(ApproximateComparer.Close(x, s0[pr0], ApproximateComparer.IntersectionEpsilon*10),
                    string.Format("intersection not at curve[param]; x = {0}, s0[pr0] = {1}, diff = {2}", x, s0[pr0], x - s0[pr0]));
            System.Diagnostics.Debug.Assert(ApproximateComparer.Close(x, s1[pr1], ApproximateComparer.IntersectionEpsilon*10),
                    string.Format("intersection not at curve[param]; x = {0}, s1[pr1] = {1}, diff = {2}", x, s1[pr1], x - s1[pr1]));
#endif 
        }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:13,代码来源:IntersectionInfo.cs

示例14: Serialize

        internal static void Serialize(string fileName, ICurve i) {

            Stream file = File.Open(fileName, FileMode.Create);

            // Create a formatter object based on command line arguments
            IFormatter formatter = new BinaryFormatter();

            // Serialize the object graph to stream
            formatter.Serialize(file, i);

            // All done
            file.Close();
        }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:13,代码来源:CurveSerializer.cs

示例15: Interpolate

        internal static List<LineSegment> Interpolate(double a, ref Point ap, double b, ref Point bp, ICurve s,
            double eps) {
            var r = new List<LineSegment>();
            if (IsCloseToLineSeg(a, ref ap, b, ref bp, s, eps))
                r.Add(new LineSegment(ap, bp));
            else {
                double m = 0.5*(a + b);
                Point mp = s[m];
                r.AddRange(Interpolate(a, ref ap, m, ref mp, s, eps));
                r.AddRange(Interpolate(m, ref mp, b, ref bp, s, eps));
            }

            return r;
        }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:14,代码来源:Curve.cs


注:本文中的ICurve类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。