I've been looking for an answer to this question for quite some time,
but in the end it turned out easier than I thought. I've defined 3
points (P1, P2 and P3) in space that I want to lay flat (i.e.
parallel to the X - Y plane). Firstly, I translate P1 to the origin
so I get what I described in the question, then I take the
cross-product of the two other (translated) points, en determine the
spherical coordinates of the endpoint of this product. Then 2
rotations will rotate this vector to make it point in the direction
of the Z-axis. The rotated points P1', P2' and P3' are not in the X -
Y plane, but that is no problem, the slicer will fix that.
Maurice
P1=[1,2,3];
P2=[3,4,5];
P3=[-5,6,1];
D=.3;
hull(){ // original plane
translate(P1)
sphere(D);
translate(P2)
sphere(D);
translate(P3)
sphere(D);
}
P12=P2-P1; // translate P1 to origin
P13=P3-P1;
Cr=cross(P12,P13); // calculate cross product
R=norm(Cr); // calculate spherical coordinates
Inclin=acos(Cr.z/R);
Azim=atan2(Cr.y,Cr.x);
rotate([0,-Inclin,0]) // and rotate accodingly
rotate([0,0,-Azim])
color("Red")
hull(){ // rotated plane
translate(P1)
sphere(D);
translate(P2)
sphere(D);
translate(P3)
sphere(D);
}
Hi,
A plane is defined by O, X (x1,x2,x3) and Y (y1,y2,y3). What is the
(simplest) way to rotate this plane so that O stays O and both X and
Y rotate to the x, y plane (immaterial where)?
I want to lay an object flat on my printer table, and Cura refuses
to do it unfortunately...
Thanks,
Maurice