POV-Ray : Newsgroups : povray.general : Averaging transforms : Re: Averaging transforms Server Time
31 Jul 2024 08:27:32 EDT (-0400)
  Re: Averaging transforms  
From: Massimo Valentini
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

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