POV-Ray : Newsgroups : povray.general : [math]: object rotation problem : Re: [math]: object rotation problem Server Time
13 Aug 2024 11:14:43 EDT (-0400)
  Re: [math]: object rotation problem  
From: Johannes Hubert
Date: 10 Sep 1998 11:12:39
Message: <35f7de57.0@news.povray.org>
Hi!

>.THE QUESTION :
>
>How do i rotate an arbitrary object around an arbitrary axis ?
>I've tried various combinations of rotate but they don't work.
>I imagine i need to use a matrix, but linear algebra was a long time ago
>and i'm at loss. Can someone please help me ?


In general:
Translate the object until the rotation axis runs through the origin. Rotate
two times now, each time around one of the main axis (different ones) until
the rotation axis falls into one of the three main-axis. Then do the
rotation for the desired angle around this axis. And repeat everything
backwards...

I have appended C++ source-code which shows you how to rotate a point around
an arbitrary axis. With a little work you should be able to convert it into
POV code. When using POV 3.1, you could even make a macro out of it:
Macro for rotation of an object around  an arbitrary axis! Now, wouldn't
that be something POV-users would like?
Maybe somebody else would like to do it?

Greetings,
Johannes.


Post a reply to this message


Attachments:
Download 'rotation.txt' (13 KB)

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.