POV-Ray : Newsgroups : povray.general : Averaging transforms Server Time
31 Jul 2024 06:20:30 EDT (-0400)
  Averaging transforms (Message 11 to 17 of 17)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: gregjohn
Subject: Re: Averaging transforms
Date: 15 Jan 2008 18:55:01
Message: <web.478d46d38a80397534d207310@news.povray.org>
Okay, maybe the is the way to do it: apply the two transforms to the same stick,
then average the sticks, then extract a new transform out of the new stick.   I
tried to posit this in SDL but my head started to hurt.


Post a reply to this message

From: Massimo Valentini
Subject: Re: Averaging transforms
Date: 16 Jan 2008 07:09:41
Message: <478df405@news.povray.org>
"gregjohn" ha scritto 
> Okay, maybe the is the way to do it: apply the two transforms to the same stick,
> then average the sticks, then extract a new transform out of the new stick.   I
> tried to posit this in SDL but my head started to hurt.
> 

Following there's a sketch to extract the rows of the matrix
from a generic transformation and blend them in an
'average' transform.

HTH Massimo
 


#declare T1 = transform { rotate 30 * z }
#declare T2 = transform { scale <.75, 1.25, 1> }

#declare F1 = function { transform { T1 } }
#declare F2 = function { transform { T2 } }

#declare Row3 = F2(0 0 0) * clock + F1(0 0 0) * (1 - clock);
#declare Row0 = F2(1 0 0) * clock + F1(1 0 0) * (1 - clock) - Row3;
#declare Row1 = F2(0 1 0) * clock + F1(0 1 0) * (1 - clock) - Row3;
#declare Row2 = F2(0 0 1) * clock + F1(0 0 1) * (1 - clock) - Row3;

#declare T12 = transform { matrix 
< Row0.x, Row0.y, Row0.z
, Row1.x, Row1.y, Row1.z
, Row2.x, Row2.y, Row2.z
, Row3.x, Row3.y, Row3.z>}

light_source { 0, rgb 1}
background { rgb 1}
box { -.25, .25 transform {T12} translate z pigment {red 1} }
box { -.25, .25 transform {T1} translate z+.0001 pigment {green .5}}
box { -.25, .25 transform {T2} translate z+.0001 pigment {green .5}}


Post a reply to this message

From: Warp
Subject: Re: Averaging transforms
Date: 16 Jan 2008 07:18:42
Message: <478df622@news.povray.org>
Massimo Valentini <not### [at] vailableinvalid> wrote:
> Following there's a sketch to extract the rows of the matrix
> from a generic transformation and blend them in an
> 'average' transform.

  If I'm not mistaken, if you simply average two transformation matrices,
the transformations in-between will be quite distorted. You won't get nice
rotations and translations.

-- 
                                                          - Warp


Post a reply to this message

From: Massimo Valentini
Subject: Re: Averaging transforms
Date: 16 Jan 2008 13:01:31
Message: <478e467b@news.povray.org>
"Warp" ha scritto 
> Massimo Valentini <not### [at] vailableinvalid> wrote:
> > Following there's a sketch to extract the rows of the matrix
> > from a generic transformation and blend them in an
> > 'average' transform.
> 
>   If I'm not mistaken, if you simply average two transformation matrices,
> the transformations in-between will be quite distorted. You won't get nice
> rotations and translations.
> 

It is an interpolation, if you don't get nice rotations and translations
you may add a third transformation in-between, or a third and a fourth
or ...

Massimo


Post a reply to this message

From: SharkD
Subject: Re: Averaging transforms
Date: 16 Jan 2008 15:10:01
Message: <web.478e63db8a803975368884fc0@news.povray.org>
"gregjohn" <pte### [at] yahoocom> wrote:
> Say I've got two different expressions or algorithms for defining a transform. I
> want to transition from one to the other very gradually as I proceed along a
> series of frames.   Say a "walk" transform" going to a "run" transform.
>
> Can two different transforms be averaged together?  I'm not sure if this would
> be trivial or impossible.

There's no reason why this wouldn't be possible. I'd have to see the actual code
to make suggestions, as I haven't personally experimented with human motion
animations and can't refer to memory.


Post a reply to this message

From: SharkD
Subject: Re: Averaging transforms
Date: 16 Jan 2008 19:00:00
Message: <web.478e9a748a803975368884fc0@news.povray.org>
"SharkD" <nomail@nomail> wrote:
> "gregjohn" <pte### [at] yahoocom> wrote:
> > Say I've got two different expressions or algorithms for defining a transform. I
> > want to transition from one to the other very gradually as I proceed along a
> > series of frames.   Say a "walk" transform" going to a "run" transform.
> >
> > Can two different transforms be averaged together?  I'm not sure if this would
> > be trivial or impossible.
>
> There's no reason why this wouldn't be possible. I'd have to see the actual code
> to make suggestions, as I haven't personally experimented with human motion
> animations and can't refer to memory.

Scratch that. What you want to do is create a single equation for both cases
that takes into account a variable, "speed". As speed increases, the animation
transitions from "walking" to "running".


Post a reply to this message

From: John VanSickle
Subject: Re: Averaging transforms
Date: 17 Jan 2008 18:07:23
Message: <478fdfab$1@news.povray.org>
gregjohn wrote:
> Say I've got two different expressions or algorithms for defining a transform. I
> want to transition from one to the other very gradually as I proceed along a
> series of frames.   Say a "walk" transform" going to a "run" transform.
> 
> Can two different transforms be averaged together?  I'm not sure if this would
> be trivial or impossible.

Generally, the best way to average two transforms is to extract the 
scale, rotation, and translation transforms from each, interpolate the 
results, and then recombine the interpolated values.

(This all assumes that there is no shearing element in the transforms.)

The scale transform you can either scale in a linear fashion:
	s(x) = a+(b-a)*x
or an exponential fashion
	s(x)=a* exp( ln(b/a)*x )

Try each to see which gives you the results you want.

The transform is easily interpolated:
	t(x) = a+(b-a)*x

The rotation will probably be rather complex, and you may want to break 
down the translation into the three axes first, interpolate between the 
axes, and then recombine them.

Regards,
John


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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