1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-04-13 02:31:58 +02:00

added polytransversals

This commit is contained in:
Justin Lin 2017-04-30 16:47:23 +08:00
parent aea69f60db
commit 96c1e517d6
6 changed files with 43 additions and 1 deletions

View File

@ -32,6 +32,7 @@ Some modules may depend on other modules. For example, the `polyline2d` module d
- [circular_sector](https://openhome.cc/eGossip/OpenSCAD/lib-circular_sector.html)
- [arc](https://openhome.cc/eGossip/OpenSCAD/lib-arc.html)
- [hexagons](https://openhome.cc/eGossip/OpenSCAD/lib-hexagons.html)
- [polytransversals](https://openhome.cc/eGossip/OpenSCAD/lib-polytransversals.html)
- 3D
- [rounded_cube](https://openhome.cc/eGossip/OpenSCAD/lib-rounded_cube.html)

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -0,0 +1,42 @@
# polytransversals
Crosscutting a polyline at different points gets several transversals. This module can operate reversely. It uses transversals to construct a polyline. For example, imagine that you have the following transversals:
![polytransversals](images/lib-polytransversals-1.JPG)
This module can use them to construct the polyline:
![polytransversals](images/lib-polytransversals-2.JPG)
When using this module, you should use points to represent each transversal.
You can view it as a better polyline2d module. If you have only the points of a path, using `polyline2d` or `hull_polyline2d` is a simple solution. If you know the transversals along a path, you can use `polytransversals` to get a better polyline.
## Parameters
- `transversals` : A list of transversals. Each transversal is represented by a list of points. See the example below.
## Examples
include <rotate_p.scad>;
include <polytransversals.scad>;
include <hull_polyline2d.scad>;
r = 35;
tran_pts = [[-5, 0], [0, 5], [5, 0]];
trans = [
for(a = [0:10:120])
[
for(p = tran_pts)
rotate_p(p, [0, 0, a]) + [r * cos(a), r * sin(a)]
]
];
polytransversals(trans);
#for(tran = trans) {
hull_polyline2d(tran, 0.5);
}
![polytransversals](images/lib-polytransversals-3.JPG)

View File

@ -3,7 +3,6 @@
*
* Crosscutting a polyline at different points gets several transversals.
* This module can operate reversely. It uses transversals to construct a polyline.
*
* @copyright Justin Lin, 2017
* @license https://opensource.org/licenses/lgpl-3.0.html
*