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


C# ICurve.Trim方法代码示例

本文整理汇总了C#中ICurve.Trim方法的典型用法代码示例。如果您正苦于以下问题:C# ICurve.Trim方法的具体用法?C# ICurve.Trim怎么用?C# ICurve.Trim使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ICurve的用法示例。


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

示例1: CreateParallelogramOnSubSegOnBezierSeg

        internal static bool CreateParallelogramOnSubSegOnBezierSeg(double start, double end, ICurve seg, ref Parallelogram box) {

            CubicBezierSegment trimSeg = seg.Trim(start, end) as CubicBezierSegment;


            B b = trimSeg.B;
            Point a = b(1) - b(0);

            box = new Parallelogram(b(0), a, b(3) - b(0));

            if (box.Contains(b(2)))
                return true;

            box = new Parallelogram(b(3), b(2) - b(3), b(0) - b(3));

            if (box.Contains(b(1)))
                return true;

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

示例2: TrimEdgeSplineWithNodeBoundaries

        internal static ICurve TrimEdgeSplineWithNodeBoundaries(ICurve sourceBoundary,
            ICurve targetBoundary, ICurve spline,
            bool narrowestInterval) {
            
            var start = spline.ParStart;
            var end = spline.ParEnd;
            if (sourceBoundary != null)
                FindNewStart(spline, ref start, sourceBoundary, narrowestInterval);
            if (targetBoundary != null)
                FindNewEnd(spline, targetBoundary, narrowestInterval, ref end);

            double st = Math.Min(start, end);
            double en = Math.Max(start, end);
            return st < en ? spline.Trim(st, en) : spline;
        }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:15,代码来源:Curve.cs

示例3: GetTrimmedCurveForHookingUpAnywhere

        static ICurve GetTrimmedCurveForHookingUpAnywhere(ICurve curve, PolylinePoint lastPointInside, IntersectionInfo x0, IntersectionInfo x1) {
            var clockwise =
                Point.GetTriangleOrientation(x1.IntersectionPoint, x0.IntersectionPoint, lastPointInside.Point) ==
                TriangleOrientation.Clockwise;

            double rightX = x0.Par0;
            double leftX = x1.Par0;
            ICurve tr0, tr1;
            Curve ret;
            if (clockwise) {
                if (rightX < leftX)
                    return curve.Trim(rightX, leftX);

                tr0 = curve.Trim(rightX, curve.ParEnd);
                tr1 = curve.Trim(curve.ParStart, leftX);
                ret = new Curve();
                return ret.AddSegs(tr0, tr1);
            }

            if (leftX < rightX)
                return curve.Trim(leftX, rightX);
            tr0 = curve.Trim(leftX, curve.ParEnd);
            tr1 = curve.Trim(curve.ParStart, rightX);
            ret = new Curve();
            return ret.AddSegs(tr0, tr1);
        }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:26,代码来源:InteractiveEdgeRouter.cs


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