POV-Ray : Newsgroups : povray.advanced-users : Mathematically stuck with Lego... Server Time
29 Jul 2024 16:22:32 EDT (-0400)
  Mathematically stuck with Lego... (Message 1 to 9 of 9)  
From: Anton Raves
Subject: Mathematically stuck with Lego...
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

From: David Fontaine
Subject: Re: Mathematically stuck with Lego...
Date: 17 Apr 2001 00:47:48
Message: <3ADBCA0D.20D15362@faricy.net>
Anton Raves wrote:

> 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.

I believe I know what piece you are talking about, my brother has it in
some sort of lunar rover thing?...

Sorry, but I don't have one on hand... not by chance any pics of one on
your hard drive?...

--
David Fontaine  <dav### [at] faricynet>  ICQ 55354965
My raytracing gallery:  http://davidf.faricy.net/


Post a reply to this message

From: Anton Raves
Subject: Re: Mathematically stuck with Lego...
Date: 18 Apr 2001 02:51:39
Message: <180420010854513404%a.raves@direct.a2000.nl>
In article <3ADBCA0D.20D15362@faricy.net>, David Fontaine
<dav### [at] faricynet> wrote:

> Anton Raves wrote:
> 
> > 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.
> 
> I believe I know what piece you are talking about, my brother has it in
> some sort of lunar rover thing?...
> 
> Sorry, but I don't have one on hand... not by chance any pics of one on
> your hard drive?...

Hi David,

I thought it would be quicker if I could find an URL in which they show
one, the following address below shows a transparent green one at the
rear of that model.

http://www.brickshelf.com/scans/2000/2964/2964-15.html

This because I don't own a scanner at the moment :-)

Any help is appreciated highly, in advance!
  Anton


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Mathematically stuck with Lego...
Date: 18 Apr 2001 13:21:29
Message: <3addcd19@news.povray.org>
In article <160420012026113135%a.r### [at] directa2000nl> , Anton Raves 
<a.r### [at] directa2000nl>  wrote:

> 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.

For simplicity, would a bump_map on a sphere still give you enough
appearance of structure?


      Thorsten


____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: Anton Raves
Subject: Re: Mathematically stuck with Lego...
Date: 18 Apr 2001 15:01:40
Message: <180420012104546298%a.raves@direct.a2000.nl>
In article <3addcd19@news.povray.org>, Thorsten Froehlich
<tho### [at] trfde> wrote:

> In article <160420012026113135%a.r### [at] directa2000nl> , Anton Raves 
> <a.r### [at] directa2000nl>  wrote:
> 
> > 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.
> 
> For simplicity, would a bump_map on a sphere still give you enough
> appearance of structure?

I've never looked at it that way, because you know, I have created all
the Lego(TM) pieces in my library using CSG... Having a bump_map might
actually work, but then I'd have the first piece in my library which
would be dependant on a seperate file... That is why I was looking for
help in this forum, to see if I could keep things in CSG... When that
doesn't work I'll give your (good!) idea a try!

Thanks Thorsten,
  Anton


Post a reply to this message

From: Ron Parker
Subject: Re: Mathematically stuck with Lego...
Date: 18 Apr 2001 15:29:50
Message: <slrn9drqph.d8t.ron.parker@fwi.com>
On Wed, 18 Apr 2001 08:54:51 +0200, Anton Raves wrote:
>I thought it would be quicker if I could find an URL in which they show
>one, the following address below shows a transparent green one at the
>rear of that model.
>
>http://www.brickshelf.com/scans/2000/2964/2964-15.html

This is a little close.  I adapted it from my golf ball code, so if there
are any variables with funny names, that's why:

#local Angle=12;
#local BandAngle=10;
#local Radius=2.33;

#local Alt=0;
#local AzOfs=0;

#declare HalfSphere=intersection {
  plane {-y,0}         
  #while (Alt <= 90)
    #local Az=AzOfs;
    #while (Az < 360)
      plane {y, Radius
        bounded_by {sphere {Radius*y, Radius/8}}
        rotate <0,0,90-Alt>
        rotate <0,Az,0>
      }
      #local Az=Az+Angle;
    #end
    #if (Alt >= 30)
      #if ( Angle < 72 )
        #local Angle=360/(360/Angle-5);
      #else
        #local Angle=360;
      #end                 
    #else
      #local AzOfs=Angle/2-AzOfs;
    #end
    #local Alt=Alt+BandAngle;
  #end
    
  bounded_by { sphere {0, Radius * 1.1}}
}

object {HalfSphere pigment {color rgb 1}}
camera {location <0,3,-6> look_at 0}
light_source {<-200,200,-200> color rgb 1}

-- 
Ron Parker   http://www2.fwi.com/~parkerr/traces.html
My opinions.  Mine.  Not anyone else's.


Post a reply to this message

From: Scott Hill
Subject: Re: Mathematically stuck with Lego...
Date: 20 Apr 2001 10:47:58
Message: <3ae04c1e$1@news.povray.org>
"Anton Raves" <a.r### [at] directa2000nl> wrote in message
news:180420010854513404%a.r### [at] directa2000nl...
> I thought it would be quicker if I could find an URL in which they show
> one, the following address below shows a transparent green one at the
> rear of that model.
>
> http://www.brickshelf.com/scans/2000/2964/2964-15.html
>


    Well, from the picture it's hard to tell, but it looks like half a Bucky
Ball to me - a quick search on the net such turn something of help up.
    I seem to remember there being a discussion here a while back about
bucky balls and geodesic domes, in fact, IIRC the dome include file was born
out of it, I think - maybe that can do bucky balls ?
--
Scott Hill
Software Engineer.
NC Graphics (Cambridge) Ltd.
Web : http://www.ncgraphics.co.uk
E-mail : sco### [at] ncgraphicsnet
ICQ : 110661991


Post a reply to this message

From: Anton Raves
Subject: Re: Mathematically stuck with Lego...
Date: 21 Apr 2001 11:24:31
Message: <210420011727504817%a.raves@direct.a2000.nl>
In article <slr### [at] fwicom>, Ron Parker
<ron### [at] povrayorg> wrote:

> On Wed, 18 Apr 2001 08:54:51 +0200, Anton Raves wrote:
> >I thought it would be quicker if I could find an URL in which they show
> >one, the following address below shows a transparent green one at the
> >rear of that model.
> >
> >http://www.brickshelf.com/scans/2000/2964/2964-15.html
> 
> This is a little close.  I adapted it from my golf ball code, so if there
> are any variables with funny names, that's why:

Ron,

Thank you very much for the code you posted here, it set me off in the
right direction! The only problem I could find with your code was that
it didn't allow it to be used as a transparent piece, so I changed all
that was required into the following code:

#macro half_hexagon_dome(color_tex)
merge {
  difference {
    intersection {
      #local count1 = 0;
      #local count2 = 0;
      #local count3 = 12;
      box { <-20, 2, -20> <20, 20, 20> }
      #while (count1 <= 90)
        #local count4 = count2;
        #while (count4 < 360)
          box { <-1000, -1000, -1000> <1000, 15.9, 1000>
            bounded_by { sphere { <0, 15.9, 0> 1.9875 } }
            rotate <0, 0, 90 - count1>
            rotate <0, count4, 0>
          }
          #local count4 = count4 + count3;
        #end
        #if (count1 >= 30)
          #if ( count3 < 72 )
            #local count3 = 360/(360/count3-5);
          #else
            #local count3 = 360;
          #end                 
        #else
          #local count2 = count3/2 - count2;
        #end
        #local count1 = count1 + 10;
      #end
    }
    sphere { <0, 0, 0> 14.3 }
  }
  difference {
    cylinder { 0*y, 2.000001*y, 15.9 }
    box { <-16, -1, -2.5> <16, 1.999999, 2.5> }
    box { <-2.5, -1, -16> <2.5, 1.999998, 16> }
    cylinder { -1*y, 2.000005*y, 14.3 }
  }
  texture { color_tex }
  bounded_by { sphere { <0, 0, 0> 16.1 } }
}
#end

You've received an image of a Lego(TM) model in your email, showing off
the piece that I was needing to be able to finish that model...

Many thanks for helping me out in the right direction!
  Anton


Post a reply to this message

From: David Fontaine
Subject: Re: Mathematically stuck with Lego...
Date: 21 Apr 2001 20:59:05
Message: <3AE22BE8.13C9861A@faricy.net>
Scott Hill wrote:

>     Well, from the picture it's hard to tell, but it looks like half a Bucky
> Ball to me - a quick search on the net such turn something of help up.

No, it has more facets than a bucky ball...
Ron beat us to it anyway. :)

--
David Fontaine  <dav### [at] faricynet>  ICQ 55354965
My raytracing gallery:  http://davidf.faricy.net/


Post a reply to this message

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