[solved] Wrong math? May 30, 2015 11:38AM |
Registered: 9 years ago Posts: 5,232 |
union(){ translate ([40,0,10])mirror([1,0,1]){ translate ([0,0,10])difference(){ cube([10,10,20]); translate([5,5,-0.001]) cylinder(h=20.002,r=3); } } translate ([0,40,10])mirror([0,1,1]){ translate ([0,0,10])difference(){ cube([10,10,20]); translate([5,5,-0.001]) cylinder(h=20.002,r=3); } } translate ([0,0,10])difference(){ cube([10,10,20]); translate([5,5,-0.001]) cylinder(h=20.002,r=3); } //45° struts #translate([10*sin(45),0,10+5*sin(45)])rotate([0,45,0]) difference(){ cube([10,10,20]); translate([5,5,-0.001]) cylinder(h=20.002,r=3); } #translate([0,10*sin(45),10+5*sin(45)]) rotate([-45,0,0])difference(){ cube([10,10,20]); translate([5,5,-0.001]) cylinder(h=20.002,r=3); } cube(10); }
Re: Wrong math? May 30, 2015 07:49PM |
Admin Registered: 12 years ago Posts: 1,063 |
Quote
o_lampe
Hi guys,
I tried to rotate a cube 45° and translate it to the right position, but the result leaves a small gap I cannot explain.
See the #highlighted code at the end and the screenshot.
What´s wrong with my math?
-Olaf
union(){ translate ([40,0,10])mirror([1,0,1]){ translate ([0,0,10])difference(){ cube([10,10,20]); translate([5,5,-0.001]) cylinder(h=20.002,r=3); } } translate ([0,40,10])mirror([0,1,1]){ translate ([0,0,10])difference(){ cube([10,10,20]); translate([5,5,-0.001]) cylinder(h=20.002,r=3); } } translate ([0,0,10])difference(){ cube([10,10,20]); translate([5,5,-0.001]) cylinder(h=20.002,r=3); } //45° struts #translate([10*sin(45),0,10+5*sin(45)])rotate([0,45,0]) difference(){ cube([10,10,20]); translate([5,5,-0.001]) cylinder(h=20.002,r=3); } #translate([0,10*sin(45),10+5*sin(45)]) rotate([-45,0,0])difference(){ cube([10,10,20]); translate([5,5,-0.001]) cylinder(h=20.002,r=3); } cube(10); }
union(){ translate ([40,0,10])mirror([1,0,1]){ translate ([0,0,10])difference(){ cube([10,10,20]); translate([5,5,-0.001]) cylinder(h=20.002,r=3); } } translate ([0,40,10])mirror([0,1,1]){ translate ([0,0,10])difference(){ cube([10,10,20]); translate([5,5,-0.001]) cylinder(h=20.002,r=3); } } translate ([0,0,10])difference(){ cube([10,10,20]); translate([5,5,-0.001]) cylinder(h=20.002,r=3); } //45° struts difference(){ translate([10,5,10])rotate([0,45,0])translate([0,0,10])cube([10,10,20],center = true); translate([10,5,10])rotate([0,45,0])cylinder(h=20.002,r=3); } difference(){ #translate([5,10,10])rotate([0,45,90])translate([0,0,10])cube([10,10,20],center = true); translate([5,10,10])rotate([0,45,90])cylinder(h=20.002,r=3); } cube(10); }
Re: Wrong math? May 30, 2015 07:54PM |
Admin Registered: 12 years ago Posts: 1,063 |
Re: Wrong math? May 31, 2015 03:01AM |
Registered: 10 years ago Posts: 590 |
Re: Wrong math? June 01, 2015 05:33AM |
Registered: 9 years ago Posts: 5,232 |
Re: [solved] Wrong math? June 01, 2015 07:57AM |
Registered: 10 years ago Posts: 2,472 |
Re: [solved] Wrong math? June 01, 2015 03:44PM |
Registered: 9 years ago Posts: 5,232 |
Re: [solved] Wrong math? June 01, 2015 06:17PM |
Admin Registered: 12 years ago Posts: 1,063 |
Quote
o_lampe
I got it
But what still puzzles me is the "rotation centerpoint" function [CTRL] + 3
I would expect it to go through [0,0,0], but it is "somewhere, out there"
And it is not related to the real rotation.
Is it only for the "camera"?
-Olaf