mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-07-31 03:50:27 +02:00
add doc
This commit is contained in:
@@ -404,6 +404,12 @@ These examples incubate dotSCAD and dotSCAD refactors these examples. See [examp
|
||||
--|--
|
||||
[**matrix/m_replace**(m, i, j, value)](https://openhome.cc/eGossip/OpenSCAD/lib3x-m_replace.html) | replace the aᵢⱼ element of a matrix.
|
||||
|
||||
## Triangle
|
||||
|
||||
Signature | Description
|
||||
--|--
|
||||
[**triangle/tri_subdivide**(shape_pts[, n])](https://openhome.cc/eGossip/OpenSCAD/lib3x-tri_subdivide.html) | subdivide a triangle `n` times.
|
||||
|
||||
## Point Picking
|
||||
|
||||
Signature | Description
|
||||
|
BIN
docs/images/lib3x-tri_subdivide-1.JPG
Normal file
BIN
docs/images/lib3x-tri_subdivide-1.JPG
Normal file
Binary file not shown.
After Width: | Height: | Size: 32 KiB |
31
docs/lib3x-tri_subdivide.md
Normal file
31
docs/lib3x-tri_subdivide.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# tri_subdivide
|
||||
|
||||
Subdivide a triangle `n` times.
|
||||
|
||||
**Since:** 3.3
|
||||
|
||||
## Parameters
|
||||
|
||||
- `shape_pts` : the vertices of a 2D or 3D triangle.
|
||||
- `n` : subdivide a triangle `n` times. Default to 1.
|
||||
|
||||
## Examples
|
||||
|
||||
use <shape_circle.scad>
|
||||
use <triangle/tri_subdivide.scad>
|
||||
|
||||
radius = 10;
|
||||
tri = shape_circle(radius, $fn = 3);
|
||||
|
||||
polygon(tri);
|
||||
|
||||
for(n = [1:3]) {
|
||||
subdivided = tri_subdivide(tri, n);
|
||||
translate([radius * 2 * n, 0])
|
||||
for(t = subdivided) {
|
||||
offset(-.1)
|
||||
polygon(t);
|
||||
}
|
||||
}
|
||||
|
||||

|
@@ -4,8 +4,6 @@ to_do:
|
||||
|
||||
new:
|
||||
|
||||
- triangle/tri_subdivide
|
||||
|
||||
- mz_hamiltonian supports init_cells
|
||||
|
||||
update doc mz_square_initialize
|
||||
@@ -33,4 +31,6 @@ doc-ed
|
||||
- util/sorted, util/binary_search, util/contains
|
||||
- maze/mz_square, maze/mz_theta, maze/mz_squarewalls, maze/mz_hexwalls, maze/mz_tiles
|
||||
- matrix/m_replace
|
||||
- triangle/tri_subdivide
|
||||
|
||||
|
||||
|
@@ -1,6 +1,16 @@
|
||||
/**
|
||||
* tri_subdivide.scad
|
||||
*
|
||||
* @copyright Justin Lin, 2022
|
||||
* @license https://opensource.org/licenses/lgpl-3.0.html
|
||||
*
|
||||
* @see https://openhome.cc/eGossip/OpenSCAD/lib3x-tri_subdivide.html
|
||||
*
|
||||
**/
|
||||
|
||||
use <_impl/_tri_subdivide_impl.scad>
|
||||
|
||||
function tri_subdivide(shape_pts, n) =
|
||||
function tri_subdivide(shape_pts, n = 1) =
|
||||
n == 0 ? [shape_pts] :
|
||||
let(
|
||||
pts = _tri_subdivide_pts(shape_pts, n + 1),
|
||||
|
Reference in New Issue
Block a user