mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2024-12-29 16:29:40 +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) {
|
||||
echo("BAD FACE: ", vlen=vlen, face=face);
|
||||
} else {
|
||||
v0 = vertices[face[0]];
|
||||
v1 = vertices[face[1]];
|
||||
v2 = vertices[face[2]];
|
||||
c = mean(select(vertices,face));
|
||||
verts = select(vertices,face);
|
||||
c = mean(verts);
|
||||
v0 = verts[0];
|
||||
v1 = verts[1];
|
||||
v2 = verts[2];
|
||||
dv0 = unit(v1 - v0);
|
||||
dv1 = unit(v2 - v0);
|
||||
nrm0 = unit(cross(dv0, dv1));
|
||||
nrm1 = [0, 0, 1];
|
||||
axis = unit(cross(nrm0, nrm1));
|
||||
ang = vector_angle(nrm0, nrm1);
|
||||
nrm0 = cross(dv0, dv1);
|
||||
nrm1 = UP;
|
||||
axis = vector_axis(nrm0, nrm1);
|
||||
ang = vector_angle(nrm0, nrm1);
|
||||
theta = atan2(nrm0[1], nrm0[0]);
|
||||
translate(c) {
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue