POV-Ray : Newsgroups : povray.animations : Need help Rotating Server Time
17 May 2024 05:07:30 EDT (-0400)
  Need help Rotating (Message 1 to 8 of 8)  
From: Charlie
Subject: Need help Rotating
Date: 28 Jan 2006 15:45:01
Message: <web.43dbd7781a56a32b984f60a80@news.povray.org>
Hello, and Thanks ahead of time for any help!!

I'm a chemist and use Povray to render my molecules and it works great.
I've also made short animations of molecules spinning in space, no problem.
 Now I have hard one that I need help with.  I made a simple structure and
I manage to define it into pieces. I want piece 1 to remain stationary, but
I want piece 2 to rotate 180 degrees about and axis.  Sounds easy, but I
can't define this axis, whenever I rotate the molecule, it always uses the
origin (where my wanted rotating piece 2 is no where near) and a second
point that I can define. This generates images of bonds breaking and atoms
flying off.  Can anyone help??  The povray guides keep talking of vectors
and I want to define a vector (<X, Y, Z>, <x, y, z>) as my axis to rotate
around.

Thanks again,

Charlie R.
Univ of NV, Reno


Post a reply to this message

From: Chris B
Subject: Re: Need help Rotating
Date: 28 Jan 2006 16:39:55
Message: <43dbe4ab$1@news.povray.org>
"Charlie" <crr### [at] hotmailcom> wrote in message 
news:web.43dbd7781a56a32b984f60a80@news.povray.org...
>
> Hello, and Thanks ahead of time for any help!!
>
> I'm a chemist and use Povray to render my molecules and it works great.
> I've also made short animations of molecules spinning in space, no 
> problem.
> Now I have hard one that I need help with.  I made a simple structure and
> I manage to define it into pieces. I want piece 1 to remain stationary, 
> but
> I want piece 2 to rotate 180 degrees about and axis.  Sounds easy, but I
> can't define this axis, whenever I rotate the molecule, it always uses the
> origin (where my wanted rotating piece 2 is no where near) and a second
> point that I can define. This generates images of bonds breaking and atoms
> flying off.  Can anyone help??  The povray guides keep talking of vectors
> and I want to define a vector (<X, Y, Z>, <x, y, z>) as my axis to rotate
> around.
>
> Thanks again,
>
> Charlie R.
> Univ of NV, Reno
>
>

In transforms.inc there's an Axis_Rotate_Trans macro.
You should be able to translate your object (the piece you want to rotate) 
to the origin, rotate it around the axis of your choice then translate it 
back.

Regards,
Chris B.


Post a reply to this message

From: Charles C
Subject: Re: Need help Rotating
Date: 29 Jan 2006 02:40:01
Message: <web.43dc7088fd2cbf889926319c0@news.povray.org>
So if I understand this right you've got 2 points in space, call them C and
D, and you want to use the vector from C to D as the axis of rotation of
your molecule-portion...  It sounds like all you need to do is subtract C
from D and then that gets you an appropriete single <X,Y,Z> vector you can
use to use (along with the origin as you mentioned). (Either have the
moving portion built relative to the origin or translate it temporarily to
the origin by translating -C.)  Then after rotating, translate the
molecule-portion over to location C.
not sure if this helps
Charles



"Charlie" <crr### [at] hotmailcom> wrote:
> Hello, and Thanks ahead of time for any help!!
>
> I'm a chemist and use Povray to render my molecules and it works great.
> I've also made short animations of molecules spinning in space, no problem.
>  Now I have hard one that I need help with.  I made a simple structure and
> I manage to define it into pieces. I want piece 1 to remain stationary, but
> I want piece 2 to rotate 180 degrees about and axis.  Sounds easy, but I
> can't define this axis, whenever I rotate the molecule, it always uses the
> origin (where my wanted rotating piece 2 is no where near) and a second
> point that I can define. This generates images of bonds breaking and atoms
> flying off.  Can anyone help??  The povray guides keep talking of vectors
> and I want to define a vector (<X, Y, Z>, <x, y, z>) as my axis to rotate
> around.
>
> Thanks again,
>
> Charlie R.
> Univ of NV, Reno


Post a reply to this message

From: Josh
Subject: Re: Need help Rotating
Date: 30 Jan 2006 11:12:42
Message: <43de3afa$1@news.povray.org>
A trick I use is to always build things I want to animate aound the origin.

The actual point of ratation being at <0,0,0> , and then translate the 
object into position.  So I execute the rotation before the translation.

e.g.

box
    {
    <-1,-1,-1>,<1,1,1>
    rotate <0, clock, clock/2>      // this would be where you apply your 
rotation varaiable
    translate <10,1000,9>           // translate into position
    }


Post a reply to this message

From: Greg M  Johnson
Subject: Re: Need help Rotating
Date: 10 Feb 2006 22:48:12
Message: <43ed5e7c@news.povray.org>
Charlie wrote:
> 
> I'm a chemist and use Povray to render my molecules and it works great.
>


I was trained in chemistry (uh, metallurgical engineering) and am a complete
whiz at doing complex things with povray.  Is there like an easy 2nd
master's thesis that's doable by solving a complex problem 'with' povray?  
Always wondered that.   Or is it like being a whiz at word processing and
thinking therefore you could get an easy law degree.


Post a reply to this message

From: Divine Wind
Subject: Re: Need help Rotating
Date: 3 Jun 2006 13:50:00
Message: <web.4481c5a0fd2cbf883a0196460@news.povray.org>
"Greg M. Johnson" <p t e r a n d o n @ the### [at] startswithYcom>
wrote:
> Charlie wrote:
> >
> > I'm a chemist and use Povray to render my molecules and it works great.
> >
>
>
> I was trained in chemistry (uh, metallurgical engineering) and am a complete
> whiz at doing complex things with povray.  Is there like an easy 2nd
> master's thesis that's doable by solving a complex problem 'with' povray?
> Always wondered that.   Or is it like being a whiz at word processing and
> thinking therefore you could get an easy law degree.

I'm trying to make a human and this rotating thing also seems a little
dificulte to grasp. I understand that all things should first be rotated
around <0,0,0> this is is fine but...
If you have an object say an arm that is attached to something fixed then as
I understand it you should first rotate the arm, then translate it. Then
rotate the fore arm about the <0,0,0> ,or zero point, translate that, but
then rotate and translate it again as I did with the arm...
Now if I have a upper arm, lower arm, a palm, upper fingers, lower fingers,
and finger tips, that is 6 nested objects then is not the code going to
look somthing like this...

FingerTips...
rotate FingersTips
translate FingersTips
rotate LowerFingers
translate LowerFingers
rotate UpperFingers
translate UpperFingers
rotate Palm
translate Palm
rotate ForeArm
translate ForeArm
rotate UpperArm
translate UpperArm
LowerFingers...
rotate LowerFingers
translate LowerFingers
rotate UpperFingers
translate UpperFingers
rotate Palm
translate Palm
rotate ForeArm
translate ForeArm
rotate UpperArm
translate UpperArm
UpperFingers...
rotate UpperFingers
translate UpperFingers
rotate Palm
translate Palm
rotate ForeArm
translate ForeArm
rotate UpperArm
translate UpperArm
Palm...
rotate Palm
translate Palm
rotate ForeArm
translate ForeArm
rotate UpperArm
translate UpperArm
ForeArm...
rotate ForeArm
translate ForeArm
rotate UpperArm
translate UpperArm
UpperArm...
rotate UpperArm
translate UpperArm

Now as I read the sudo code that I have just written 2 things stand out in
my (small) mind.
1) This code looks S**t. So am I missing the point, as I carn't believe that
those great POV team guys would have intended this.
2) How do I use that rotate about an arbarty axis thingy in the inc files.
Or again, am I missing the point.

Sorry for any spelling mistakes I a god at spellliing.


Post a reply to this message

From: Trevor G Quayle
Subject: Re: Need help Rotating
Date: 3 Jun 2006 15:10:00
Message: <web.4481ddd7fd2cbf88c451256c0@news.povray.org>
Try something like this.


union{
  UpperArm
  union{
    ForeArm
    union{
      Palm
      union{
        UpperFingers
        union{
          LowerFingers
          union{
            FingerTips
            rotate FingersTips
            translate FingersTips
          }
          rotate LowerFingers
          translate LowerFingers
        }
        rotate UpperFingers
        translate UpperFingers
      }
      rotate Palm
      translate Palm
    }
    rotate ForeArm
    translate ForeArm
  }
  rotate UpperArm
  translate UpperArm
}

-tgq


Post a reply to this message

From: Chris B
Subject: Re: Need help Rotating
Date: 3 Jun 2006 15:51:05
Message: <4481e829@news.povray.org>
"Divine Wind" <div### [at] hotmailcouk> wrote in message 
news:web.4481c5a0fd2cbf883a0196460@news.povray.org...
> I'm trying to make a human and this rotating thing also seems a little
> dificulte to grasp. I understand that all things should first be rotated
> around <0,0,0> this is is fine but...
> If you have an object say an arm that is attached to something fixed then 
> as
> I understand it you should first rotate the arm, then translate it. Then
> rotate the fore arm about the <0,0,0> ,or zero point, translate that, but
> then rotate and translate it again as I did with the arm...
> Now if I have a upper arm, lower arm, a palm, upper fingers, lower 
> fingers,
> and finger tips, that is 6 nested objects then is not the code going to
> look somthing like this...
>
> FingerTips...
> ... snip ...
>
> Now as I read the sudo code that I have just written 2 things stand out in
> my (small) mind.
> 1) This code looks S**t. So am I missing the point, as I carn't believe 
> that
> those great POV team guys would have intended this.
> 2) How do I use that rotate about an arbarty axis thingy in the inc files.
> Or again, am I missing the point.
>
> Sorry for any spelling mistakes I a god at spellliing.
>

Hi,

When I was doing a human, that's one of the things that I also found to be a 
bit tricky. There are quite a few approaches you could potentially use. I 
settled on one that is quite complex, but it enables me to specify a pose by 
simply defining the rotation of each body part relative to the next. I have 
a set of macros to do the rest. It also means I can 'fix' the location of 
any single body part I wish and it calculates the positions and rotations of 
the rest of the body parts relative to that one fixed part.

Essentially I use a series of arrays to hold the body part definitions and 
joint definitions along with arrays to hold the relative joint rotations. 
Once the pose is set in the joint rotations array I call a macro to 
calculate the absolute rotations and translations necessary to rotate and 
position each body part, calculating out from a fixed body part that I 
define using a control variable. Once this information is calculated I can 
work out the shape of things such as clothing that are dependant upon the 
body part positions and rotations. The clothing is then added into the 
object arrays before calling a macro to build a single object from all of 
the bits.

An alpha copy of the SDL that I wrote is available at 
http://www.geocities.com/povperson/ along with documentation that outlines 
all of the macros and control variables.
In the file povperson.inc there is a macro called ppResolvePose that does 
the main part of the calculation.
You can reuse any of those macros or use them for ideas on creating your own 
if you wish.

You could also just use the body parts you have created to define a figure 
in the right format for povperson, then you get all of the added extras for 
free (e.g. the walking animation, hair, the ability to 'morph' between poses 
etc.)

Regards,
Chris B.


Post a reply to this message

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