1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-17 22:28:16 +01:00
dotSCAD/docs/lib3x-trim_shape.md

37 lines
1010 B
Markdown
Raw Normal View History

2019-06-04 12:10:36 +08:00
# trim_shape
Given a tangled-edge shape. This function trims the shape to a non-tangled shape. It's intended to be a helper function after using `bijection_offset`.
**Since:** 1.3.
## Parameters
- `shape_pts` : The shape points.
- `from` : The index of the start point you want to trim.
- `to` : The index of the last point you want to trim.
- `epsilon` : An upper bound on the relative error due to rounding in floating point arithmetic. Default to 0.0001.
## Examples
2021-12-04 10:57:29 +08:00
use <polyline_join.scad>;
2020-01-28 17:51:20 +08:00
use <trim_shape.scad>;
use <shape_taiwan.scad>;
use <bijection_offset.scad>;
use <midpt_smooth.scad>;
2019-06-04 12:10:36 +08:00
taiwan = shape_taiwan(50);
offseted = bijection_offset(taiwan, -2);
trimmed = trim_shape(offseted, 3, len(offseted) - 6);
smoothed = midpt_smooth(trimmed, 3);
2021-12-04 10:57:29 +08:00
#polyline_join(taiwan)
circle(.05);
2019-06-04 12:10:36 +08:00
%translate([25, 0, 0])
2021-12-04 10:57:29 +08:00
polyline_join(offseted)
circle(.1);
polyline_join(smoothed)
circle(.05);
2019-06-04 12:10:36 +08:00
2021-02-24 21:09:54 +08:00
![trim_shape](images/lib3x-trim_shape-1.JPG)
2019-06-04 12:10:36 +08:00