mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-11 17:24:20 +02:00
add doc
This commit is contained in:
BIN
docs/images/lib-bijection_offset-1.JPG
Normal file
BIN
docs/images/lib-bijection_offset-1.JPG
Normal file
Binary file not shown.
After Width: | Height: | Size: 36 KiB |
BIN
docs/images/lib-bijection_offset-2.JPG
Normal file
BIN
docs/images/lib-bijection_offset-2.JPG
Normal file
Binary file not shown.
After Width: | Height: | Size: 39 KiB |
67
docs/lib-bijection_offset.md
Normal file
67
docs/lib-bijection_offset.md
Normal file
@@ -0,0 +1,67 @@
|
||||
# bijection_offset
|
||||
|
||||
Move 2D outlines outward or inward by a given amount. Each point of the offsetted shape is paired with exactly one point of the original shape.
|
||||
|
||||
|
||||
|
||||
## Parameters
|
||||
|
||||
- `pts` : Points of a shape.
|
||||
- `d` : Amount to offset the shape. When negative, the shape is offset inwards.
|
||||
|
||||
## Examples
|
||||
|
||||
include <bijection_offset.scad>;
|
||||
|
||||
shape = [
|
||||
[15, 0],
|
||||
[15, 30],
|
||||
[0, 20],
|
||||
[-15, 40],
|
||||
[-15, 0]
|
||||
];
|
||||
|
||||
color("red") polygon(bijection_offset(shape, 3));
|
||||
color("orange") polygon(bijection_offset(shape, 2));
|
||||
color("yellow") polygon(bijection_offset(shape, 1));
|
||||
color("green") polygon(shape);
|
||||
color("blue") polygon(bijection_offset(shape, -1));
|
||||
color("indigo") polygon(bijection_offset(shape, -2));
|
||||
color("purple") polygon(bijection_offset(shape, -3));
|
||||
|
||||

|
||||
|
||||
include <bijection_offset.scad>;
|
||||
include <rotate_p.scad>;
|
||||
include <polysections.scad>;
|
||||
include <path_extrude.scad>;
|
||||
include <bezier_curve.scad>;
|
||||
|
||||
shape = [
|
||||
[5, 0],
|
||||
[3, 9],
|
||||
[0, 10],
|
||||
[-5, 0]
|
||||
];
|
||||
offsetted = bijection_offset(shape, 1);
|
||||
|
||||
offsetted2 = bijection_offset(shape, 2);
|
||||
offsetted3 = bijection_offset(shape, 3);
|
||||
|
||||
t_step = 0.05;
|
||||
|
||||
p0 = [0, 0, 0];
|
||||
p1 = [40, 60, 35];
|
||||
p2 = [-50, 70, 0];
|
||||
p3 = [20, 150, -35];
|
||||
p4 = [30, 50, -3];
|
||||
|
||||
path_pts = bezier_curve(t_step,
|
||||
[p0, p1, p2, p3, p4]
|
||||
);
|
||||
|
||||
path_extrude(concat(shape, offsetted), path_pts, "HOLLOW");
|
||||
path_extrude(concat(offsetted2, offsetted3), path_pts, "HOLLOW");
|
||||
|
||||

|
||||
|
Reference in New Issue
Block a user