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


C# Segment.SharedVertex方法代码示例

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


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

示例1: Angle

        public Angle(Segment ray1, Segment ray2)
            : base()
        {
            Point vertex = ray1.SharedVertex(ray2);

            if (vertex == null) throw new ArgumentException("Rays do not share a vertex: " + ray1 + " " + ray2);

            this.A = ray1.OtherPoint(vertex);
            this.B = vertex;
            this.C = ray2.OtherPoint(vertex);
            this.ray1 = ray1;
            this.ray2 = ray2;
            this.measure = toDegrees(findAngle(A, B, C));

            if (measure <= 0)
            {
                //System.Diagnostics.Debug.WriteLine("NO-OP");
            //                throw new ArgumentException("Measure of " + this.ToString() + " is ZERO");
            }
        }
开发者ID:wcatykid,项目名称:GeoShader,代码行数:20,代码来源:Angle.cs

示例2: IsIncludedAngle

        public bool IsIncludedAngle(Segment s1, Segment s2, Angle a)
        {
            if (!HasSegment(s1) || !HasSegment(s2) && !HasAngle(a)) return false;

            // If the shared vertex between the segments is the vertex of this given angle, then
            // the angle is the included angle as desired
            return s1.SharedVertex(s2).Equals(a.GetVertex());
        }
开发者ID:wcatykid,项目名称:GeoShader,代码行数:8,代码来源:Triangle.cs

示例3: AcquireMiddleSegment

        //            top
        // shared1  _______   off1
        //         |
        //   mid   |
        //         |_________   off2
        //            bottom
        private static Segment AcquireMiddleSegment(Segment seg1, Segment seg2, Segment seg3, out Segment top, out Segment bottom)
        {
            if (seg1.SharedVertex(seg2) != null && seg1.SharedVertex(seg3) != null)
            {
                top = seg2;
                bottom = seg3;
                return seg1;
            }

            if (seg2.SharedVertex(seg1) != null && seg2.SharedVertex(seg3) != null)
            {
                top = seg1;
                bottom = seg3;
                return seg2;
            }

            if (seg3.SharedVertex(seg1) != null && seg3.SharedVertex(seg2) != null)
            {
                top = seg1;
                bottom = seg2;
                return seg3;
            }

            top = null;
            bottom = null;

            return null;
        }
开发者ID:wcatykid,项目名称:GeoShader,代码行数:34,代码来源:Quadrilateral.cs

示例4: Quadrilateral

        public Quadrilateral(Segment left, Segment right, Segment top, Segment bottom)
            : base()
        {
            //
            // Segments
            //
            this.left = left;
            this.right = right;
            this.top = top;
            this.bottom = bottom;

            orderedSides = new List<Segment>();
            orderedSides.Add(left);
            orderedSides.Add(top);
            orderedSides.Add(right);
            orderedSides.Add(bottom);

            //
            // Points
            //
            this.topLeft = left.SharedVertex(top);
            if (topLeft == null)
            {
                return;
                // throw new ArgumentException("Top left point is invalid: " + top + " " + left);
            }
            this.topRight = right.SharedVertex(top);
            if (topRight == null) throw new ArgumentException("Top left point is invalid: " + top + " " + right);

            this.bottomLeft = left.SharedVertex(bottom);
            if (bottomLeft == null) throw new ArgumentException("Bottom left point is invalid: " + bottom + " " + left);

            this.bottomRight = right.SharedVertex(bottom);
            if (bottomRight == null) throw new ArgumentException("Bottom right point is invalid: " + bottom + " " + right);

            points = new List<Point>();
            points.Add(topLeft);
            points.Add(topRight);
            points.Add(bottomRight);
            points.Add(bottomLeft);

            // Verify that we have 4 unique points
            for (int i = 0; i < points.Count - 1; i++)
            {
                for (int j = i + 1; j < points.Count; j++)
                {
                    if (points[i].StructurallyEquals(points[j]))
                    {
                        throw new ArgumentException("Points of quadrilateral are not distinct: " + points[i] + " " + points[j]);
                    }
                }
            }

            //
            // Diagonals
            //
            this.topLeftBottomRightDiagonal = new Segment(topLeft, bottomRight);
            this.bottomLeftTopRightDiagonal = new Segment(bottomLeft, topRight);
            this.diagonalIntersection = null;
            triPairTLBR = new KeyValuePair<Triangle, Triangle>(new Triangle(topLeft, bottomLeft, bottomRight), new Triangle(topLeft, topRight, bottomRight));
            triPairBLTR = new KeyValuePair<Triangle, Triangle>(new Triangle(bottomLeft, topLeft, topRight), new Triangle(bottomLeft, bottomRight, topRight));

            //
            // Angles
            //
            this.topLeftAngle = new Angle(bottomLeft, topLeft, topRight);
            this.topRightAngle = new Angle(topLeft, topRight, bottomRight);
            this.bottomRightAngle = new Angle(topRight, bottomRight, bottomLeft);
            this.bottomLeftAngle = new Angle(bottomRight, bottomLeft, topLeft);

            angles = new List<Angle>();
            angles.Add(topLeftAngle);
            angles.Add(topRightAngle);
            angles.Add(bottomLeftAngle);
            angles.Add(bottomRightAngle);

            this.FigureSynthesizerConstructor();

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

示例5: IsIncludedAngle

        //
        // Do these segments overlay this angle?
        //
        public bool IsIncludedAngle(Segment seg1, Segment seg2)
        {
            // Do not allow the same segment.
            if (seg1.StructurallyEquals(seg2)) return false;

            // Check direct inclusion
            if (seg1.Equals(ray1) && seg2.Equals(ray2) || seg1.Equals(ray2) && seg2.Equals(ray1)) return true;

            // Check overlaying angle
            Point shared = seg1.SharedVertex(seg2);

            if (shared == null) return false;

            Angle thatAngle = new Angle(seg1.OtherPoint(shared), shared, seg2.OtherPoint(shared));

            return this.Equates(thatAngle);
        }
开发者ID:wcatykid,项目名称:GeoShader,代码行数:20,代码来源:Angle.cs


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