POV-Ray : Newsgroups : povray.advanced-users : sphere triangulation controlled by int Server Time
29 Jul 2024 18:22:57 EDT (-0400)
  sphere triangulation controlled by int (Message 1 to 4 of 4)  
From:
Subject: sphere triangulation controlled by int
Date: 8 Nov 2001 03:48:30
Message: <6ugkutoldp5q96srel9tlfis03fc2lb1e2@4ax.com>
I was used 3ds years ago. The last version I used a lot was 3ds release 4. I
remember from this application there were two possible triangulations of sphere.
First one is easy and base on spliting angles "verticaly" and "horizontaly" just
like coordinates of earth are provided. I looking for algorithm of second way.
IIRC the number of faces was simple controled by int and was equal to power of
this int (^2 or ^3). I tried spliting base triangulation (4 faces) along edges
but this not returns equal triangles. I tried find some equations from
http://mathworld.wolfram.com/GeodesicDome.html but there is no formula depending
from single int like with 3ds. I'm not interested with algorithms with n-points
distributed on sphere. I have it. Could anybody help me?

ABX
--
#declare _=function(a,b,x){((a^2)+(b^2))^.5-x}#default {pigment{color rgb 1}}
union{plane{y,-3}plane{-x,-3}finish{reflection 1 ambient 0}}isosurface{ //ABX
function{_(x-2,y,1)|_((x+y)*.7,z,.1)|_((x+y+2)*.7,z,.1)|_(x/2+y*.8+1.5,z,.1)}
contained_by{box{<0,-3,-.1>,<3,0,.1>}}translate z*15finish{ambient 1}}//POV35


Post a reply to this message

From: Christoph Hormann
Subject: Re: sphere triangulation controlled by int
Date: 8 Nov 2001 04:05:54
Message: <3BEA4AE9.2BD4771C@gmx.de>

> 
> I was used 3ds years ago. The last version I used a lot was 3ds release 4. I
> remember from this application there were two possible triangulations of sphere.
> First one is easy and base on spliting angles "verticaly" and "horizontaly" just
> like coordinates of earth are provided. I looking for algorithm of second way.
> IIRC the number of faces was simple controled by int and was equal to power of
> this int (^2 or ^3). I tried spliting base triangulation (4 faces) along edges
> but this not returns equal triangles. I tried find some equations from
> http://mathworld.wolfram.com/GeodesicDome.html but there is no formula depending
> from single int like with 3ds. I'm not interested with algorithms with n-points
> distributed on sphere. I have it. Could anybody help me?

There are of course an infinite number of possible tesselations of a
sphere, the best results can be expected from a method producing nearly
equilateral triangles.  

I'm not sure what exactly you want, but see
http://www.cris.com/~rjbono/html/dome_res.html for some more resources.

Christoph

-- 
Christoph Hormann <chr### [at] gmxde>
IsoWood include, radiosity tutorial, TransSkin and other 
things on: http://www.schunter.etc.tu-bs.de/~chris/


Post a reply to this message

From:
Subject: Re: sphere triangulation controlled by int
Date: 8 Nov 2001 05:13:00
Message: <n7mkutgl9ebd34odoi3ekk8jjnsqf02eaf@4ax.com>
On Thu, 08 Nov 2001 10:05:45 +0100, Christoph Hormann <chr### [at] gmxde>
wrote:

> There are of course an infinite number of possible tesselations of a
> sphere

of course

> the best results can be expected from a method producing nearly
> equilateral triangles.

as I expected

> I'm not sure what exactly you want, but see
> http://www.cris.com/~rjbono/html/dome_res.html for some more resources.

thanks. I found important sentence somewhere at those links. My method was good
but I started with spliting from tetrahedron but should from octahedron. Here is
simple source to show fast nice triangulation controled by integer Step
variable.

#declare Step=7;

#macro Split(P1,P2,P3,Step)
  #local P1=vnormalize(P1);
  #local P2=vnormalize(P2);
  #local P3=vnormalize(P3);
  #if(Step>0)
    Split(P1,(P1+P2)/2,(P1+P3)/2,Step-1)
    Split(P2,(P2+P1)/2,(P2+P3)/2,Step-1)
    Split(P3,(P3+P2)/2,(P3+P1)/2,Step-1)
    Split((P2+P3)/2,(P1+P2)/2,(P1+P3)/2,Step-1)
  #else
    triangle{P1,P2,P3}
  #end
#end

mesh{
  Split(x,z,y,Step)
  Split(z,-x,y,Step)
  Split(-x,-z,y,Step)
  Split(-z,x,y,Step)
  Split(x,z,-y,Step)
  Split(z,-x,-y,Step)
  Split(-x,-z,-y,Step)
  Split(-z,x,-y,Step)
}

ABX
--
#declare _=function(a,b,x){((a^2)+(b^2))^.5-x}#default {pigment{color rgb 1}}
union{plane{y,-3}plane{-x,-3}finish{reflection 1 ambient 0}}isosurface{ //ABX
function{_(x-2,y,1)|_((x+y)*.7,z,.1)|_((x+y+2)*.7,z,.1)|_(x/2+y*.8+1.5,z,.1)}
contained_by{box{<0,-3,-.1>,<3,0,.1>}}translate z*15finish{ambient 1}}//POV35


Post a reply to this message

From: David Wallace
Subject: Re: sphere triangulation controlled by int
Date: 7 Dec 2001 09:57:48
Message: <3c10d8ec@news.povray.org>
Actually, I started with a tessellated dodecahedron:

#declare Buckya = mesh2 {
 vertex_vectors {
  32,
  < 6065.089,  7950.767,    0.000>, < 1874.216,  7950.767, 5768.242>,
<-4906.760,  7950.767, 3564.970>,
  <-4906.760,  7950.767,-3564.970>, < 1874.216,  7950.767,-5768.242>, <
9822.463,  1875.956,    0.000>,
  < 3035.308,  1875.956, 9341.718>, <-7946.540,  1875.956, 5773.499>,
<-7946.540,  1875.956,-5773.499>,
  < 3035.308,  1875.956,-9341.718>, < 7946.540, -1875.956, 5773.499>,
<-3035.308, -1875.956, 9341.718>,
  <-9822.463, -1875.956,    0.000>, <-3035.308, -1875.956,-9341.718>, <
7946.540, -1875.956,-5773.499>,
  < 4906.760, -7950.767, 3564.970>, <-1874.216, -7950.767, 5768.242>,
<-6065.089, -7950.767,    0.000>,
  <-1874.216, -7950.767,-5768.242>, < 4906.760, -7950.767,-3564.970>, <
0.000, 10000.000,    0.000>,
  <    0.000,-10000.000,    0.000>, < 7236.068,  4472.136, 5257.311>,
<-2763.932,  4472.136, 8506.508>,
  <-8944.272,  4472.136,    0.000>, <-2763.932,  4472.136,-8506.508>, <
7236.068,  4472.136,-5257.311>,
  < 8944.272, -4472.136,    0.000>, < 2763.932, -4472.136, 8506.508>,
<-7236.068, -4472.136, 5257.311>,
  <-7236.068, -4472.136,-5257.311>, < 2763.932, -4472.136,-8506.508>,
 }
 face_indices {
  60,
  < 20, 0, 1>, < 20, 1, 2>, < 20, 2, 3>, < 20, 3, 4>, < 20, 4, 0>,
  < 21, 15, 19>, < 21, 16, 15>, < 21, 17, 16>, < 21, 18, 17>, < 21, 19, 18>,
  < 22, 0, 5>, < 22, 5, 10>, < 22, 10, 6>, < 22, 6, 1>, < 22, 1, 0>,
  < 23, 1, 6>, < 23, 6, 11>, < 23, 11, 7>, < 23, 7, 2>, < 23, 2, 1>,
  < 24, 2, 7>, < 24, 7, 12>, < 24, 12, 8>, < 24, 8, 3>, < 24, 3, 2>,
  < 25, 3, 8>, < 25, 8, 13>, < 25, 13, 9>, < 25, 9, 4>, < 25, 4, 3>,
  < 26, 4, 9>, < 26, 9, 14>, < 26, 14, 5>, < 26, 5, 0>, < 26, 0, 4>,
  < 27, 15, 10>, < 27, 10. 5>, < 27, 5, 14>, < 27, 14, 19>, < 27, 19, 15>,
  < 28, 16, 11>, < 28, 11, 6>, < 28, 6, 10>, < 28, 10, 15>, < 28, 15, 16>,
  < 29, 17, 12>, < 29, 12, 7>, < 29, 7, 11>, < 29, 11, 16>, < 29, 16, 17>,
  < 30, 18, 13>, < 30, 13, 8>, < 30, 8, 12>, < 30, 12, 17>, < 30, 17, 18>,
  < 31, 19, 14>, < 31, 14,  9>, < 31,  9, 13>, < 31, 13, 18>, < 31, 18, 19>
 }
}

I put the vertex data for a mesh(1) variant of this "sphere" into a text
file, then used this macro to make the mesh object:

#macro MakeBall(iFile)
 #fopen Source iFile read
 #read (Source, nFaces)
 #local i=0;
 mesh {
  #while ((i<nFaces)&defined(Source))
   #read (Source, va, vb, vc)
   triangle { va, vb, vc }
   #local i = i + 1;
  #end
 }
 #fclose Source
#end

I also split the triangles into 4 equal pieces with this macro:

#macro SmoothBall(iFile,oFile)
 #fopen Source iFile read
 #fopen Target oFile write
 #read (Source, nFaces)
 #write (Target, nFaces*4,",\n")
 #local i=0;
 #while ((i<nFaces)&defined(Source))
  #read (Source, va, vb, vc)
  #local vab = vnormalize(va+vb)*bRad;
  #local vbc = vnormalize(vb+vc)*bRad;
  #local vca = vnormalize(vc+va)*bRad;

  #local vsab = concat("<",vstr(3,vab,", ",0,3),">,\n");
  #local vsbc = concat("<",vstr(3,vbc,", ",0,3),">,\n");
  #local vsca = concat("<",vstr(3,vca,", ",0,3),">,\n");

  #write (Target, vsab, vsbc, vsca)
  #write (Target, va, ",\n", vsab, vsca)
  #write (Target, vsab, vb, ",\n", vsbc)
  #write (Target, vsca, vsbc, vc, ",\n")
  #local i = i + 1;
 #end
 #fclose Target
 #fclose Source
#end

I used 10000 for bRad but you can use what you like.

The text file with the original data is a bit large to include here, but I
can send a zipped text file if someone needs it.


news:n7mkutgl9ebd34odoi3ekk8jjnsqf02eaf@4ax.com...
> On Thu, 08 Nov 2001 10:05:45 +0100, Christoph Hormann
<chr### [at] gmxde>
> wrote:
>
> > There are of course an infinite number of possible tesselations of a
> > sphere
>
> of course
>
> > the best results can be expected from a method producing nearly
> > equilateral triangles.
>
> as I expected
>
> > I'm not sure what exactly you want, but see
> > http://www.cris.com/~rjbono/html/dome_res.html for some more resources.

>
> thanks. I found important sentence somewhere at those links. My method was
good
> but I started with spliting from tetrahedron but should from octahedron.
Here is
> simple source to show fast nice triangulation controled by integer Step
> variable.
>
> #declare Step=7;
>
> #macro Split(P1,P2,P3,Step)
>   #local P1=vnormalize(P1);
>   #local P2=vnormalize(P2);
>   #local P3=vnormalize(P3);
>   #if(Step>0)
>     Split(P1,(P1+P2)/2,(P1+P3)/2,Step-1)
>     Split(P2,(P2+P1)/2,(P2+P3)/2,Step-1)
>     Split(P3,(P3+P2)/2,(P3+P1)/2,Step-1)
>     Split((P2+P3)/2,(P1+P2)/2,(P1+P3)/2,Step-1)
>   #else
>     triangle{P1,P2,P3}
>   #end
> #end
>
> mesh{
>   Split(x,z,y,Step)
>   Split(z,-x,y,Step)
>   Split(-x,-z,y,Step)
>   Split(-z,x,y,Step)
>   Split(x,z,-y,Step)
>   Split(z,-x,-y,Step)
>   Split(-x,-z,-y,Step)
>   Split(-z,x,-y,Step)
> }
>
> ABX
> --
> #declare _=function(a,b,x){((a^2)+(b^2))^.5-x}#default {pigment{color rgb
1}}
> union{plane{y,-3}plane{-x,-3}finish{reflection 1 ambient 0}}isosurface{
//ABX
>
function{_(x-2,y,1)|_((x+y)*.7,z,.1)|_((x+y+2)*.7,z,.1)|_(x/2+y*.8+1.5,z,.1)
}
> contained_by{box{<0,-3,-.1>,<3,0,.1>}}translate z*15finish{ambient
1}}//POV35


Post a reply to this message

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