POV-Ray : Newsgroups : povray.binaries.scene-files : csg Server Time
1 Sep 2024 22:15:01 EDT (-0400)
  csg (Message 1 to 2 of 2)  
From: Alex Kluchikov
Subject: csg
Date: 4 Aug 2003 17:05:25
Message: <1105_1060034693@news.povray.org>
See p.b.i for corresponding post.


Post a reply to this message


Attachments:
Download 'csg.pov.txt' (3 KB)

From: Tor Olav Kristensen
Subject: Re: csg
Date: 4 Aug 2003 22:46:59
Message: <Xns93CE313E55C73torolavkhotmailcom@204.213.191.226>
Alex Kluchikov <klk### [at] ukrnet> wrote in 
news:1105_1060034693@news.povray.org:

>  See p.b.i for corresponding post.

If you wan't to get rid of all the warnings, then
you can rewrite your macros like I have done below.


Tor Olav


// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

#macro Ph(R1, R2, Rmin, Alpha)

  #local L1 = Rmin*sin(Alpha);
  #local H1 = (Rmin + R1)*sin(Alpha);
  #local Rmaj = (Rmin + R1)*cos(Alpha);
  #local H2 = sqrt(pow(Rmin + R2, 2) - pow(Rmaj, 2));
  #local L2 = H2*Rmin/(R2 + Rmin);

  union {
    difference {
      cylinder { -L1*y, L2*y, Rmaj }
      torus { Rmaj, Rmin }
    }
    sphere { H2*y, R2 }
    translate H1*y
  }

#end // macro Ph


#macro Rack(X)

  #local R1 = 1;
  #local SS = seed(X);

  union {
    sphere { 0*y, R1 }
    #local I = 0;
    #while(I < 150)
      #local R2 = 0.05 + 0.2*rand(SS);
      #local Rmin = 0.1 + 0.5*rand(SS);
      #local Alpha = radians(80 - 50*rand(SS));
      #local Rmaj = (Rmin + R1)*cos(Alpha);
      #local vRotate = 360*<rand(SS), rand(SS), rand(SS)>;
      #if (Rmin < Rmaj & Rmaj < Rmin + R2)
        object {
          Ph(R1, R2, Rmin, Alpha)
          rotate vRotate
        }
      #end // if
      #local I = I + 1;
    #end // while
  }

#end // macro Rack

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

#declare TT = seed(876745);

#declare I = 0;
#while(I < 11)
  #declare Dummy = rand(TT);
  object {
    Rack(345325 + 4536*I/10)
    texture { st }
    scale 0.4*<1, 1, 1>
    translate 2*(2*<rand(TT), rand(TT), rand(TT)> - <1, 1, 1>)
  }                     
  #declare I = I + 1;
#end // while

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7


Post a reply to this message

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