POV-Ray : Newsgroups : povray.advanced-users : Mathematically stuck with Lego... : Mathematically stuck with Lego... Server Time
29 Jul 2024 18:22:16 EDT (-0400)
  Mathematically stuck with Lego...  
From: Anton Raves
Date: 16 Apr 2001 14:23:01
Message: <160420012026113135%a.raves@direct.a2000.nl>
Yes, I am mathematically stuck with Lego's... I am trying to model a
Lego(TM) piece in POV-Ray, a half sphere full with hexagon shaped
cutting objects. I have to stick to CSG, for the piece may be used
transparently also and then a mesh won't work. Below you will find the
code that I have come up with so far, the cutting shape (made yellow
for clarifying purposes) that I want is in it. I hope someone who's
better at math than I am can help me get this piece correctly modelled.

Many thanks in advance,
  Anton Raves
  http://www.antonraves.com/lego.html

camera {
  location  <-60, 75, -250>
  direction 2*z
  up        y
  right     4/3*x
  look_at   <-60, 35, 0>
}

sky_sphere { pigment { color rgb <0.1, 0.3, 1> } }
object { light_source { <60, 200, -150> color red 1 green 1 blue 1 } }

#macro half_hexagon_dome()
difference {
  // This is the shape that I wish to cut from.
  difference {
    sphere { <0, 2, 0> 15.9 }
    box { <-20, -20, -20> <20, 2, 20> }
  }
  box { <-16, -1, -2.5> <16, 2, 2.5> }
  box { <-2.5, -1, -16> <2.5, 2, 16> }
  cylinder { -1*y, 2.000001*y, 15.2 }
  sphere { <0, 2, 0> 14.3 }
  #declare counter = -6;
  #while (counter < 7)
    // This is the hexagon shape that I wish to use for cutting the
dome shape.
    difference {
      box { <-2.25, 15.7, -2> <2.25, 20, 2> }
      box { <-10, -1, -10> <0, 21, 10> rotate 20*y translate <-2.25, 0,
0> }
      box { <-10, -1, -10> <0, 21, 10> rotate -20*y translate <-2.25,
0, 0> }
      box { <0, -1, -10> <10, 21, 10> rotate 20*y translate <2.25, 0,
0> }
      box { <0, -1, -10> <10, 21, 10> rotate -20*y translate <2.25, 0,
0> }
      texture {
        pigment { color rgb <1, 0.8, 0> }
        finish { ambient 0.4 specular 1 roughness 0.005 reflection 0 }
      }
      rotate (counter*14.5)*x
      translate <0, 2, 0>
    }
    #declare counter = counter + 1;
  #end
  texture { pigment { color rgb <1, 1, 1> } finish { ambient 0.4
specular 1 roughness 0.005 reflection 0 } }
  bounded_by { cylinder { -0.1*y, 18*y, 16 } }
}
#end

object { half_hexagon_dome() scale <1, 1, 1> rotate -30*y translate
<-60, 40, -50> }
object { half_hexagon_dome() scale <1, 1, 1> rotate -90*x translate
<-40, 20, -50> }


Post a reply to this message

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