POV-Ray : Newsgroups : povray.binaries.images : Quiz : Re: Quiz Server Time
2 Oct 2024 16:29:34 EDT (-0400)
  Re: Quiz  
From: Tor Olav Kristensen
Date: 11 May 2000 08:08:19
Message: <391AA2AD.991F4EC3@online.no>
Warp wrote:

>   This one is cool.

Yes.I think so too.

>   (And this time you'll have to figure out the code yourself):

It looks familiar. Heres how I did it:

#declare MajR = 5;
#declare MinR = 1.5;

#declare SmallTorus = torus { MajR, 0.25 }
#declare TVector = MajR*y + MinR*z;
#declare TVector = TVector - 2.5*y; // Remove this line to get a proper torus

#declare TiltedTorus = vtilt(SmallTorus, TVector)

object {
  CircleSpread(TiltedTorus, MinR, 24)
  pigment { color Green }
}

(See below for the rest of my code.)

Tor Olav
--
mailto:tor### [at] hotmailcom
http://www.crosswinds.net/~tok/tokrays.html


#macro VectorAngles(Vector)

  <acos(vnormalize((x+z)*Vector).x)*(Vector.z < 0 ? -1 : 1),
   acos(vnormalize(Vector).y),
   0>

#end // macro VectorAngles


#macro vtilt(Thing, TVector)

  #local RotateAngles = VectorAngles(TVector);

  object {
    Thing
    rotate  degrees(RotateAngles.x)*y
    rotate -degrees(RotateAngles.y)*z
    rotate -degrees(RotateAngles.x)*y
  }

#end // macro vtilt


#macro CircleSpread(Thing, Radius, Nr)

  #local deg = 360/Nr;
  #local MaxCnt = int(Nr);
  #local Cnt = 0;

  merge {
    #while (Cnt < MaxCnt)
      object {
        Thing
        translate Radius*x
        rotate  Cnt*deg*y
      }
      #local Cnt = Cnt + 1;
    #end // while
  }

#end // macro CircleSpread

// ====================================================

#declare MajR = 5;
#declare MinR = 1.5;

#declare SmallTorus = torus { MajR, 0.25 }
#declare TVector = MajR*y + MinR*z;
#declare TVector = TVector - 2.5*y; // Remove this line to get a proper torus

#declare TiltedTprus = vtilt(SmallTorus, TVector)

object {
  CircleSpread(TiltedTprus, MinR, 24)
  pigment { color Green }
}

/*
torus {
  MajR, MinR
  pigment { color Red }
}
*/


Post a reply to this message

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