POV-Ray : Newsgroups : povray.newusers : Faceted sphere? : Re: Faceted sphere? Server Time
29 Jul 2024 20:27:59 EDT (-0400)
  Re: Faceted sphere?  
From: X-Caliber
Date: 9 Mar 2005 20:00:00
Message: <web.422f9af81e707c60e6ef12d50@news.povray.org>
X-Caliber wrote:
> I dunno how to do it meshwise, so I ended up with an object intersection
> define of 56 planes which gets intersected with itsself later on. Heres the
> short version...

Seeing a demo of nested #whiles, I achieved major code shrinkage again. And
this time the facet count can be changed in either direction with some
#defines.

Thanks Bancquart Sebastien for posting your code!


camera {
  location <1, 2.5, 4>
  look_at <0, 0, 0>
}

light_source { <5, 5, 3> color <1, 1, .8> }
light_source { <-5, 0, 3> color <1, .8, 1> }
light_source { <5, 0, -3> color <.8, 1, 1> }

background {}

#declare CircCount = 14;
#declare VertCount = 8;

#declare HalfBoing = intersection { #declare a=VertCount;
  #while (a>0) #declare a=a-1; #declare b=CircCount;
    #while (b>0) #declare b=b-1;
      plane { z, 2 rotate <180/VertCount*(a+0.5)-90, 720/CircCount*(b+
(a/2-int(a/2)) ), 0> }
#end #end }

object {
  intersection {
  object { HalfBoing pigment { color <1, .2, .2> } }
  object { HalfBoing pigment { color <1, 1, 1> } rotate <0, 360/CircCount,
0> }
  }
  bounded_by {sphere {0, 2.2}}
}


Post a reply to this message

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