Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions gears.scad
Original file line number Diff line number Diff line change
Expand Up @@ -3523,12 +3523,12 @@ function _gear_tooth_profile(
// mod = The module of the gear, pitch diameter divided by tooth count.
// diam_pitch = The diametral pitch, or number of teeth per inch of pitch diameter. Note that the diametral pitch is a completely different thing than the pitch diameter.
// circ_pitch = distance between teeth centers around the pitch circle.
// ring_carrier = set ring/carrier ratio to this value in a ring driven system, must be between 1 and 2
// carrier_ring = set carrier/ring ratio to this value in a carrier driven system, must be between 1/2 and 1
// sun_carrier = set sun/carrier ratio to this value in a sun driven system, must be larger than 2
// carrier_sun = set carrier/sun ratio to this value in a carrier driven system, must be smaller than 1/2
// ring_sun = set ring/sun ratio to this value in a ring driven system, must have absolute value larger than 1
// sun_ring = set sun/ring ratio to this value in a sun driven system, must have absolute value smaller than 1
// ring_carrier = set ring/carrier transmission ratio to this value in a ring driven system, must be between 1 and 2
// carrier_ring = set carrier/ring transmission ratio to this value in a carrier driven system, must be between 1/2 and 1
// sun_carrier = set sun/carrier transmission ratio to this value in a sun driven system, must be larger than 2
// carrier_sun = set carrier/sun transmission ratio to this value in a carrier driven system, must be smaller than 1/2
// ring_sun = set ring/sun transmission ratio to this value in a ring driven system, must have absolute value smaller than 1
// sun_ring = set sun/ring transmission ratio to this value in a sun driven system, must have absolute value larger than 1
// helical = create gears with specified helical angle. Default: 0
// gear_spin = rotate the driven gear by this number of degrees. Default:0
// Example(2D,NoAxes,Anim,Frames=90,FrameMS=30,VPT=[-0.875705,-0.110537,-66.3877],VPR=[0,0,0],VPD=102,Med): In this example we request a ring/carrier ratio of 1.341 and the system produced has a ratio of 4/3. The sun is fixed, the input is carried by the ring, and the carrier, shown as the blue triangle, is the output, rotating approximately in accordance with the requested ratio.
Expand Down
12 changes: 6 additions & 6 deletions geometry.scad
Original file line number Diff line number Diff line change
Expand Up @@ -1585,8 +1585,8 @@ function polygon_normal(poly) =
// b=30;
// ofs = 17;
// curve = [for(theta=[0:10:140]) [a * theta/360*2*PI - b*sin(theta), a-b*cos(theta)-20]];
// path = deduplicate(concat( reverse(offset(curve,r=ofs)),
// xflip(offset(curve,r=ofs)),
// path = deduplicate(concat( reverse(offset(curve,r=ofs,closed=false)),
// xflip(offset(curve,r=ofs,closed=false)),
// xflip(reverse(curve)),
// curve
// ));
Expand All @@ -1612,8 +1612,8 @@ function polygon_normal(poly) =
// b=30*2/3;
// ofs = 17*2/3;
// curve = [for(theta=[0:10:140]) [a * theta/360*2*PI - b*sin(theta), a-b*cos(theta)]];
// path = deduplicate(concat( reverse(offset(curve,r=ofs)),
// xflip(offset(curve,r=ofs)),
// path = deduplicate(concat( reverse(offset(curve,r=ofs,closed=false)),
// xflip(offset(curve,r=ofs,closed=false)),
// xflip(reverse(curve)),
// curve
// ));
Expand All @@ -1628,8 +1628,8 @@ function polygon_normal(poly) =
// b=30*2/3;
// ofs = 17*2/3;
// curve = [for(theta=[0:10:140]) [a * theta/360*2*PI - b*sin(theta), a-b*cos(theta)]];
// path = deduplicate(concat( reverse(offset(curve,r=ofs)),
// xflip(offset(curve,r=ofs)),
// path = deduplicate(concat( reverse(offset(curve,r=ofs,closed=false)),
// xflip(offset(curve,r=ofs,closed=false)),
// xflip(reverse(curve)),
// curve
// ));
Expand Down
2 changes: 1 addition & 1 deletion joiners.scad
Original file line number Diff line number Diff line change
Expand Up @@ -1193,7 +1193,7 @@ module rabbit_clip(type, length, width, snap, thickness, depth, compression=0.1
bounds = pointlist_bounds(rounded);
extrapt = is_pin ? [] : [rounded[0] - [0,extra]];
finalpath = is_pin ? rounded
: let(withclearance=offset(rounded, r=-clearance))
: let(withclearance=offset(rounded, r=-clearance, closed=false))
concat( [[withclearance[0].x,-extra]],
withclearance,
[[-withclearance[0].x,-extra]]);
Expand Down
15 changes: 9 additions & 6 deletions regions.scad
Original file line number Diff line number Diff line change
Expand Up @@ -814,8 +814,10 @@ function _point_dist(path,pathseg_unit,pathseg_len,pt) =
// Takes a 2D input path, polygon or region and returns a path offset by the specified amount. As with the built-in
// offset() module, you can use `r` to specify rounded offset and `delta` to specify offset with
// corners. If you used `delta` you can set `chamfer` to true to get chamfers.
// For paths and polygons positive offsets make the polygons larger. For paths,
// positive offsets shift the path to the left, relative to the direction of the path.
// When `closed=true` (the default), the input is treated as a polygon. If the input is a region it is treated as a collection
// of polygons. In this case, positive offset values make the shape larger. If you set `closed=false` then the input is treated as a path
// with distinct start and end points. For paths, positive offsets shifts the path to the left, relative to the direction of the path.
// Note that a path that happens to end at its starting point is not the same as a polygon and the offset result may differ.
// .
// If you use `delta` without chamfers, the path must not include any 180 degree turns, where the path
// reverses direction. Such reversals result in an offset with two parallel segments, so they cannot be
Expand Down Expand Up @@ -863,7 +865,7 @@ function _point_dist(path,pathseg_unit,pathseg_len,pt) =
// r = offset radius. Distance to offset. Will round over corners.
// delta = offset distance. Distance to offset with pointed corners.
// chamfer = chamfer corners when you specify `delta`. Default: false
// closed = if true path is treate as a polygon. Default: False.
// closed = if true path is treated as a polygon. Default: True.
// check_valid = perform segment validity check. Default: True.
// quality = validity check quality parameter, a small integer. Default: 1.
// same_length = return a path with the same length as the input. Only compatible with `delta=`. Default: false
Expand Down Expand Up @@ -902,7 +904,7 @@ function _point_dist(path,pathseg_unit,pathseg_len,pt) =
// Example(2D): Open path. The red path moves from left to right as shown by the arrow and the positive offset shifts to the left of the initial red path.
// sinpath = 2*[for(theta=[-180:5:180]) [theta/4,45*sin(theta)]];
// stroke(sinpath, width=2, color="red", endcap2="arrow2");
// stroke(offset(sinpath, r=17.5),width=2);
// stroke(offset(sinpath, r=17.5,closed=false),width=2);
// Example(2D,NoAxes): An open path in red with with its positive offset in yellow and its negative offset in blue.
// seg = [[0,0],[0,50]];
// stroke(seg,color="red",endcap2="arrow2");
Expand Down Expand Up @@ -985,12 +987,13 @@ function _point_dist(path,pathseg_unit,pathseg_len,pt) =

function offset(
path, r=undef, delta=undef, chamfer=false,
closed=false, check_valid=true,
closed=true, check_valid=true,
quality=1, return_faces=false, firstface_index=0,
flip_faces=false, same_length=false
) =
assert(!(same_length && return_faces), "Cannot combine return_faces with same_length")
is_region(path)?
assert(closed, "cannot set closed=false for a region")
assert(!return_faces, "return_faces not supported for regions.")
let(
ofsregs = [for(R=region_parts(path))
Expand Down Expand Up @@ -1035,7 +1038,7 @@ function offset(
cornercheck = [for(i=idx(goodsegs)) (!closed && (i==0 || i==len(goodsegs)-1))
|| is_def(sharpcorners[i])
|| approx(unit(deltas(select(goodsegs,i-1))[0]) * unit(deltas(goodsegs[i])[0]),-1)],
dummyA = assert(len(sharpcorners)==2 || all(cornercheck),"Two consecutive valid offset segments are parallel but do not meet at their ends, maybe because path contains very short segments that were mistakenly flagged as invalid; unable to compute offset"),
dummyA = assert(len(sharpcorners)==2 || all(cornercheck),"Two consecutive valid offset segments are parallel but do not meet at their ends, maybe because path contains very short segments that were mistakenly flagged as invalid; unable to compute offset. If you get this error from offset_sweep() try setting ofset=\"delta\""),
reversecheck =
!same_length
|| !(is_def(delta) && !chamfer) // Reversals only a problem in delta mode without chamfers
Expand Down
Loading