POV-Ray : Newsgroups : povray.general : Graininess : Re: Graininess Server Time
31 Jul 2024 08:24:49 EDT (-0400)
  Re: Graininess  
From: SharkD
Date: 12 Jan 2008 12:50:00
Message: <web.4788fd8622fbe8cfdcbab3310@news.povray.org>
"Trevor G Quayle" <Tin### [at] hotmailcom> wrote:
> Hmm, I can't see either of these.  Maybe repost your scene and macro.  Perhaps
> something is different (My changes or yours).  Is it still there after you fix
> the negative cone issue above?

Here's the current macro:

//BEGIN
#include "math.inc"

#macro SphereGrid_Macro
 (
  SphereGrid_radii,  // The number of radial divisions. (integer)
  SphereGrid_longt,  // The number of longitudinal divisions. (integer)
  SphereGrid_lattt,  // The number of lattitudinal divisions. (integer)
  SphereGrid_radius,  // The radius of the sphere. (float)
  SphereGrid_center,  // The center coordinates of the sphere. (vector)
  SphereGrid_thickness,  // The thickness of the grid lines. (float)
  SphereGrid_offset,  // Determines whether the divisions are offset by half the
amount (sometimes necessary when doing cut-aways at intervals matching the
grid's divisions). (boolian)
 )

 #local SphereGrid_thickness = SphereGrid_thickness/SphereGrid_radius;
 #local SphereGrid_bounds = sphere
 {
  0, SphereGrid_radius
 }

 #declare SphereGrid_Object = union
 {

  #local SphereGrid_increment = 1/SphereGrid_radii;
  #local SphereGrid_i = 0;
  #local SphereGrid_start = 0;
  #if (SphereGrid_offset = on)
   #local SphereGrid_start = SphereGrid_increment/2;
  #end
  #while(SphereGrid_i < SphereGrid_radii)
   #local SphereGrid_value = SphereGrid_radius * (SphereGrid_start +
SphereGrid_i * SphereGrid_increment);
   difference
   {
    sphere
    {
     0, SphereGrid_value + SphereGrid_thickness/2
    }
    sphere
    {
     0, SphereGrid_value - SphereGrid_thickness/2
    }
    bounded_by
    {
     SphereGrid_bounds
    }
   }
//   #debug concat("radii_value = ", str(SphereGrid_value, 0, -1),"\n")
   #local SphereGrid_i = SphereGrid_i + 1;
  #end

  #local SphereGrid_increment = 1/SphereGrid_longt;
  #local SphereGrid_i = 0;
  #local SphereGrid_start = 0;
  #if (SphereGrid_offset = on)
   #local SphereGrid_start = SphereGrid_increment/2;
  #end
  #while(SphereGrid_i < SphereGrid_longt)
   #local SphereGrid_value = 360 * (SphereGrid_start + SphereGrid_i *
SphereGrid_increment);
/*
   intersection
   {
    plane
    {
     z, SphereGrid_thickness/2
    }
    plane
    {
     -z, SphereGrid_thickness/2
    }
    rotate y * SphereGrid_value
   }
*/
   box
   {
    <2*SphereGrid_radius, 2*SphereGrid_radius, SphereGrid_thickness/2,>,
<-2*SphereGrid_radius, -2*SphereGrid_radius, -SphereGrid_thickness/2,>
    rotate y * SphereGrid_value
   }

//   #debug concat("longt_value = ", str(SphereGrid_value, 0, -1),"\n")
   #local SphereGrid_i = SphereGrid_i + 1;
  #end

  #local SphereGrid_increment = 1/SphereGrid_lattt;
  #local SphereGrid_i = 0;
  #local SphereGrid_start = 0;
  #if (SphereGrid_offset = on)
   #local SphereGrid_start = SphereGrid_increment/2;
  #end
  #while(SphereGrid_i < SphereGrid_lattt)
   #local SphereGrid_value = 180 * (SphereGrid_start + SphereGrid_i *
SphereGrid_increment);
   #if (SphereGrid_i <= SphereGrid_lattt/2)
    difference
    {
     cone
     {
      0, 0,
      2*SphereGrid_radius*y, 2*SphereGrid_radius*abs(tand(SphereGrid_value))
      translate SphereGrid_radius*-y * 1/abs(sind(SphereGrid_value)) *
SphereGrid_thickness/2
     }
     cone
     {
      0, 0,
      2*SphereGrid_radius*y, 2*SphereGrid_radius*abs(tand(SphereGrid_value))
      translate SphereGrid_radius*y * 1/abs(sind(SphereGrid_value)) *
SphereGrid_thickness/2
     }
     bounded_by
     {
      SphereGrid_bounds
     }
    }
   #else
    difference
    {
     cone
     {
      0, 0,
      2*SphereGrid_radius*-y, 2*SphereGrid_radius*abs(tand(SphereGrid_value))
      translate SphereGrid_radius*y * 1/abs(sind(SphereGrid_value)) *
SphereGrid_thickness/2
     }
     cone
     {
      0, 0,
      2*SphereGrid_radius*-y, 2*SphereGrid_radius*abs(tand(SphereGrid_value))
      translate SphereGrid_radius*-y * 1/abs(sind(SphereGrid_value)) *
SphereGrid_thickness/2
     }
     bounded_by
     {
      SphereGrid_bounds
     }
    }
   #end
//   #debug concat("lattt_value = ", str(SphereGrid_value, 0, -1),"\n")
   #local SphereGrid_i = SphereGrid_i + 1;
  #end
  translate SphereGrid_center
 }
#end
//END


Post a reply to this message

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