mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-01-17 06:08:31 +01:00
add doc
This commit is contained in:
parent
4e0d3e8d28
commit
ce475031b0
@ -358,7 +358,7 @@ These examples incubate dotSCAD and dotSCAD refactors these examples. See [examp
|
||||
[**triangle/tri_circumcenter**(shape_pts)](https://openhome.cc/eGossip/OpenSCAD/lib3x-tri_circumcenter.html) | return the circumcenter of a triangle.
|
||||
[**triangle/tri_incenter**(shape_pts)](https://openhome.cc/eGossip/OpenSCAD/lib3x-tri_incenter.html) | return the incenter of a triangle.
|
||||
[**triangle/tri_ear_clipping**(shape_pts, ret = "TRI_INDICES", ...)](https://openhome.cc/eGossip/OpenSCAD/lib3x-tri_ear_clipping.html) | triangulation by [ear clipping](https://en.wikipedia.org/wiki/Polygon_triangulation#Ear_clipping_method).
|
||||
**triangle/tri_delaunay**(points, ret = "TRI_INDICES") | return the [Delaunay triangulation](https://en.wikipedia.org/wiki/Delaunay_triangulation) of the points.
|
||||
[**triangle/tri_delaunay**(points, ret = "TRI_INDICES")](https://openhome.cc/eGossip/OpenSCAD/lib3x-tri_delaunay.html) | Join a set of points to make a [Delaunay triangulation](https://en.wikipedia.org/wiki/Delaunay_triangulation).
|
||||
**triangle/tri_delaunay_indices**(d) | return triangle indices from a delaunay object.
|
||||
**triangle/tri_delaunay_shapes**(d) | return triangle shapes from a delaunay object.
|
||||
**triangle/tri_delaunay_voronoi**(d) | return [Voronoi](https://en.wikipedia.org/wiki/Voronoi_diagram) cells from a delaunay object.
|
38
docs/lib3x-tri_delaunay.md
Normal file
38
docs/lib3x-tri_delaunay.md
Normal file
@ -0,0 +1,38 @@
|
||||
# tri_delaunay
|
||||
|
||||
Join a set of points to make a [Delaunay triangulation](https://en.wikipedia.org/wiki/Delaunay_triangulation).
|
||||
|
||||
**Since:** 3.0
|
||||
|
||||
## Parameters
|
||||
|
||||
- `points` : A list of points.
|
||||
- `ret` : The type of returned data. Default to `"TRI_INDICES"` which returns the indices of the `points`. `"TRI_SHAPES"` returns triangle shapes. `"VORONOI_CELLS"` returns voronoi cells. `"DELAUNAY"` returns a delaunay object which can be processed by [`tri_delaunay_indices`](lib3x-tri_delaunay_indices.html), [`tri_delaunay_shapes`](lib3x-tri_delaunay_shapes.html) and [`tri_delaunay_voronoi`](lib3x-tri_delaunay_voronoi.html).
|
||||
|
||||
## Examples
|
||||
|
||||
use <triangle/tri_delaunay.scad>;
|
||||
use <hull_polyline2d.scad>;
|
||||
|
||||
points = [for(i = [0:20]) rands(-100, 100, 2)];
|
||||
|
||||
tris = [for(ti = tri_delaunay(points)) [for(i = ti) points[i]]];
|
||||
linear_extrude(1)
|
||||
for(t = tri_delaunay(points, ret = "TRI_SHAPES")) {
|
||||
polygon(t);
|
||||
}
|
||||
|
||||
color("black")
|
||||
linear_extrude(2)
|
||||
for(t = tri_delaunay(points, ret = "TRI_SHAPES")) {
|
||||
offset(-1)
|
||||
polygon(t);
|
||||
}
|
||||
|
||||
color("red")
|
||||
linear_extrude(3)
|
||||
for(t = tri_delaunay(points, ret = "VORONOI_CELLS")) {
|
||||
hull_polyline2d(concat(t, [t[0]]), 2);
|
||||
}
|
||||
|
||||
![tri_delaunay](images/lib3x-tri_delaunay-1.JPG)
|
@ -1,13 +0,0 @@
|
||||
use <triangle/tri_delaunay.scad>;
|
||||
use <hull_polyline2d.scad>;
|
||||
|
||||
points = [for(i = [0:20]) rands(-100, 100, 2)];
|
||||
|
||||
draw([for(ti = tri_delaunay(points)) [for(i = ti) points[i]]]);
|
||||
%draw(tri_delaunay(points, ret = "TRI_SHAPES"));
|
||||
|
||||
module draw(pointsOfTriangles) {
|
||||
for(t = pointsOfTriangles) {
|
||||
hull_polyline2d(concat(t, [t[0]]));
|
||||
}
|
||||
}
|
@ -1,3 +1,13 @@
|
||||
/**
|
||||
* tri_circumcenter.scad
|
||||
*
|
||||
* @copyright Justin Lin, 2021
|
||||
* @license https://opensource.org/licenses/lgpl-3.0.html
|
||||
*
|
||||
* @see https://openhome.cc/eGossip/OpenSCAD/lib3x-tri_delaunay.html
|
||||
*
|
||||
**/
|
||||
|
||||
use <_impl/_tri_delaunay_impl.scad>;
|
||||
use <tri_delaunay_shapes.scad>;
|
||||
use <tri_delaunay_indices.scad>;
|
||||
|
Loading…
x
Reference in New Issue
Block a user