mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-17 20:11:50 +02:00
use m_transpose
This commit is contained in:
@@ -9,6 +9,8 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
use <_impl/_tri_delaunay_impl.scad>;
|
use <_impl/_tri_delaunay_impl.scad>;
|
||||||
|
use <../matrix/m_transpose.scad>;
|
||||||
|
|
||||||
use <tri_delaunay_shapes.scad>;
|
use <tri_delaunay_shapes.scad>;
|
||||||
use <tri_delaunay_indices.scad>;
|
use <tri_delaunay_indices.scad>;
|
||||||
use <tri_delaunay_voronoi.scad>;
|
use <tri_delaunay_voronoi.scad>;
|
||||||
@@ -17,8 +19,9 @@ use <tri_delaunay_voronoi.scad>;
|
|||||||
function tri_delaunay(points, ret = "TRI_INDICES") =
|
function tri_delaunay(points, ret = "TRI_INDICES") =
|
||||||
let(
|
let(
|
||||||
_indices_hash = function(indices) indices[3],
|
_indices_hash = function(indices) indices[3],
|
||||||
xs = [for(p = points) p.x],
|
transposed = m_transpose(points),
|
||||||
ys = [for(p = points) p.y],
|
xs = transposed[0],
|
||||||
|
ys = transposed[1],
|
||||||
max_x = max(xs),
|
max_x = max(xs),
|
||||||
min_x = min(xs),
|
min_x = min(xs),
|
||||||
max_y = max(ys),
|
max_y = max(ys),
|
||||||
|
@@ -8,11 +8,14 @@
|
|||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
|
||||||
module vrn2_from(points, spacing = 1, r = 0, delta = 0, chamfer = false, region_type = "square") {
|
use <../matrix/m_transpose.scad>;
|
||||||
xs = [for(p = points) p.x];
|
|
||||||
ys = [for(p = points) abs(p.y)];
|
|
||||||
|
|
||||||
region_size = max([(max(xs) - min(xs) / 2), (max(ys) - min(ys)) / 2]);
|
module vrn2_from(points, spacing = 1, r = 0, delta = 0, chamfer = false, region_type = "square") {
|
||||||
|
transposed = m_transpose(points);
|
||||||
|
xs = transposed[0];
|
||||||
|
ys = transposed[1];
|
||||||
|
|
||||||
|
region_size = max([max(xs) - min(xs), max(ys) - min(ys)]);
|
||||||
half_region_size = 0.5 * region_size;
|
half_region_size = 0.5 * region_size;
|
||||||
offset_leng = spacing * 0.5 + half_region_size;
|
offset_leng = spacing * 0.5 + half_region_size;
|
||||||
|
|
||||||
|
@@ -9,13 +9,15 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
use <../__comm__/__angy_angz.scad>;
|
use <../__comm__/__angy_angz.scad>;
|
||||||
|
use <../matrix/m_transpose.scad>;
|
||||||
|
|
||||||
// slow but workable
|
// slow but workable
|
||||||
|
|
||||||
module vrn3_from(points, spacing = 1) {
|
module vrn3_from(points, spacing = 1) {
|
||||||
xs = [for(p = points) p.x];
|
transposed = m_transpose(points);
|
||||||
ys = [for(p = points) abs(p.y)];
|
xs = transposed[0];
|
||||||
zs = [for(p = points) abs(p.z)];
|
ys = transposed[1];
|
||||||
|
zs = transposed[2];
|
||||||
|
|
||||||
space_size = max([max(xs) - min(xs), max(ys) - min(ys), max(zs) - min(zs)]);
|
space_size = max([max(xs) - min(xs), max(ys) - min(ys), max(zs) - min(zs)]);
|
||||||
half_space_size = 0.5 * space_size;
|
half_space_size = 0.5 * space_size;
|
||||||
|
Reference in New Issue
Block a user