mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-20 13:31:30 +02:00
calculate r_base directly
This commit is contained in:
@@ -1,5 +1,3 @@
|
|||||||
use <../../util/sum.scad>;
|
|
||||||
|
|
||||||
function _tri_subdivide(points, detail) =
|
function _tri_subdivide(points, detail) =
|
||||||
let(
|
let(
|
||||||
rows = detail + 1,
|
rows = detail + 1,
|
||||||
@@ -13,8 +11,8 @@ function _tri_subdivide(points, detail) =
|
|||||||
for(ci = [0:cols])
|
for(ci = [0:cols])
|
||||||
points[0] + ci * dc + ri * dr
|
points[0] + ci * dc + ri * dr
|
||||||
],
|
],
|
||||||
pre_n = concat([0], [for(ri = [0:rows]) rows - ri + 1]),
|
ri_base = [for(ri = 0, acc = 0; ri <= rows; ri = ri + 1, acc = acc + rows - ri + 2) acc],
|
||||||
idx = function(ci, ri) ci + sum([for(i = [0:ri]) pre_n[i]]),
|
idx = function(ci, ri) ci + ri_base[ri],
|
||||||
faces = [
|
faces = [
|
||||||
for(ri = [0:rows - 1])
|
for(ri = [0:rows - 1])
|
||||||
let(cols = rows - ri - 1)
|
let(cols = rows - ri - 1)
|
||||||
|
Reference in New Issue
Block a user