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


C# Segment.IsParallelWith方法代码示例

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


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

示例1: Parallel

        public Parallel(Segment segment1, Segment segment2)
            : base()
        {
            this.segment1 = segment1;
            this.segment2 = segment2;

            if (!segment1.IsParallelWith(segment2))
            {
                throw new ArgumentException("Given lines are not parallel: " + segment1 + " ; " + segment2);
            }
        }
开发者ID:wcatykid,项目名称:GeoShader,代码行数:11,代码来源:Parallel.cs

示例2: Parallelogram

        public Parallelogram(Segment left, Segment right, Segment top, Segment bottom)
            : base(left, right, top, bottom)
        {
            if (!left.IsParallelWith(right))
            {
                throw new ArgumentException("Given opposing segments are not parallel: " + left + " " + right);
            }

            if (!top.IsParallelWith(bottom))
            {
                throw new ArgumentException("Given opposing segments are not parallel: " + top + " " + bottom);
            }
        }
开发者ID:wcatykid,项目名称:GeoShader,代码行数:13,代码来源:Parallelogram.cs

示例3: Trapezoid

        public Trapezoid(Segment left, Segment right, Segment top, Segment bottom)
            : base(left, right, top, bottom)
        {
            if (left.IsParallelWith(right))
            {
                if (left.Length > right.Length)
                {
                    baseSegment = left;
                    oppBaseSegment = right;
                    leftLeg = top;
                    rightLeg = bottom;
                }
                else
                {
                    baseSegment = right;
                    oppBaseSegment = left;
                    leftLeg = top;
                    rightLeg = bottom;
                }
            }
            else if (top.IsParallelWith(bottom))
            {
                if (top.Length > bottom.Length)
                {
                    baseSegment = top;
                    oppBaseSegment = bottom;
                    leftLeg = left;
                    rightLeg = right;
                }
                else
                {
                    baseSegment = bottom;
                    oppBaseSegment = top;
                    leftLeg = left;
                    rightLeg = right;
                }
            }
            else
            {
                throw new ArgumentException("Quadrilateral does not define a trapezoid; no sides are parallel: " + this);
            }

            topLeftBaseAngle = GetAngle(new Angle(leftLeg, oppBaseSegment));
            topRightBaseAngle = GetAngle(new Angle(rightLeg, oppBaseSegment));
            bottomLeftBaseAngle = GetAngle(new Angle(leftLeg, baseSegment));
            bottomRightBaseAngle = GetAngle(new Angle(rightLeg, baseSegment));

            FindMedian();
        }
开发者ID:wcatykid,项目名称:GeoShader,代码行数:49,代码来源:Trapezoid.cs

示例4: CreatesBasicCShape

        //
        // Creates a basic S-Shape with standsOnEndpoints
        //
        //   offThis   ______
        //                   |
        //   offThat   ______|
        //
        // Return <offThis, offThat>
        public KeyValuePair<Point, Point> CreatesBasicCShape(Intersection thatInter)
        {
            KeyValuePair<Point, Point> nullPair = new KeyValuePair<Point, Point>(null, null);

            // A valid transversal is required for this shape
            if (!this.CreatesAValidTransversalWith(thatInter)) return nullPair;

            if (!this.StandsOnEndpoint()) return nullPair;
            if (!thatInter.StandsOnEndpoint()) return nullPair;

            //
            // Determine offThis and offThat
            //
            Segment transversal = this.AcquireTransversal(thatInter);

            Segment parallelThis = this.OtherSegment(transversal);
            Segment parallelThat = thatInter.OtherSegment(transversal);

            Point offThis = transversal.PointLiesOnAndBetweenEndpoints(parallelThis.Point1) ? parallelThis.Point2 : parallelThis.Point1;
            Point offThat = transversal.PointLiesOnAndBetweenEndpoints(parallelThat.Point1) ? parallelThat.Point2 : parallelThat.Point1;

            // Avoid S-shape scenario
            Segment crossingTester = new Segment(offThis, offThat);
            Point intersection = transversal.FindIntersection(crossingTester);

            // We may have parallel crossingTester and transversal; that's ok
            if (crossingTester.IsParallelWith(transversal)) return new KeyValuePair<Point, Point>(offThis, offThat);

            // S-shape
            if (transversal.PointLiesOnAndBetweenEndpoints(intersection)) return nullPair;

            // C-Shape
            return new KeyValuePair<Point, Point>(offThis, offThat);
        }
开发者ID:wcatykid,项目名称:GeoShader,代码行数:42,代码来源:Intersection.cs


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