POV-Ray : Newsgroups : povray.binaries.images : Symetric rotations : Re: Symetric rotations Server Time
19 Nov 2024 20:36:56 EST (-0500)
  Re: Symetric rotations  
From: Dan Johnson
Date: 7 Nov 2001 02:10:02
Message: <3BE8DEBD.7A52B0BB@hotmail.com>
Tor Olav Kristensen wrote:

> 
> Sorry, I think that I misunderstood your problem.

Most people don't understand me.  Including myself.  
 
Thanks for the input maybe I will try working more on it in a few
months.  It was more of an interesting toy to begin with.  When I am
serious about transforms I usually use a much more powerful transform
macro.  H2t it by far the most used macro I have ever written(By me at
least).  I think the code below will effectively demonstrate how ez it
makes things.  Perfectly face bonded tetrahedra.  If you keep using
Move1 you will get a tetrahelix.  

#include "colors.inc"
light_source{ <-3,4,-5>*100 rgb 2}
camera{translate -8*z}
#macro H2tr(U1,U2,V1,V2) // Here to there rotation... two reference
points for initial and final positions
        #local X1 = vnormalize(U1);                // find basis vectors
of initial and
        #local Z1 = vnormalize(vcross(X1,U2));     // final refrence
frames
        #local Y1 = vcross(Z1,X1);                 
        #local X2 = vnormalize(V1);
        #local Z2 = vnormalize(vcross(X2,V2));
        #local Y2 = vcross(Z2,X2);
        #local Rotation = transform {
        matrix <X1.x,Y1.x,Z1.x,X1.y,Y1.y,Z1.y,X1.z,Y1.z,Z1.z,0,0,0>
        matrix
<vdot(X2,X1),vdot(X2,Y1),vdot(X2,Z1),vdot(Y2,X1),vdot(Y2,Y1),vdot(Y2,Z1),vdot(Z2,X1),vdot(Z2,Y1),vdot(Z2,Z1),0,0,0>
        matrix <X1.x,X1.y,X1.z,Y1.x,Y1.y,Y1.z,Z1.x,Z1.y,Z1.z,0,0,0> }//
this is the transpose of the first matrix
        Rotation
#end
#macro H2t (Oi,Ai,Ri,Of,Af,Rf)                // Here to there 
       translate (- Oi)               // center, and two reference
points on object
       H2tr((Ai-Oi),(Ri-Oi),(Af-Of),(Rf-Of))  // New center, and
refrence point locations
       translate Of 
#end   // (Origin, Absolute vector, Relative vector) initial, and final
orientations
#declare Tetrahedron = array[4]{<1,1,1>,<1,-1,-1>,<-1,1,-1>,<-1,-1,1>}
// Tetrahedron vertexes
#declare Tetrahedron_faces = mesh {
      triangle { Tetrahedron[0], Tetrahedron[1], Tetrahedron[2]}
      triangle { Tetrahedron[0], Tetrahedron[1], Tetrahedron[3]}
      triangle { Tetrahedron[0], Tetrahedron[2], Tetrahedron[3]}
      triangle { Tetrahedron[1], Tetrahedron[2], Tetrahedron[3]}
    }

#declare Move1= transform
{H2t(<1,-1,-1>,<1,1,1>,<-1,-1,1>,<1,-1,-1>,<1,1,1>,<-1,1,-1>)}
object{Tetrahedron_faces pigment{Red}}
object{Tetrahedron_faces pigment{Green}transform{Move1}}
object{Tetrahedron_faces pigment{Blue}transform{Move1}transform{Move1}}


-- 
Dan Johnson 

http://www.geocities.com/zapob


Post a reply to this message

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