POV-Ray : Newsgroups : povray.binaries.scene-files : Platonic solids Server Time
2 Sep 2024 14:15:56 EDT (-0400)
  Platonic solids (Message 4 to 13 of 13)  
<<< Previous 3 Messages Goto Initial 10 Messages
From: Deaken
Subject: Re: Platonic solids
Date: 14 Jan 2002 02:43:20
Message: <3C428C12.41C7D55D@sw-tech.com>
Thies Heidecke wrote:
> 
> Hi Deaken,

Hello.

> first of all, good work so far.

Thanks.

> >// Bugs: The math is slightly off on both the Dodecahedron and the
> >//       Icosahedron.  I am still tracking this down, I'm afraid.
> 
> As i read this i thought my source could be helpful to you, feel free
> to use it in your include-file if you like it.
> 
> Some explanations:
> r is the radius of the outer bounding sphere of the icosahedron

I use 1 for this, like your default.  "Bounded by the unit sphere", as
they say.

> h,a,b,c,d are some precalculated constants.

Hm.  You seem to have a much better grasp on the geometry involved than
I do.  I was foolish, and trusted reference pages which I found on the
web.  :)

> I hope you find it useful.

Indeed.  Many thanks.

> // Icosahedron - Vertex - Definitions :
> #declare r     = 1.0;
> #declare sqrt5 = sqrt(5.0);
> #declare h     = 1.0/sqrt5;
> #declare a     = 2.0*sqrt((5.0+sqrt5)/40.0);
> #declare b     = 2.0*sqrt((5.0-sqrt5)/40.0);
> #declare c     = (5.0-sqrt5)/10.0;
> #declare d     = (5.0+sqrt5)/10.0;

Interesting.  I must study this.  Thanks again.

Deaken


Post a reply to this message

From: Herman Serras
Subject: Re: Platonic solids
Date: 14 Jan 2002 08:42:12
Message: <3C42E03E.26BF4F96@pandora.be>
Hello,
This is very well done. I appreciate that you are putting the sources
available.
The macros to define a square and a pentagon as a mesh of triangles are
a very good idea!
I also have some include files concerning polyhedra and using "polygon"
often gives problems concerning the planarity. I think it's better to
use triangles.
I see you're inscribing the platonic solids in a sphere. That's the most
symetrical way to do it but startin from a cube is mathematically more
easy.
You can find some examples on my website.
Friendly greetings.

Deaken wrote:
> 
> As mentioned in p.b.i...
> 
>   ------------------------------------------------------------------------
> // Persistence of Vision Ray Tracer Include File
> // File: platonic.inc
> // Vers: 0.9
> // Desc: This file provides untextured versions of the five Platonic solids,

... skipped

-- 
Herman Serras
Gent (Belgium)
http://cage.rug.ac.be/~hs/


Post a reply to this message

From: Deaken
Subject: Re: Platonic solids
Date: 14 Jan 2002 09:53:42
Message: <3C42F0E3.7FAF75DE@sw-tech.com>
Herman Serras wrote:
> 
> Hello,

Hi there.

> This is very well done. 

Thank you.

> I appreciate that you are putting the sources
> available.

Well, there is no other choice, as far as I'm concerned.  I learn from
the group, so I give back to the group, in my inexperienced (and
currently mostly useless) manner.  I hope to change that over time and
actually present something useful.

> The macros to define a square and a pentagon as a mesh of triangles are
> a very good idea!

It struck me as the easiest and most uniform way to do it.  It could
have been easier if I had used box{} for the cube, but then it would not
have been constructed similar to the other polyhedra.

> I also have some include files concerning polyhedra and using "polygon"
> often gives problems concerning the planarity. I think it's better to
> use triangles.
> I see you're inscribing the platonic solids in a sphere. That's the most
> symetrical way to do it but startin from a cube is mathematically more
> easy.
> You can find some examples on my website.

Wow.

"Easy", you say?  You are far beyond me in math, I'm afraid.

I did, however, find a link to already-provided polyhedral include files
(on mac.povray.org) from your site.  I KNEW I was reinventing the
wheel.  :/

Interesting that Mr. Towle seems (I have not been able to examine the
include files yet; I still need something to unpack .SIT and .HQX files)
to have provided the "pipes-and-balls" structures, too.  There is
nothing new under the sun.

It also occurs to me that I should have used a unit cube.  I would not
have found the bug in the icosa- and dodecahedra.  Heh.

> Friendly greetings.

Back at you.  :)

Deaken


Post a reply to this message

From: Herman Serras
Subject: Re: Platonic solids
Date: 14 Jan 2002 10:54:23
Message: <3C42FF39.DEA4AEB5@pandora.be>
Hello,


> It struck me as the easiest and most uniform way to do it.  It could
> have been easier if I had used box{} for the cube, but then it would not
> have been constructed similar to the other polyhedra.

I think it's a good idea to try to obtain a uniform way to describe the
platonic solids. So I don't mean you should use "box" for the cube. But
the nice thing I learned from your include file is to avoid "polygon" by
using your macros. As I wrote, there can be difficulties if the 3D
polygon is not a planar one, and this can be a matter of rounding off.
The only polygon we're sure that it is a planar one is the triangle!


> 
> I did, however, find a link to already-provided polyhedral include files
> (on mac.povray.org) from your site.  I KNEW I was reinventing the
> wheel.  :/
> 
> Interesting that Mr. Towle seems (I have not been able to examine the
> include files yet; I still need something to unpack .SIT and .HQX files)
> to have provided the "pipes-and-balls" structures, too.  There is
> nothing new under the sun.

The .hqx files can be expanded using "stuffit". You can find this
program on the web.
I also examined some of the files from Mr. Towle. But being a
mathematician I want to construct the polyhedra (or obtain their data)
myself. I think Mr. Towle obtained his data using an other programme:
all his data are written in decimal form (not using square roots
etc...).

> 
> It also occurs to me that I should have used a unit cube.  I would not
> have found the bug in the icosa- and dodecahedra.  Heh.

One of the advantages starting from the cube and deriving the other four
platonic polyhedra form it is that one doesn't need to use spherical
geometry (or spherical trigonometry). I think most young people don't
study those things at school and the whole thing can be done starting
from the cube and using some analytical geometry. And... you see very
well the nice relations using the golden section that exist ex. in the
dodecahedron!
> 
> > Friendly greetings.
> 
> Back at you.  :)
> 
> Deaken

Greetings from Ghent!

Herman Serras

-- 
Herman Serras
Gent (Belgium)
http://cage.rug.ac.be/~hs/


Post a reply to this message

From: Deaken
Subject: Re: Platonic solids
Date: 14 Jan 2002 17:35:16
Message: <3C435D07.A990D0EA@sw-tech.com>
Herman Serras wrote:
> 
> Hello,
> 
> > It struck me as the easiest and most uniform way to do it.  It could
> > have been easier if I had used box{} for the cube, but then it would not
> > have been constructed similar to the other polyhedra.
> 
> I think it's a good idea to try to obtain a uniform way to describe the
> platonic solids. So I don't mean you should use "box" for the cube. 

Sorry.  I was unclear.  I was just explaining my methods and reasoning. 
I didn't mean to say that I thought you had suggested it.

> But
> the nice thing I learned from your include file is to avoid "polygon" by
> using your macros. 

I am an almost-decent Forth programmer.  I find the overlap between
factoring code in Forth nicely similar to building POV scenes out of
primitives.  I try to use Forth's "simplify as much as possible, and
remove everything that can be removed" strategy as often as I can.

> As I wrote, there can be difficulties if the 3D
> polygon is not a planar one, and this can be a matter of rounding off.
> The only polygon we're sure that it is a planar one is the triangle!

This is why I did something relatively simple, instead of, say, all the
rest of the polyhedra.  :)

> > Interesting that Mr. Towle seems (I have not been able to examine the
> > include files yet; I still need something to unpack .SIT and .HQX files)
> > to have provided the "pipes-and-balls" structures, too.  There is
> > nothing new under the sun.
> 
> The .hqx files can be expanded using "stuffit". You can find this
> program on the web.

Yes, I used to be a Mac person.  I recognize the file type.  I once had
a toolkit for such files that worked on unix, but I am having a hard
time finding it again.

> I also examined some of the files from Mr. Towle. But being a
> mathematician I want to construct the polyhedra (or obtain their data)
> myself.  I think Mr. Towle obtained his data using an other programme:
> all his data are written in decimal form (not using square roots
> etc...).

I am not a mathematician, just someone who wants to better his SDL
skills.

[I've actually got a problem relating to that, but I'm not sure if
povray.programming is the right place, or if it should go in
povray.newusers.  It involves translating something from C to a macro. 
It's rather nasty.]

> > It also occurs to me that I should have used a unit cube.  I would not
> > have found the bug in the icosa- and dodecahedra.  Heh.
> 
> One of the advantages starting from the cube and deriving the other four
> platonic polyhedra form it is that one doesn't need to use spherical
> geometry (or spherical trigonometry). 

To be honest, I took a look at your site last night and I haven't the
faintest idea how I would, for example, construct a dodecahedron out of
a cube in POV-Ray, the way you describe it on your page.

> I think most young people don't
> study those things at school and the whole thing can be done starting
> from the cube and using some analytical geometry. 

Or, in my case, have studied it far too long ago to remember any of it. 
:/

Deaken


Post a reply to this message

From: Christopher James Huff
Subject: Re: Platonic solids
Date: 15 Jan 2002 19:51:01
Message: <chrishuff-28BB44.19520015012002@netplex.aussie.org>
In article <3C435D07.A990D0EA@sw-tech.com>, Deaken <dwy### [at] sw-techcom> 
wrote:

> I am an almost-decent Forth programmer.  I find the overlap between
> factoring code in Forth nicely similar to building POV scenes out of
> primitives.  I try to use Forth's "simplify as much as possible, and
> remove everything that can be removed" strategy as often as I can.

I've never seen any Forth code...what's it like?


> > The .hqx files can be expanded using "stuffit". You can find this
> > program on the web.
> 
> Yes, I used to be a Mac person.  I recognize the file type.  I once had
> a toolkit for such files that worked on unix, but I am having a hard
> time finding it again.

StuffIt does work on Unix, it runs on Mac OS X. ;-)
Ok, I'm assuming that's not quite what you had in mind...though if you 
want, I could make a .tgz of the files for you, just send them to me.
BTW, what are you using now? Your X-Mailer header says Win95, which I 
assume is incorrect...


> [I've actually got a problem relating to that, but I'm not sure if
> povray.programming is the right place, or if it should go in
> povray.newusers.  It involves translating something from C to a macro. 
> It's rather nasty.]

Sounds like an interesting problem, povray.advanced-users might be a 
better place...
povray.programming is more for discussion of the program source code 
than the scene language.

-- 
 -- 
Christopher James Huff <chr### [at] maccom>


Post a reply to this message

From: Patrick Elliott
Subject: Re: Platonic solids
Date: 16 Jan 2002 18:13:51
Message: <1103_1011222959@selliot>
On Tue, 15 Jan 2002 19:52:01 -0500, Christopher James Huff <chr### [at] maccom> wrote:
> In article <3C435D07.A990D0EA@sw-tech.com>, Deaken <dwy### [at] sw-techcom> 
> wrote:
> 
> > I am an almost-decent Forth programmer.  I find the overlap between
> > factoring code in Forth nicely similar to building POV scenes out of
> > primitives.  I try to use Forth's "simplify as much as possible, and
> > remove everything that can be removed" strategy as often as I can.
> 
> I've never seen any Forth code...what's it like?
> 


Except for some minor syntax differences, like using FORMAT to print formated
output, instead of PRINT USING, .OR. instead of simple OR and similar things
the code in Forth appears to be very similar to that of QBASIC, which also allows
you to use line numbers only when you need them.

It probably is a lot better at doing math though, since the last time I tried to port
the code from one into a version of basic, the results where off by quite a bit. I
may have forgot to convert to radians or something though, so I can't be sure
and I am stopped fiddling with that code a while back. ;)

Some examples are at http://www.ngs.noaa.gov/PC_PROD/pc_prod.shtml


Post a reply to this message

From: Deaken
Subject: Re: Platonic solids
Date: 16 Jan 2002 22:48:31
Message: <3C4649B3.7FAF8557@sw-tech.com>
Patrick Elliott wrote:
> 
> On Tue, 15 Jan 2002 19:52:01 -0500, Christopher James Huff <chr### [at] maccom>
wrote:
> >
> >
> > I've never seen any Forth code...what's it like?
> 
> Except for some minor syntax differences, like using FORMAT to print formated
> output, instead of PRINT USING, .OR. instead of simple OR and similar things
> the code in Forth appears to be very similar to that of QBASIC, which also allows
> you to use line numbers only when you need them.

[snip]

> Some examples are at http://www.ngs.noaa.gov/PC_PROD/pc_prod.shtml

Actually, that's Fortran, not Forth.  What you said about the syntax and
the math-related strengths are very true, though.

Deaken


Post a reply to this message

From: Patrick Elliott
Subject: Re: Platonic solids
Date: 17 Jan 2002 15:25:40
Message: <1103_1011299260@selliot>
On Wed, 16 Jan 2002 19:49:07 -0800, Deaken <dwy### [at] sw-techcom> wrote:
> Actually, that's Fortran, not Forth.  What you said about the syntax and
> the math-related strengths are very true, though.
> 
> Deaken

Oops.. Yeah I figured that out when I took a look at the sample code in your next
post,
but by then it was a little too late. lol Actually the code for loops you had looked
more
C-ish. ;) Though, out of context it is hard to tell how cryptic it really is.

Nothing like trying to figure out how someone elses code works, when you don't know
the language and have no interpreter that will let you see values or get some sense of
what is going on in it. I have tried at least once to convert some code in Fortran
into
VB, but couldn't figure out why it wouldn't work.  I wasn't even sure what the
original
code should be generating at each point.. :p Oh well, will figure it out eventually.
lol

Frankly the oldest language I have had any formal learning of is COBOL and that was
due to my college insisting that we had to know it, since most companies still used
it.
Things like C++ and Windows at the time where 'current concepts'. Annoying thing being
that the changed everything (including all new computer systems) the year after I
graduated. :p


Post a reply to this message

From: Deaken
Subject: Re: Platonic solids
Date: 17 Jan 2002 16:13:14
Message: <3C473E93.A9EE9518@sw-tech.com>
Patrick Elliott wrote:
> 
> Actually the code for loops you had looked more
> C-ish. ;) Though, out of context it is hard to tell how cryptic it really is.

Well, here's some context.  And it's straightforwardly-written code, so
anything that's "cryptic" is the fault of Forth, not me.

In Forth, \ to end-of-line is a comment.  You can also enclose comments
in parens, which is how I will demonstrate what the stack looks like.

[For more on stack-based programming, please see
<URL:http://www-2.cs.cmu.edu/~koopman/stack_computers/contents.html>,
especially Section 1.2.]

N \ This puts the address of N (where the variable is stored) onto the
stack.
( 9238 ) \ Made-up memory address
@ \ This uses up the address of N, and fetches what was IN that address.
( 5 ) \ Made-up value of N.
0 \ This is zero.  It gets put on the stack, too.
( 5 0 )
DO \ "DO" takes two numbers off of the stack and loops between them.
   \ In this case, it will loop from 0 to N-1, inclusive.
( ) \ Nothing on the stack.
5 \ This puts 5 on the stack.
( 5 )
SQRT \ This replaces 5 with what happens when we run the SQRT word.
     \ If we're lucky, it'll turn out to be 2.
     \ (Stacks are usually integers, y'see.)
( 2 ) \ The SQRT of 5.
I \ This gives you the value of the looping variable, which is always
  \ (for singly-nested loops) called I.  It puts it on the stack.
( 2 0 ) \ First time through, it's 0.  After that it's 1.  And so on. 
:)
17 \ Puts 17 on the stack.
( 2 0 17 )
* \ Multiply the top two numbers, and replace them with the result.
( 2 0 ) \ 17 * 0 == 0
23 \ Puts 23 on the stack.
( 2 0 23 )
+ \ Replace the top two numbers with their sum.
( 2 23 )
DOSOMETHING \ DOSOMETHING (notionally) takes the top two numbers, and
            \ does something with them.  We will also imagine that it
            \ doesn't bother to return anything.
( )
LOOP \ Finish the loop started with "DO".

You know what?  That's really not very helpful.

Here's a better idea.  Go to
<URL:http://www.softsynth.com/pforth/pf_tut.htm> and poke around
"Arithmetic", "Variables" and "Loops".  Phil Burk does a much better job
of explaining it than I just did.  Sorry about that.

Also, since this has nothing more to do with scene files, please direct
all followups to povray.off-topic or to me personally, via email.

> Annoying thing being
> that the changed everything (including all new computer systems) the year after I
> graduated. :p

Always the way.  That happened to me in elementary, junior high, and
college.  In high school, they upgraded the last year I was there.  Heh.

Deaken


Post a reply to this message

<<< Previous 3 Messages Goto Initial 10 Messages

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