Welcome! Log In Create A New Profile

Advanced

help with my poor maths

Posted by appjaws1 
help with my poor maths
January 30, 2016 10:15AM
I need to attach qty3, 6mm diameter x 20mm length rods equal distance on the attached scad and 1mm in from the edge, The rods need to be 90 degrees to the slope and 120 degrees apart

I have tried many ways ( all wrong, I just can't get my head round this multi angled problem due to poor maths.

Can anybody help please?


the script:-
$fn=100;
cylinder(h=4,r=13.5);
translate([0,0,4]) cylinder(h=5,r1=13.5,r2=6);




appjaws - Ormerod 1, core XY
Duet wifi, duex5
firmware 1.18
Web Interface 1.15a
OpenSCAD 2015.03
slic3r-1.33.8-prusa3d and/or Simplify3D 3.1.1
Re: help with my poor maths
January 30, 2016 11:20PM
Do you mean something like that?



$fn=100;
cylinder(h=4,r=13.5);
translate([0,0,4]) cylinder(h=5,r1=13.5,r2=6);
for(a=[0:120:359])
  rotate(a)translate([13.5,0,4])
     rotate([0,atan2(5,13.5-6),0])
        translate([-6/2-1,0,0])
        cylinder(r=3,h=20);


Re: help with my poor maths
January 31, 2016 01:41AM
perfect, thank you.
atan2 eh! never heard of it before.


appjaws - Ormerod 1, core XY
Duet wifi, duex5
firmware 1.18
Web Interface 1.15a
OpenSCAD 2015.03
slic3r-1.33.8-prusa3d and/or Simplify3D 3.1.1
Re: help with my poor maths
February 01, 2016 06:09AM
Quote
appjaws1
perfect, thank you.
atan2 eh! never heard of it before.

It is very similar to atan except that it uses both X and Y instead of X/Y as an argument to return an angle that is in the correct quadrant. atan can only return a value between -90 and +90 degrees.

e.g. imagine a point that is at location X=1 Y=1. To find the angle from the origin you could use atan(X/Y) which correctly gives you 45 degrees. But imagine that the point is at coordinate X= -1, Y= -1 In that case X/Y is still 1, so atan will return the same angle of 45 degrees.

Using atan2 allows you to enter both X and Y coordinates which will give you the correct angle of 225 degrees (openscad returns -135 degrees which is the same thing).

Dave
Re: help with my poor maths
February 01, 2016 11:01AM
Thanks for the info Dave


appjaws - Ormerod 1, core XY
Duet wifi, duex5
firmware 1.18
Web Interface 1.15a
OpenSCAD 2015.03
slic3r-1.33.8-prusa3d and/or Simplify3D 3.1.1
Sorry, only registered users may post in this forum.

Click here to login