You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Takes a possibly bounded line, and a 2D or 3D planar polygon, and finds their intersection. Note the polygon is
1790
-
// treated as its boundary and interior, so the intersection may include both points and line segments.
1791
-
//If the line does not intersect the polygon then returns `undef`.
1792
-
//In 3D if the line is not on the plane of the polygon but intersects it then you get a single intersection point.
1793
-
//Otherwise the polygon and line are in the same plane, or when your input is 2D, you get a list of segments and
1794
-
//single point lists. Use `is_vector` to distinguish these two cases.
1789
+
// Takes a possibly bounded line, and a 2D or 3D planar polygon, and finds their intersection. The polygon is
1790
+
// treated as its boundary and interior, so the intersection may include both points and line segments.
1791
+
//Returns:
1792
+
// * If the line does not intersect the polygon: `undef`.
1793
+
// * In 3D if the line is not coplanar with the polygon but intersects it: the intersection point as a 3-vector, `[x,y,z]`.
1794
+
// * In the 2D case or the 3D case when the line is coplanar with the polygon: list of segments or degenerate single point "segments".
1795
1795
// .
1796
-
// In the 2D case, a common result is a list containing a single segment, which lists the two intersection points
1797
-
// with the boundary of the polygon.
1798
-
// When single points are in the intersection (the line just touches a polygon corner) they appear on the segment
1799
-
// list as lists of a single point
1800
-
// (like single point segments) so a single point intersection in 2D has the form `[[[x,y,z]]]` as compared
1801
-
// to a single point intersection in 3D, which has the form `[x,y,z]`. You can identify whether an entry in the
1802
-
// segment list is a true segment by checking its length, which is 2 for a segment and 1 for a point.
1796
+
// In 3D, you can distinguish output cases using {{is_vector()}}. When run on the output it returns `true` when the output is a single
1797
+
// intersection point from a non-coplanar line.
1798
+
// .
1799
+
// In the 2D or coplanar case, the result is a **list** of segments, so the common case of a single segment will be a
1800
+
// singleton list of the form `[[p1,p2]]`. A single point appears on the segment list as a degenerate segment or the form `[p]`,
1801
+
// so this means in 3D a single point will appears as `[[[x,y,z]]]` in the coplanar case. This makes it possible to distinguish
1802
+
// the coplanar and non-coplanar cases. An intersection featuring two segments and a point could look like `[[p1,p2], [q], [r1,r2]]`.
1803
+
// To determine if an entry in the segment list is a true segment, check its length, which is 2 for a segment and 1 for a point.
1803
1804
// Arguments:
1804
1805
// poly = The 3D planar polygon to find the intersection with.
1805
1806
// line = A list of two distinct 3D points on the line.
1806
1807
// bounded = If false, the line is considered unbounded. If true, it is treated as a bounded line segment. If given as `[true, false]` or `[false, true]`, the boundedness of the points are specified individually, allowing the line to be treated as a half-bounded ray. Default: false (unbounded)
1807
-
// nonzero = set to true to use the nonzero rule for determining it points are in a polygon. See point_in_polygon. Default: false.
1808
+
// nonzero = set to true to use the nonzero rule for determining it points are in a polygon. See {{point_in_polygon()}}. Default: false.
1808
1809
// eps = Tolerance in geometric comparisons. Default: 1e-9
1809
1810
// Example(3D): The line intersects the 3d hexagon in a single point.
// Example(3D,Big): Complicated example where we use attach_prism() to create attachments and then connect a bezier sweep to those attachments using descriptions. The blue line segments show the bezier control points. Note that we use {{bezier_sweep()}} rather than {{path_sweep()}} to ensure that the ends of the sweep mate properly, and setting `last_normal` ensures that the points on the attached prisms line up with the sweep.
0 commit comments