[OpenSCAD] finding angle from a coordinate

Felipe Sanches juca at members.fsf.org
Wed Oct 12 21:55:26 EDT 2016


decompose it into a couple rotates and use some trigonometry:

$fn=30;

X = 3;

Y = 4;

Z = 5;

R = 1;


rotate([0,0,atan(Y/X)])

rotate([0, atan(sqrt(X*X + Y*Y) / Z), 0])

cylinder(r = R, h = sqrt(X*X + Y*Y + Z*Z));


color("red")

translate([X,Y,Z])

sphere(r=R);






2016-10-12 22:26 GMT-03:00 tony873004 <tony at gravitysimulator.com>:
> I have a column with a radius of 1.
> The column's base is located at 0,0,0, and its top is located at 3,4,5.
> As I understand it, to orient the column I need to use rotate, rather than
> specify the endpoint.
> [code]
> translate([0,0,0]) {
>   rotate([a,b,c]) {
>     cylinder(r = 1, h = 7.071);
> }
> }
> [/code]
> How would I go about finding the angles a,b,c, knowing the endpoint?
> Thanks!
>
>
>
>
> --
> View this message in context: http://forum.openscad.org/finding-angle-from-a-coordinate-tp18684.html
> Sent from the OpenSCAD mailing list archive at Nabble.com.
>
> _______________________________________________
> OpenSCAD mailing list
> Discuss at lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org




More information about the Discuss mailing list