Skip to content

Commit 3fde690

Browse files
Merge pull request #1895 from adrianVmariano/master
doc tweaks
2 parents ffa493b + e34880d commit 3fde690

File tree

3 files changed

+48
-19
lines changed

3 files changed

+48
-19
lines changed

drawing.scad

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ module stroke(
360360
translate(path[0]) {
361361
$fn = segs(width[0]/2);
362362
if (is_undef(endcap_angle1)) {
363-
rotate_extrude(convexity=convexity) {
363+
rotate_extrude(convexity=convexity,angle=360) {
364364
right_half(planar=true) {
365365
polygon(endcap_shape1);
366366
}

geometry.scad

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1784,27 +1784,28 @@ function point_in_polygon(point, poly, nonzero=false, eps=_EPSILON) =
17841784
// Topics: Geometry, Polygons, Lines, Intersection
17851785
// See Also: polygon_area(), centroid(), polygon_normal(), point_in_polygon(), polygon_line_intersection()
17861786
// Usage:
1787-
// pt = polygon_line_intersection(poly, line, [bounded], [nonzero], [eps]);
1787+
// pt_or_segments = polygon_line_intersection(poly, line, [bounded], [nonzero], [eps]);
17881788
// Description:
1789-
// 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".
17951795
// .
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.
18031804
// Arguments:
18041805
// poly = The 3D planar polygon to find the intersection with.
18051806
// line = A list of two distinct 3D points on the line.
18061807
// 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.
18081809
// eps = Tolerance in geometric comparisons. Default: 1e-9
18091810
// Example(3D): The line intersects the 3d hexagon in a single point.
18101811
// hex = zrot(140,p=rot([-45,40,20],p=path3d(hexagon(r=15))));

rounding.scad

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5045,9 +5045,37 @@ module prism_connector(profile, desc1, anchor1, desc2, anchor2, shift1, shift2,
50455045
// joint = 3;
50465046
// rounded_prism(rect(12), rect(8), h=15, joint_sides=joint,atype="prismoid")
50475047
// attach_prism(circle(r=3,$fn=128),RIGHT+FWD, length=4, fillet=2, edge_joint=joint, $fn=32);
5048-
5049-
5050-
5048+
// 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.
5049+
// sq = subdivide_path(circle(r=3,$fn=7),maxlen=.5);
5050+
// vspace=20;
5051+
// bezlen=40;
5052+
// cylr=20;
5053+
// cylh=65;
5054+
// straightlen=5;
5055+
// smoothcurve=true; // true for C2 joint
5056+
// k=0.6;
5057+
// cyl(r=cylr,h=cylh, rounding=2, circum=true, $fn=256)
5058+
// let(cylinder=parent())
5059+
// attach_prism(sq,FWD,length=straightlen,shift=-vspace,fillet=2,spin=90)
5060+
// let(front=parent())
5061+
// restore(cylinder)
5062+
// attach_prism(sq, RIGHT, length=straightlen, shift=vspace, fillet=2,spin=90)
5063+
// let(right=parent())
5064+
// restore(cylinder)
5065+
// let(avg_dir = desc_dir(front,anchor="end") + desc_dir(right,anchor="end"),
5066+
// path=[
5067+
// desc_point(front,anchor="end"),
5068+
// if (smoothcurve) desc_point(front,anchor="end")+bezlen*(1-k)*desc_dir(front,anchor="end"),
5069+
// desc_point(front,anchor="end")+bezlen*desc_dir(front,anchor="end"),
5070+
// down(vspace/2,desc_point(cylinder,CTR)+ (cylr+straightlen+bezlen)*avg_dir),
5071+
// desc_point(right,anchor="end")+bezlen*desc_dir(right,anchor="end"),
5072+
// if (smoothcurve) desc_point(right,anchor="end")+bezlen*(1-k)*desc_dir(right,anchor="end"),
5073+
// desc_point(right,anchor="end")]
5074+
// )
5075+
// {
5076+
// bezier_sweep(zrot(90,sq), path, 40, last_normal=UP);
5077+
// color("lightblue")stroke(path);
5078+
// }
50515079

50525080

50535081
module attach_prism(profile, anchor, fillet=0, rounding=0, inside=false, l, length, h, height, endpoint, T=IDENT, shift=0, overlap=1,

0 commit comments

Comments
 (0)