Method |
Description |
|
ClipTo ( this seg, BoundingBox bbox ) : LineSegment? |
Quickly clips a line to a bounding box. If the bounding box is not normalized (min > max), the result is undefined. |
|
ComputeIntersection ( this P, LineSegment Q, LineType type = LineType.Segment ) : Point? |
|
|
ComputeIntersection ( this P, LineType pType, LineSegment Q, LineType qType ) : Point? |
Computes the intersection point between two lines, rays or line segments. This method is implemented based on the other overload, ComputeIntersection(LineSegment, LineType, out T, LineSegment, LineType, out T). |
|
ComputeIntersection ( this P, LineSegment Q, T &pFrac, LineType type = LineType.Segment ) : bool |
|
|
ComputeIntersection ( this P, LineType pType, T &pFrac, LineSegment Q, LineType qType, T &qFrac ) : bool |
Computes the location that lines, rays or line segments intersect, expressed as a fraction of the distance along each LineSegment. This method does not do a bounding-box check. If you are doing calculations with line segments and you expect the majority of your intersection calculations to return false, you may save time by testing whether the bounding boxes of the lines overlap before calling this method. If the input segments contain NaNs, the result is false and pFrac/qFrac will be NaN. If the either of the line segments are degenerate (single points), overlap can still be detected and the LineType of the degenerate line has no effect; the degenerate line is always treated as a point. If both lines are points, the method will return true iff they are the same point, and if true is returned, pFrac will be 0.5f The output fractions pFrac and qFrac will be infinite if the magnitude of the result overflows. If the two line segments are parallel but do not overlap, this method returns false; pFrac and qFrac are both set to NaN. If the two lines are parallel and overlap, a region of overlap is detected and pFrac and qFrac refer to the center of this region of overlap. If, in this case, P and/or Q are rays or infinite lines, this method behaves as though P and/or Q are extended to cover each other. For instance, suppose that P and Q are lines on the X axis, P.A.X=0, P.B.X=6, Q.A.X=10, Q.B.X=16: P.A---------------P.B Q.B---------------------Q.A -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 If P and Q are both line segments, there is no overlap and this method will return false. However, if Q is a Ray or an infinite line, it extends toward negative infinity and the minimum overlap between the lines is 0..6. In this case, the region of overlap is considered to be 0..6 if P is a line segment, and 0..16 if P is a ray or an infinite line. If P is a line segment, the midpoint is 3, and pFrac will be set to 0.5, halfway along the line, while qFrac will be 2.333. If P is a ray or an infinite line, the midpoint is 8, pFrac will be 1.333, and qFrac will be 1.333. |
|
DistanceTo ( this p, LineSegment seg, LineType type = LineType.Segment ) : T |
|
|
GetFractionAlong ( this p, LineSegment seg, LineType type = LineType.Segment ) : T |
Gets the projection of a point onto a line, expressed as a fraction where 0 represents the start of the line and 1 represents the end of the line. This method uses the same technique as ProjectOnto. |
|
GetFractionAlong ( this p, LineSegment seg, LineType type, int &end ) : T |
|
|
Length ( this seg ) : T |
|
|
Midpoint ( this seg ) : System.Point |
Returns the midpoint, (A + B) >> 1. |
|
PointAlong ( this seg, T frac ) : System.Point |
Given a fraction between zero and one, calculates a point between two points (0=point A, 1=point B, 0.5=midpoint). If you just want the midpoint, call Midpoint() which is faster. If the fraction is outside the range [0,1], the result will be along the infinite extension of the line. If the two points are the same, this method always returns the same point as long as the math doesn't overflow, possibly with slight deviations caused by floating-point rounding. |
|
ProjectOnto ( this p, LineSegment seg ) : System.Point |
|
|
ProjectOnto ( this p, LineSegment seg, LineType type = LineType.Segment ) : System.Point |
Performs projection, which finds the point on a line segment or infinite line that is nearest to a specified point. This algorithm is fast and accurate, and can be easily adapted to 3D. A special advantage of this approach is that it runs fastest when the point is projected onto one of the endpoints (when infiniteLine is false). Algorithm comes from: http://geomalgorithms.com/a02-_lines.html See section "Distance of a Point to a Ray or Segment" |
|
ProjectOnto ( this p, LineSegment seg, LineType type, int &end ) : System.Point |
|
|
ProjectOntoInfiniteLine ( this p, LineSegment seg ) : System.Point |
|
|
QuadranceTo ( this p, LineSegment seg ) : T |
|
|
QuadranceTo ( this p, LineSegment seg, LineType type ) : T |
|
|