doug.moen wrote
The second from the left is a sphere.
All the rest could be done using cylinder.
The middle could be a cube.
The second from right could be a sphere.
Right.
Right.
Wrong.
Right.
--
View this message in context: http://forum.openscad.org/Newbie-with-rotation-problem-tp16873p16914.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
The quiz answer:
translate([-40,0,0]) cylinder(r1=20,r2=0,h=25,$fn=3);
translate([0,0,13]) sphere(15,$fa=180);
translate([35,0,0]) cylinder(r=10*sqrt(2),h=20,$fn=4);
translate([70,0,10]) sphere(15,$fn=3);
translate([105,0,9]) sphere(15,$fn=4);
Although I used spheres in the last two, the same result could be made with
cylinder as dough pointed out.
But, the middle one could be not be made by a cube. Why? Cubes are aligned
with the axis and cylinder starts the base discretization at the x axis.
Well, there were no axis in the image. Yes, but there are two clues of their
directions: the other cylinders and the frame! The frame were made by very
elongated cubes:
translate([-60,-35,-10]) cube([190,0.5,0.5]);
translate([130,-35,-10]) cube([0.5, 70,0.5]);
translate([-60, 35,-10]) cube([190,0.5,0.5]);
translate([-60,-35,-10]) cube([0.5, 70,0.5]);
translate([-60,-35,30]) cube([190,0.5,0.5]);
translate([130,-35,30]) cube([0.5, 70,0.5]);
translate([-60, 35,30]) cube([190,0.5,0.5]);
translate([-60,-35,30]) cube([0.5, 70,0.5]);
translate([-60,-35,-10]) cube([0.5, 0.5,40]);
translate([130, 35,-10]) cube([0.5, 0.5,40]);
translate([-60, 35,-10]) cube([0.5, 0.5,40]);
translate([130,-35,-10]) cube([0.5, 0.5,40]);
so they are aligned with the axis. I could not made them with cylinders
without rotations or scale.
To redeem myself, here is something useful. I have been using those "lines"
a lot to display drawings of polygonals (curves) and meshes for debugging my
surface designs. I even have a module for this:
// p0, p1 points in 3D, thickness number, dots boolean
module line(p0, p1, thickness=1, dots=false) {
function transpose_3_to_4(m) =
[ [m[0][0],m[1][0],m[2][0],0],
[m[0][1],m[1][1],m[2][1],0],
[m[0][2],m[1][2],m[2][2],0],
[0, 0, 0, 1] ];
function unit(v) = v/norm(v);
function rotate_Z_to(t) =
let( t2 = unit(t),
v2 = t2 + [0,0,1],
d = v2 * v2,
d2 = d<1e-6? 1: d,
r2 = unit([1,0,0] - (2/d2) * v2[0] * v2) ,
c2 = unit(cross(r2, t2)))
transpose_3_to_4([ r2, c2, t2 ]);
if (dots) {
translate(p0)
cube(thickness, center=true);
} else {
w = p1-p0;
if (norm(w)>1e-3) {
translate(p0)
multmatrix(rotate_Z_to(w))
cylinder(d=thickness, h=norm(w), $fn=4);
}
}
}
I could have used cube instead of cylinder in that module. If you draw a lot
of polygonals with that, render may expend a lot of time to calculate their
tiny intersection. I use it just for preview.
--
View this message in context: http://forum.openscad.org/Newbie-with-rotation-problem-tp16873p16948.html
Sent from the OpenSCAD mailing list archive at Nabble.com.