mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-01-01 09:49:45 +00:00
Bad use of unit() in debug_polyhedron()
This commit is contained in:
parent
14e013cd13
commit
87c8adef65
2 changed files with 10 additions and 9 deletions
17
debug.scad
17
debug.scad
|
@ -191,16 +191,17 @@ module debug_faces(vertices, faces, size=1, disabled=false) {
|
||||||
if (face[0] < 0 || face[1] < 0 || face[2] < 0 || face[0] >= vlen || face[1] >= vlen || face[2] >= vlen) {
|
if (face[0] < 0 || face[1] < 0 || face[2] < 0 || face[0] >= vlen || face[1] >= vlen || face[2] >= vlen) {
|
||||||
echo("BAD FACE: ", vlen=vlen, face=face);
|
echo("BAD FACE: ", vlen=vlen, face=face);
|
||||||
} else {
|
} else {
|
||||||
v0 = vertices[face[0]];
|
verts = select(vertices,face);
|
||||||
v1 = vertices[face[1]];
|
c = mean(verts);
|
||||||
v2 = vertices[face[2]];
|
v0 = verts[0];
|
||||||
c = mean(select(vertices,face));
|
v1 = verts[1];
|
||||||
|
v2 = verts[2];
|
||||||
dv0 = unit(v1 - v0);
|
dv0 = unit(v1 - v0);
|
||||||
dv1 = unit(v2 - v0);
|
dv1 = unit(v2 - v0);
|
||||||
nrm0 = unit(cross(dv0, dv1));
|
nrm0 = cross(dv0, dv1);
|
||||||
nrm1 = [0, 0, 1];
|
nrm1 = UP;
|
||||||
axis = unit(cross(nrm0, nrm1));
|
axis = vector_axis(nrm0, nrm1);
|
||||||
ang = vector_angle(nrm0, nrm1);
|
ang = vector_angle(nrm0, nrm1);
|
||||||
theta = atan2(nrm0[1], nrm0[0]);
|
theta = atan2(nrm0[1], nrm0[0]);
|
||||||
translate(c) {
|
translate(c) {
|
||||||
rotate(a=180-ang, v=axis) {
|
rotate(a=180-ang, v=axis) {
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
BOSL_VERSION = [2,0,393];
|
BOSL_VERSION = [2,0,394];
|
||||||
|
|
||||||
|
|
||||||
// Section: BOSL Library Version Functions
|
// Section: BOSL Library Version Functions
|
||||||
|
|
Loading…
Reference in a new issue