POV-Ray : Newsgroups : povray.advanced-users : matrix help.... Server Time
30 Jul 2024 02:23:00 EDT (-0400)
  matrix help.... (Message 11 to 16 of 16)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: David Fontaine
Subject: Re: matrix help....
Date: 14 Sep 2000 16:54:19
Message: <39C139CE.F3306798@faricy.net>
John VanSickle wrote:

> David Fontaine wrote:
> >
> > John's macro should do what you want. The only problem I think would be the axial
> > rotation changing, but if your gun stays pointing on the x-z plane with y up it
> > shouldn't matter I think. I've written one aimilar to keep axial rotation the same
> > (perpendicular vector intersecting y axis still intersects y axis). It's a lot
> > messier than John's though.
>
> The Reorient vector tilts as if the joint were a ball-and-socket joint.  If you
> want to tilt in the way the POV camera tilts when the look_at parameter is
> specified, here is some tighter, neater, and more flexible code.

Ah, now I get it. The 'up' parameter is a good idea too.

--
David Fontaine   <dav### [at] faricynet>   ICQ 55354965
Please visit my website:  http://davidf.faricy.net/


Post a reply to this message

From: Margus Ramst
Subject: Re: matrix help....
Date: 14 Sep 2000 18:40:05
Message: <39C14597.A97C099F@peak.edu.ee>
Tor Olav Kristensen wrote:
> 
> BUT: From what I can see you're calculating the same things several times.
> 
> Wouldn't it be better to store calculated values in variables and use them
> up again when needed ?
> 
> (Or is there too much overhead for POV to make these new variables ?)
> 

Oh, certainly the method I suggested isn't optimized. I'm just lazy, and since
the v_parallel macro was so conveniently lying around, I probably saved a whole
10 keystrokes :)

-- 
Margus Ramst

Personal e-mail: mar### [at] peakeduee
TAG (Team Assistance Group) e-mail: mar### [at] tagpovrayorg


Post a reply to this message

From: John VanSickle
Subject: Re: matrix help....
Date: 14 Sep 2000 21:18:29
Message: <39C179B2.DCEF7E22@erols.com>
Paul Jones wrote:
> 
> Does this assume that your object is not located somewhere else other
> than the origin? (<0,0,0>)

On the contrary, it assumes that the object is at the origin.

>  What if I have a gun turret that is located at <5,0,5> (ie: it
> rotates around the line defined by <5,y,5>), would this macro take
> that in to account? or would another parameter _location_ be required?

Actually, it would be easier to model it at the origin, turn it using
the macro, and then translate it to where you want it.

But if you've already modeled it to turn around some other point, then
use some other transforms before and after:

object { MyGun
  translate -GunLocation
  PointAlong(z,<-1,1,14>,y)
  translate GunLocation
}

This moves the object to the origin, rotates it, and then moves it back.
This code assumes the gun is originally modelled pointing in the +z
direction.

BTW, the macro I gave earlier turns the object, and raises it or lowers
it as well (ie, give both yaw and pitch).  If you want just yaw or just
pitch, let me know and I'll explain how to call the macro for that.

Regards,
John
-- 
ICQ: 46085459


Post a reply to this message

From: David Fontaine
Subject: Re: matrix help....
Date: 15 Sep 2000 00:06:10
Message: <39C19EFE.566414A0@faricy.net>
John VanSickle wrote:

> BTW, the macro I gave earlier turns the object, and raises it or lowers
> it as well (ie, give both yaw and pitch).  If you want just yaw or just
> pitch, let me know and I'll explain how to call the macro for that.

How is this a special case?

--
David Fontaine  <dav### [at] faricynet>  ICQ 55354965
My raytracing gallery:  http://davidf.faricy.net/


Post a reply to this message

From: John VanSickle
Subject: Re: matrix help....
Date: 15 Sep 2000 07:55:11
Message: <39C20E1E.C51082D4@erols.com>
David Fontaine wrote:
> 
> John VanSickle wrote:
> 
> > BTW, the macro I gave earlier turns the object, and raises it or lowers
> > it as well (ie, give both yaw and pitch).  If you want just yaw or just
> > pitch, let me know and I'll explain how to call the macro for that.
> 
> How is this a special case?

It's not a special case, but rather a change in what the user wants (since
that's what I was asking for: to know if there was a change in what he
wanted).

Anyway, suppose one has a gun turret (the example under discussion), like
the top of a tank, for instance.  The gun both turns and lifts, while the
turret just turns.  The macro I supplied here will give the transform for
the gun, but not the turret; however, if the NewDirection vector is
modified so that vdot(NewDirection,Up)=0, the macro will give the transform
for the turret.  It would be used this way:

#local TurretDir=NewDirection-Up*vdot(NewDirection,Up);
PointAlong(OldDirection,TurretDir,Up)

The user needs to identify which objects need freedom of movement in
both directions, which need freedom of movement in one direction, and
group and align them as follows:

union { // gun and turret
  union { // just the gun
    object { GunPart1 }
    object { GunPart2 }
    PointAlong(ModelDirection,NewDirection,Up)
  } // end of just the gun
  union { // just the turret
    object { TurretPart1 }
    object { TurretPart2 }
    PointAlong(ModelDirection,TurretDirection,Up)
  } // end of just the turret
  translate GunTurretLocation
} // end of gun and turret


Post a reply to this message

From: David Fontaine
Subject: Re: matrix help....
Date: 15 Sep 2000 19:39:21
Message: <39C2B1FB.C9FA2FE6@faricy.net>
John VanSickle wrote:

> It's not a special case, but rather a change in what the user wants (since
> that's what I was asking for: to know if there was a change in what he
> wanted).
>
> Anyway, suppose one has a gun turret (the example under discussion), like
> the top of a tank, for instance.  The gun both turns and lifts, while the
> turret just turns.  The macro I supplied here will give the transform for
> the gun, but not the turret; however, if the NewDirection vector is
> modified so that vdot(NewDirection,Up)=0, the macro will give the transform
> for the turret.  It would be used this way:
>
> #local TurretDir=NewDirection-Up*vdot(NewDirection,Up);
> PointAlong(OldDirection,TurretDir,Up)
>
> The user needs to identify which objects need freedom of movement in
> both directions, which need freedom of movement in one direction, and
> group and align them as follows:

[snip]
It's still just a simple task for the user to do that with the standard
macro... but I see now that's what you were going to tell him how to do. :)


--
David Fontaine  <dav### [at] faricynet>  ICQ 55354965
My raytracing gallery:  http://davidf.faricy.net/


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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