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


C# Segment.OtherPoint方法代码示例

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


在下文中一共展示了Segment.OtherPoint方法的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: IsSecant

        //
        // Determine if the segment passes through the circle (we know it is not a chord since they have been filtered).
        //
        private bool IsSecant(Segment segment, List<Point> figPoints, out Segment chord)
        {
            // Make it null and overwrite when necessary.
            chord = null;

            // Is the segment exterior to the circle, but intersects at an endpoint (and wasn't tangent).
            if (this.PointIsExterior(segment.Point1) && this.PointLiesOn(segment.Point2)) return false;
            if (this.PointIsExterior(segment.Point2) && this.PointLiesOn(segment.Point1)) return false;

            // Is one endpoint of the segment simply on the interior of the circle (so we have nothing)?
            if (this.PointIsInterior(segment.Point1) || this.PointIsInterior(segment.Point2)) return false;

            if (ContainsDiameter(segment))
            {
                chord = ConstructChord(segment, this.center, this.radius, figPoints);

                // Add radii to the list.
                radii.Add(new Segment(this.center, chord.Point1));
                radii.Add(new Segment(this.center, chord.Point2));

                return true;
            }

            // Acquire the line perpendicular to the segment that passes through the center of the circle.
            Segment perpendicular = segment.GetPerpendicular(this.center);

            // Is this perpendicular segment a radius? If so, it's tangent, not a secant
            //if (Utilities.CompareValues(perpendicular.Length, this.radius)) return false;

            // Is the perpendicular a radius? Check if the intersection of the segment and the perpendicular is on the circle. If so, it's tangent
            Point intersection = segment.FindIntersection(perpendicular);
            if (this.PointLiesOn(intersection)) return false;

            //Adjust perpendicular segment to include intersection with segment
            perpendicular = new Segment(intersection, this.center);

            // Filter the fact that there are no intersections
            if (perpendicular.Length > this.radius) return false;

            //            1/2 chord length
            //                 _____   circPoint
            //                |    /
            //                |   /
            // perp.Length    |  / radius
            //                | /
            //                |/
            // Determine the half-chord length via Pyhtagorean Theorem.
            double halfChordLength = Math.Sqrt(Math.Pow(this.radius, 2) - Math.Pow(perpendicular.Length, 2));

            chord = ConstructChord(segment, perpendicular.OtherPoint(this.center), halfChordLength, figPoints);

            return true;
        }
开发者ID:wcatykid,项目名称:GeoShader,代码行数:56,代码来源:Circle.cs

示例3: IsRadius

        //
        // Is this a direct radius segment where one endpoint originates at the origin and extends outward?
        // Return the exact radius.
        private Segment IsRadius(Segment segment, List<Point> figPoints)
        {
            // The segment must originate from the circle center.
            if (!segment.HasPoint(this.center)) return null;

            // The segment must be at least as long as a radius.
            if (!Utilities.CompareValues(segment.Length, this.radius)) return null;

            Point nonCenterPt = segment.OtherPoint(this.center);

            // Check for a direct radius.
            if (this.PointLiesOn(nonCenterPt)) return segment;

            //
            // Check for an extended segment.
            //
            //                radius
            //      center    _____   circPt
            //
            // Find the exact coordinates of the 'circ' points.
            //
            Point inter1 = null;
            Point inter2 = null;
            this.FindIntersection(segment, out inter1, out inter2);

            Point figPoint = Utilities.GetStructurally<Point>(figPoints, inter1);
            if (figPoint == null) figPoint = Utilities.GetStructurally<Point>(figPoints, inter2);

            return new Segment(center, figPoint);
        }
开发者ID:wcatykid,项目名称:GeoShader,代码行数:33,代码来源:Circle.cs

示例4: RayOverlays

        // Does the given segment overlay this segment; we are looking at both as a RAY only.
        // We assume both rays share the same start vertex
        public bool RayOverlays(Segment thatRay)
        {
            if (this.Equals(thatRay)) return true;

            if (!this.IsCollinearWith(thatRay)) return false;

            // Do they share a vertex?
            Point shared = this.SharedVertex(thatRay);

            if (shared == null) return false;

            Point thatOtherPoint = thatRay.OtherPoint(shared);
            Point thisOtherPoint = this.OtherPoint(shared);

            // Is thatRay smaller than the this ray
            if (Between(thatOtherPoint, shared, thisOtherPoint)) return true;

            // Or if that Ray extends this Ray
            if (Between(thisOtherPoint, shared, thatOtherPoint)) return true;

            return false;
        }
开发者ID:wcatykid,项目名称:GeoShader,代码行数:24,代码来源:Segment.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.OtherPoint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。