mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-09 00:06:42 +02:00
add doc
This commit is contained in:
BIN
docs/images/lib-trim_shape-1.JPG
Normal file
BIN
docs/images/lib-trim_shape-1.JPG
Normal file
Binary file not shown.
After Width: | Height: | Size: 44 KiB |
33
docs/lib-trim_shape.md
Normal file
33
docs/lib-trim_shape.md
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
# 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
|
||||||
|
|
||||||
|
include <hull_polyline2d.scad>;
|
||||||
|
include <trim_shape.scad>;
|
||||||
|
include <shape_taiwan.scad>;
|
||||||
|
include <bijection_offset.scad>;
|
||||||
|
include <midpt_smooth.scad>;
|
||||||
|
|
||||||
|
taiwan = shape_taiwan(50);
|
||||||
|
offseted = bijection_offset(taiwan, -2);
|
||||||
|
trimmed = trim_shape(offseted, 3, len(offseted) - 6);
|
||||||
|
smoothed = midpt_smooth(trimmed, 3);
|
||||||
|
|
||||||
|
#hull_polyline2d(taiwan, .1);
|
||||||
|
%translate([25, 0, 0])
|
||||||
|
hull_polyline2d(offseted, .2);
|
||||||
|
hull_polyline2d(smoothed, .1);
|
||||||
|
|
||||||
|

|
||||||
|
|
@@ -15,6 +15,7 @@ shape = [
|
|||||||
tris = triangulate(shape);
|
tris = triangulate(shape);
|
||||||
|
|
||||||
polygon(shape);
|
polygon(shape);
|
||||||
|
|
||||||
for(tri = tris) {
|
for(tri = tris) {
|
||||||
#offset(-.1)
|
#offset(-.1)
|
||||||
polygon([for(idx = tri) shape[idx]]);
|
polygon([for(idx = tri) shape[idx]]);
|
||||||
|
@@ -1,14 +0,0 @@
|
|||||||
include <hull_polyline2d.scad>;
|
|
||||||
include <trim_shape.scad>;
|
|
||||||
include <shape_taiwan.scad>;
|
|
||||||
include <bijection_offset.scad>;
|
|
||||||
include <midpt_smooth.scad>;
|
|
||||||
|
|
||||||
taiwan = shape_taiwan(50);
|
|
||||||
offseted = bijection_offset(taiwan, -2);
|
|
||||||
trimmed = trim_shape(offseted, 3, len(offseted) - 6);
|
|
||||||
smoothed = midpt_smooth(trimmed, 3);
|
|
||||||
|
|
||||||
#hull_polyline2d(taiwan, .1);
|
|
||||||
%translate([25, 0, 0]) hull_polyline2d(offseted, .2);
|
|
||||||
hull_polyline2d(smoothed, .1);
|
|
@@ -1,6 +1,3 @@
|
|||||||
trim_shape
|
|
||||||
trim_shape_demo.scad
|
|
||||||
|
|
||||||
triangulate
|
triangulate
|
||||||
triangulate_demo.scad
|
triangulate_demo.scad
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user