discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: [OpenSCAD] Rotation question

NH
nop head
Sun, Dec 16, 2018 10:05 AM

Not sure what what you mean exactly by X(x1,x2,x3) but if you have a plane
defined by three points you can calculate its normal by taking the cross
product of two vectors between the points.

If you do that for two planes then you have two normals and you need to
rotate on to match the other. The is a neat way to do that with mirror that
had been posted in the forum.

If you are taking about 3d printer bed leveling then this might help:
http://hydraraptor.blogspot.com/2011/04/auto-bed-leveling.html

On Sun, 16 Dec 2018, 03:00 Maurice van Peursem <openscad@vanpeursem.net
wrote:

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


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Not sure what what you mean exactly by X(x1,x2,x3) but if you have a plane defined by three points you can calculate its normal by taking the cross product of two vectors between the points. If you do that for two planes then you have two normals and you need to rotate on to match the other. The is a neat way to do that with mirror that had been posted in the forum. If you are taking about 3d printer bed leveling then this might help: http://hydraraptor.blogspot.com/2011/04/auto-bed-leveling.html On Sun, 16 Dec 2018, 03:00 Maurice van Peursem <openscad@vanpeursem.net wrote: > 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 > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
RP
Ronaldo Persiano
Sun, Dec 16, 2018 3:04 PM

Complementing @nophead suggestion, you may find a rotation that brings the
plane normal cross(X-O, Y-O) to [0,0,1] either as a matrix frotFromTo or a
module rotFromTo, both found in

http://forum.openscad.org/Mirror-rotations-and-sweep-td21256.html

Complementing @nophead suggestion, you may find a rotation that brings the plane normal cross(X-O, Y-O) to [0,0,1] either as a matrix frotFromTo or a module rotFromTo, both found in http://forum.openscad.org/Mirror-rotations-and-sweep-td21256.html > >
RW
Rogier Wolff
Sun, Dec 16, 2018 3:05 PM

On Sun, Dec 16, 2018 at 10:05:31AM +0000, nop head wrote:

Not sure what what you mean exactly by X(x1,x2,x3) but if you have a plane
defined by three points you can calculate its normal by taking the cross
product of two vectors between the points.

That's not  what he's asking.  We have  a  point X  defined  by three
coordinates (x,y,z) = (x1, x2, x3)

Then he wants to rotate space, such that this point will rotate to
somewhere on the XY plane.

I will chose to rotate around the X axis. To visualize this, project
everything onto the YZ plane. So our point (x1, x2, x3) becomes (0,
x2, x3). Now when we rotate this by -atan (x3/x2) our point should end
up on the XY  plane.

Alas I now don't know how to get the coordinates of the rotated X point,
but you can calculate it with something like:
x1' = x1
x2' = x2 * cos (-atan(x3/x2)) - x3 * sin(-atan(x3/x2));
x3' = x3 * cos (-atan(x3/x2)) - x2 * sin(-atan(x3/x2));

Recalculate Y' the same way.

Now we can rotate along the Z axis. to make X'' coincide with the
positive X axis. Again a rotation by an angle with -atan
(something/something) .

Recalculate Y'' as where Y' ends up after this rotation.

Now the only thing we have to do is to rotate by -atan (Y''3/Y''2)
along the X axis again. Voila!

Roger. 

If you do that for two planes then you have two normals and you need to
rotate on to match the other. The is a neat way to do that with mirror that
had been posted in the forum.

If you are taking about 3d printer bed leveling then this might help:
http://hydraraptor.blogspot.com/2011/04/auto-bed-leveling.html

On Sun, 16 Dec 2018, 03:00 Maurice van Peursem <openscad@vanpeursem.net
wrote:

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


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

--
** R.E.Wolff@BitWizard.nl ** http://www.BitWizard.nl/ ** +31-15-2049110 **
**    Delftechpark 11 2628 XJ  Delft, The Netherlands. KVK: 27239233    **
-- BitWizard writes Linux device drivers for any device you may have! --
The plan was simple, like my brother-in-law Phil. But unlike
Phil, this plan just might work.

On Sun, Dec 16, 2018 at 10:05:31AM +0000, nop head wrote: > Not sure what what you mean exactly by X(x1,x2,x3) but if you have a plane > defined by three points you can calculate its normal by taking the cross > product of two vectors between the points. That's not what he's asking. We have a point X defined by three coordinates (x,y,z) = (x1, x2, x3) Then he wants to rotate space, such that this point will rotate to somewhere on the XY plane. I will chose to rotate around the X axis. To visualize this, project everything onto the YZ plane. So our point (x1, x2, x3) becomes (0, x2, x3). Now when we rotate this by -atan (x3/x2) our point should end up on the XY plane. Alas I now don't know how to get the coordinates of the rotated X point, but you can calculate it with something like: x1' = x1 x2' = x2 * cos (-atan(x3/x2)) - x3 * sin(-atan(x3/x2)); x3' = x3 * cos (-atan(x3/x2)) - x2 * sin(-atan(x3/x2)); Recalculate Y' the same way. Now we can rotate along the Z axis. to make X'' coincide with the positive X axis. Again a rotation by an angle with -atan (something/something) . Recalculate Y'' as where Y' ends up after this rotation. Now the only thing we have to do is to rotate by -atan (Y''3/Y''2) along the X axis again. Voila! Roger. > > If you do that for two planes then you have two normals and you need to > rotate on to match the other. The is a neat way to do that with mirror that > had been posted in the forum. > > If you are taking about 3d printer bed leveling then this might help: > http://hydraraptor.blogspot.com/2011/04/auto-bed-leveling.html > > On Sun, 16 Dec 2018, 03:00 Maurice van Peursem <openscad@vanpeursem.net > wrote: > > > 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 > > > > _______________________________________________ > > OpenSCAD mailing list > > Discuss@lists.openscad.org > > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org -- ** R.E.Wolff@BitWizard.nl ** http://www.BitWizard.nl/ ** +31-15-2049110 ** ** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 ** *-- BitWizard writes Linux device drivers for any device you may have! --* The plan was simple, like my brother-in-law Phil. But unlike Phil, this plan just might work.