POV-Ray : Newsgroups : povray.binaries.utilities : Re: Q: Cylinder caculus? Server Time
1 Nov 2024 07:24:58 EDT (-0400)
  Re: Q: Cylinder caculus? (Message 1 to 6 of 6)  
From: Greg M  Johnson
Subject: Re: Q: Cylinder caculus?
Date: 8 Nov 1998 19:44:48
Message: <36463BBA.3216@aol.com>
I have a similar problem.

I want to have an object with its tail at <0,0,0> and its nose at a
given <x,y,z>.  I want to create it colinear with the X axis and simply
rotate it to be colinear with the <x,y,z> vector.

I've stumped myself on the math for this. How do I do this?

I tried with no success

rotate <0,atan2(z,x)/2/pi*360,atan2(y,x)/2/pi*360>

Thanks for any help.


Post a reply to this message

From: Ron Parker
Subject: Re: Q: Cylinder caculus?
Date: 9 Nov 1998 09:08:24
Message: <3646f758.0@news.povray.org>
On Sun, 08 Nov 1998 19:47:54 -0500, Greg M. Johnson <@aol.com> wrote:
>I have a similar problem.
>
>I want to have an object with its tail at <0,0,0> and its nose at a
>given <x,y,z>.  I want to create it colinear with the X axis and simply
>rotate it to be colinear with the <x,y,z> vector.
>
>I've stumped myself on the math for this. How do I do this?

Go to http://twysted.net/macroscope and look at John VanSickle's 
Reorient macro.  It does exactly what you need.


Post a reply to this message

From: Greg M  Johnson
Subject: Re: Q: Cylinder caculus?
Date: 9 Nov 1998 10:12:36
Message: <36471343.323C@aol.com>
Thanks. 
I just moved and my hard disk is full to the brim. Wife says no new PC
until we finish unpacking, ie., 2001. Thus, I'm putting off going to POV
3.1 for a while.  I understand a bit of matrix algebra, but not the
following line from the recommended macro.  Is there a 3.02 way to do
this?  

matrix < vX1.x, vY.x,vZ1.x, vX1.y,vY.y,vZ1.y, vX1.z,vY.z, vZ1.z, 0,0,0 >
matrix < vX2.x,vX2.y,vX2.z,  vY.x,vY.y, vY.z, vZ2.x,vZ2.y,vZ2.z, 0,0,0 >

Particularly, what does  vX1.x  mean?  The period confuses me.  I
understand the vcross and vnormalize functions. 
Thanks again. 


Ron Parker wrote:
> 
> On Sun, 08 Nov 1998 19:47:54 -0500, Greg M. Johnson <@aol.com> wrote:
> >I have a similar problem.
> >
> >I want to have an object with its tail at <0,0,0> and its nose at a
> >given <x,y,z>.  I want to create it colinear with the X axis and simply
> >rotate it to be colinear with the <x,y,z> vector.
> >
> >I've stumped myself on the math for this. How do I do this?
> 
> Go to http://twysted.net/macroscope and look at John VanSickle's
> Reorient macro.  It does exactly what you need.


Post a reply to this message

From: Ron Parker
Subject: Re: Q: Cylinder caculus?
Date: 9 Nov 1998 10:34:34
Message: <36470b8a.0@news.povray.org>
On Mon, 09 Nov 1998 11:07:31 -0500, Greg M. Johnson <> wrote:
>Thanks. 
>I just moved and my hard disk is full to the brim. Wife says no new PC
>until we finish unpacking, ie., 2001. Thus, I'm putting off going to POV
>3.1 for a while.  I understand a bit of matrix algebra, but not the
>following line from the recommended macro.  Is there a 3.02 way to do
>this?  
>
>matrix < vX1.x, vY.x,vZ1.x, vX1.y,vY.y,vZ1.y, vX1.z,vY.z, vZ1.z, 0,0,0 >
>matrix < vX2.x,vX2.y,vX2.z,  vY.x,vY.y, vY.z, vZ2.x,vZ2.y,vZ2.z, 0,0,0 >
>
>Particularly, what does  vX1.x  mean?  The period confuses me.  I
>understand the vcross and vnormalize functions. 
>Thanks again. 

It means "the x component of vX1".  Both of those lines should be legal
POV 3.02 syntax.  But you don't need a new PC, just a new hard drive. :)


Post a reply to this message

From: Greg M  Johnson
Subject: Re: Q: Cylinder caculus?
Date: 9 Nov 1998 22:50:33
Message: <3647B959.5533@aol.com>
Thanks, but that web server for twyst's macro station now appears to be
down. Could you post that tiny little macro here?


Post a reply to this message

From: Ron Parker
Subject: Re: Q: Cylinder caculus?
Date: 10 Nov 1998 08:40:03
Message: <36484233.0@news.povray.org>
On Mon, 09 Nov 1998 22:56:09 -0500, Greg M. Johnson <@aol.com> wrote:
>Thanks, but that web server for twyst's macro station now appears to be
>down. Could you post that tiny little macro here?

I can't get there either; Twyst has a broken CGI script.  Here's an
adaptation of the code, as seen in my rounded cylinder macro.  I've
changed all the 3.1-specific stuff to 3.02 stuff, so you can just
put this in an .inc file.  #declare Orientation to be your desired
vector, include this, then use transform{trans} where you'd usually
use rotate.  This assumes you used x as the original axis.

  #declare vX2=vnormalize(Orientation);
  #declare vY=vnormalize(vcross(x,vX2));
  #declare vZ1=vnormalize(vcross(x,vY));
  #declare vZ2=vnormalize(vcross(vX2,vY));
    
  #declare trans=transform {
    matrix < 1, vY.x,vZ1.x, 0,vY.y,vZ1.y, 0,vY.z, vZ1.z, 0,0,0 >
    matrix < vX2.x,vX2.y,vX2.z,  vY.x,vY.y, vY.z, vZ2.x,vZ2.y,vZ2.z, 0,0,0 >
  }


Post a reply to this message

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