POV-Ray : Newsgroups : povray.advanced-users : matrix help.... : Re: matrix help.... Server Time
30 Jul 2024 04:21:34 EDT (-0400)
  Re: matrix help....  
From: John VanSickle
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

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