Welcome! Log In Create A New Profile

Advanced

help with my poor maths

Posted by appjaws1 
help with my poor maths
January 30, 2016 01:15PM
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 - Core XYUV Duet Ethernet Duex5
firmware 3.1.1 Web Interface 3.1.1
Ormerod 1-converted to laser engraver, Duet wifi
OpenSCAD version 2020.07
slic3r-1.3.0, Simplify3D 4.1.2, Cura-4.4.1
Re: help with my poor maths
January 31, 2016 02:20AM
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 04:41AM
perfect, thank you.
atan2 eh! never heard of it before.


appjaws - Core XYUV Duet Ethernet Duex5
firmware 3.1.1 Web Interface 3.1.1
Ormerod 1-converted to laser engraver, Duet wifi
OpenSCAD version 2020.07
slic3r-1.3.0, Simplify3D 4.1.2, Cura-4.4.1
Re: help with my poor maths
February 01, 2016 09: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 02:01PM
Thanks for the info Dave


appjaws - Core XYUV Duet Ethernet Duex5
firmware 3.1.1 Web Interface 3.1.1
Ormerod 1-converted to laser engraver, Duet wifi
OpenSCAD version 2020.07
slic3r-1.3.0, Simplify3D 4.1.2, Cura-4.4.1
Sorry, only registered users may post in this forum.

Click here to login