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


C# Segment.PointLiesOn方法代码示例

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


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

示例1: IsTangent

        //
        // Determine tangency of the given segment.
        // Indicate tangency by returning the segment which creates the 90^0 angle.
        //
        public Segment IsTangent(Segment segment)
        {
            // If the center and the segment points are collinear, this will not be a tangent.
            if (segment.PointLiesOn(this.center)) return null;

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

            // If the segment was found to pass through the center, it is not a tangent
            if (perpendicular.Equals(segment)) return null;

            // Is this perpendicular segment a radius? Check length
            //if (!Utilities.CompareValues(perpendicular.Length, this.radius)) return null;

            // Is the perpendicular a radius? Check that the intersection of the segment and the perpendicular is on the circle
            Point intersection = segment.FindIntersection(perpendicular);
            if (!this.PointLiesOn(intersection)) return null;

            // The intersection between the perpendicular and the segment must be within the endpoints of the segment.
            return segment.PointLiesOnAndBetweenEndpoints(intersection) ? perpendicular : null;
        }
开发者ID:wcatykid,项目名称:GeoShader,代码行数:25,代码来源:Circle.cs

示例2: OtherPoint

        public Point OtherPoint(Segment seg)
        {
            if (seg.HasPoint(A) && seg.HasPoint(B)) return C;
            if (seg.HasPoint(A) && seg.HasPoint(C)) return B;
            if (seg.HasPoint(B) && seg.HasPoint(C)) return A;

            if (seg.PointLiesOn(A) && seg.PointLiesOn(B)) return C;
            if (seg.PointLiesOn(A) && seg.PointLiesOn(C)) return B;
            if (seg.PointLiesOn(B) && seg.PointLiesOn(C)) return A;

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

示例3: SameSidePoint

        //
        //     PointA
        //     |
        //     |             X (pt)
        //     |_____________________ otherSegment
        //     |
        //     |
        //     PointB
        //
        public Point SameSidePoint(Segment otherSegment, Point pt)
        {
            // Is the given point on other? If so, we cannot make a determination.
            if (otherSegment.PointLiesOn(pt)) return null;

            // Make a vector out of this vector as well as the vector connecting one of the points to the given pt
            Vector thisVector = new Vector(Point1, Point2);
            Vector thatVector = new Vector(Point1, pt);

            Vector projectionOfOtherOntoThis = thisVector.Projection(thatVector);

            // We are interested most in the endpoint of the projection (which is not the
            Point projectedEndpoint = projectionOfOtherOntoThis.NonOriginEndpoint();

            // Find the intersection between the two lines
            Point intersection = FindIntersection(otherSegment);

            if (this.PointLiesOn(projectedEndpoint))
            {
                System.Diagnostics.Debug.WriteLine("Unexpected: Projection does not lie on this line. " + this + " " + projectedEndpoint);
            }

            // The endpoint of the projection is on this vector. Therefore, we can judge which side of the given segment the given pt lies on.
            if (Segment.Between(projectedEndpoint, Point1, intersection)) return Point1;
            if (Segment.Between(projectedEndpoint, Point2, intersection)) return Point2;

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

示例4: Verify

        private void Verify()
        {
            if (points.Count < 2) throw new ArgumentException("A Collinear relationship requires at least 2 points: " + this.ToString());

            // Create a segment of the endpoints to compare all points for collinearity
            Segment line = new Segment(points[0], points[points.Count - 1]);

            foreach (Point pt in points)
            {
                if (!line.PointLiesOn(pt))
                {
                    throw new ArgumentException("Point " + pt + " is not collinear with line " + line.ToString());
                }

                if (!line.PointLiesOnAndBetweenEndpoints(pt))
                {
                    throw new ArgumentException("Point " + pt + " is not between the endpoints of segment " + line.ToString());
                }
            }
        }
开发者ID:wcatykid,项目名称:GeoShader,代码行数:20,代码来源:Collinear.cs


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