本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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());
}
}
}