POV-Ray : Newsgroups : povray.newusers : Digging ditches - rotation Server Time
27 Nov 2024 21:57:56 EST (-0500)
  Digging ditches - rotation (Message 1 to 7 of 7)  
From: Mark Hanford
Subject: Digging ditches - rotation
Date: 29 Mar 2002 06:35:43
Message: <3ca4518f@news.povray.org>
I am getting myself deeper and deeper into a hole, most likely just because
I can't see the wood for the trees.

I have an object created at the origin and oriented along the x-axis (an
arrow, actually).
What I want to do is rotate the arrow to point in a particular direction, as
specified by a vector.

So for a vector of <3,3,0>, the rotation should be <0,0,45>

I appologise in advance if this an RTFM issue, but I'm stumped :(

--

Mark Hanford
http://www.mrhanford.com/povray


Post a reply to this message

From: bob h
Subject: Re: Digging ditches - rotation
Date: 29 Mar 2002 10:44:25
Message: <3ca48bd9$1@news.povray.org>
"Mark Hanford" <ren### [at] blueyondercouk> wrote in message
news:3ca4518f@news.povray.org...
>
> I have an object created at the origin and oriented along the x-axis (an
> arrow, actually).
> What I want to do is rotate the arrow to point in a particular direction,
as
> specified by a vector.
>
> So for a vector of <3,3,0>, the rotation should be <0,0,45>

Well, there is vaxis_rotate and vrotate but those result in a vector
position, not the rotational amount between two vectors. I'm no math wizard
to begin with so I'm not sure if there is an easy way. In the beta of 3.5
(3.1 and 3.5 are going to be quite different regarding this I believe) a
math 'include' macro might do okay. One is VAngleD, which can result in the
number of degrees between two vectors. Might be a problem if you wanted it
to give you the axis of rotation, but another macro called VRotationD will
give you the degrees rotated based on what you specify as the rotational
axis. See my example of that, if you have version 3.5:

#include "math.inc"

#declare Angle=VRotationD(x, <3,3,0>, z);

text {ttf "timrom.ttf", str(Angle,0,0), 1, 0
        pigment {color red 1}
}

Note that I used "x" for the first vector (same as <1,0,0>) because the
macro can't see <0,0,0> in a way that can figure it out apparently. So you'd
think of the first as a starting plane, I guess that's a good way to explain
it. If the vectors are non-zero then the macro can calculate against those
as planes, from what I can tell. Also, sign (+/-) is based on a different
geometry from the left-handedness rotation, it would seem. Frankly, I'm not
certain how it is done and what results should be expected.
Perhaps someone else could give you a better idea.

bob h


Post a reply to this message

From: Mark Hanford
Subject: Re: Digging ditches - rotation
Date: 29 Mar 2002 10:58:17
Message: <3ca48f19@news.povray.org>
You don't understand!  The answer I wanted was something like "that's easy -
use VrotateLikeMarkWants()"

I'll have to try and work out a "manual" approach :(  trig here I come...
--

Mark Hanford
http://www.mrhanford.com/povray


"bob h" <omn### [at] charternet> wrote in message
news:3ca48bd9$1@news.povray.org...
> "Mark Hanford" <ren### [at] blueyondercouk> wrote in message
> news:3ca4518f@news.povray.org...
> >
> > I have an object created at the origin and oriented along the x-axis (an
> > arrow, actually).
> > What I want to do is rotate the arrow to point in a particular
direction,
> as
> > specified by a vector.
> >
> > So for a vector of <3,3,0>, the rotation should be <0,0,45>
>
> Well, there is vaxis_rotate and vrotate but those result in a vector
> position, not the rotational amount between two vectors. I'm no math
wizard
> to begin with so I'm not sure if there is an easy way. In the beta of 3.5
> (3.1 and 3.5 are going to be quite different regarding this I believe) a
> math 'include' macro might do okay. One is VAngleD, which can result in
the
> number of degrees between two vectors. Might be a problem if you wanted it
> to give you the axis of rotation, but another macro called VRotationD will
> give you the degrees rotated based on what you specify as the rotational
> axis. See my example of that, if you have version 3.5:
>
> #include "math.inc"
>
> #declare Angle=VRotationD(x, <3,3,0>, z);
>
> text {ttf "timrom.ttf", str(Angle,0,0), 1, 0
>         pigment {color red 1}
> }
>
> Note that I used "x" for the first vector (same as <1,0,0>) because the
> macro can't see <0,0,0> in a way that can figure it out apparently. So
you'd
> think of the first as a starting plane, I guess that's a good way to
explain
> it. If the vectors are non-zero then the macro can calculate against those
> as planes, from what I can tell. Also, sign (+/-) is based on a different
> geometry from the left-handedness rotation, it would seem. Frankly, I'm
not
> certain how it is done and what results should be expected.
> Perhaps someone else could give you a better idea.
>
> bob h
>
>
>


Post a reply to this message

From: Warp
Subject: Re: Digging ditches - rotation
Date: 29 Mar 2002 11:45:15
Message: <3ca49a1a@news.povray.org>
Mark Hanford <ren### [at] blueyondercouk> wrote:
> You don't understand!  The answer I wanted was something like "that's easy -
> use VrotateLikeMarkWants()"

  Use Reorient_Trans() defined in transforms.inc.

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

From: Mark Hanford
Subject: Re: Digging ditches - rotation
Date: 29 Mar 2002 12:01:08
Message: <3ca49dd4@news.povray.org>
thank you, thank you, thank you, thank you, thank you

--

btw, there were no copy'n'paste's there ;)

Mark Hanford
http://www.mrhanford.com/povray


"Warp" <war### [at] tagpovrayorg> wrote in message
news:3ca49a1a@news.povray.org...
> Mark Hanford <ren### [at] blueyondercouk> wrote:
> > You don't understand!  The answer I wanted was something like "that's
easy -
> > use VrotateLikeMarkWants()"
>
>   Use Reorient_Trans() defined in transforms.inc.
>
> --
> #macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb
M()}}
> N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
> N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  -
Warp -


Post a reply to this message

From:
Subject: Re: Digging ditches - rotation
Date: 29 Mar 2002 12:05:13
Message: <rg79au05knvo505fufvniktf8gt3hrkfe6@4ax.com>
On Fri, 29 Mar 2002 17:01:50 -0000, "Mark Hanford"
<ren### [at] blueyondercouk> wrote:

> btw, there were no copy'n'paste's there ;)

I know this smile but If (by chance) you mean that you can't just paste name of
this macro to editor then you are wrong - take a look at my Insert Menu Bonus
Pack at http://www.abx.art.pl/pov/bonus/

ABX
--
disc{z,-z#macro O()asc(substr("-+((1*(,1,/.-,*/(,&.323/'1"e,1))*.1-4#declare
e=e-1;#end#local e=26;5pigment{#local g=function(_){ceil(_)-_}function#local
k=function{pattern{object{sphere_sweep{linear_spline 13#while(e)<O(),O()//35
>.01#end}}}}{k(g(atan2(x,y)),g(ln((y+x)^2+1e-5)),0)}}finish{ambient 1}}//ABX


Post a reply to this message

From: Mark Hanford
Subject: Re: Digging ditches - rotation
Date: 29 Mar 2002 12:12:46
Message: <3ca4a08e@news.povray.org>
I was referring to the greatfully crafted (rather than trivially pasted)
"thank you's" to Warp...

--

Mark Hanford
http://www.mrhanford.com/povray



news:rg79au05knvo505fufvniktf8gt3hrkfe6@4ax.com...
> On Fri, 29 Mar 2002 17:01:50 -0000, "Mark Hanford"
> <ren### [at] blueyondercouk> wrote:
>
> > btw, there were no copy'n'paste's there ;)
>
> I know this smile but If (by chance) you mean that you can't just paste
name of
> this macro to editor then you are wrong - take a look at my Insert Menu
Bonus
> Pack at http://www.abx.art.pl/pov/bonus/
>
> ABX
> --
> disc{z,-z#macro
O()asc(substr("-+((1*(,1,/.-,*/(,&.323/'1"e,1))*.1-4#declare
> e=e-1;#end#local e=26;5pigment{#local
g=function(_){ceil(_)-_}function#local
> k=function{pattern{object{sphere_sweep{linear_spline
13#while(e)<O(),O()//35
> >.01#end}}}}{k(g(atan2(x,y)),g(ln((y+x)^2+1e-5)),0)}}finish{ambient
1}}//ABX


Post a reply to this message

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