POV-Ray : Newsgroups : povray.binaries.images : HELP, table top clipped by object, HOW? : Re: HELP, table top clipped by object, HOW? Server Time
4 Oct 2024 19:20:27 EDT (-0400)
  Re: HELP, table top clipped by object, HOW?  
From: Karsten Senz
Date: 25 Feb 1999 03:54:27
Message: <36D50FB6.A916E379@wi-bw.tfh-wildau.de>
you could define a cylinder at the origin with the radius r and do some
csg-differencing. The folowing code is untested and should at least give
an idea how to achieve what you are looking for. 

Happy coding!

// tabletop
#declare tableTopsBottom  = 6.0;  // or DH
#declare tableTopsHeigth  = 0.5;
#declare tableTopsRadius  = 4.0;  // you could use your OR variable +
some offset
#declare numberOfSegments = 6.0; // or S
#declare segmentsAngle    = 360/numberOfSegments;
#declare segmentAngleRAD  = segmentAngle * pi/180;

//now some simple math to determine the size of the boxes
#declare boxHalfDepth = sin(segmentAngleRAD/2) * tableTopsRadius + 0.01;
#declare boxStartX    = cos(segmentAngleRAD/2) * tableTopsRadius;
#declare boxEndX      = tableTopsRadius + 0.2;
difference
{
  cylinder
  {
    <0.0,0.0,0.0>
    <0.0,tableTopsHeigth,0.0>
    tableTopsRadius +0.01  // make it some bigger due to
coincidental(??) surfaces in csg
  }
  
  #declare counter = 0;
  #while (counter<numberOfSegments)
    box
    {
      <boxStartX,-0.01,-boxHalfDepth>
      <boxEndX,tableTopsHeigth+0.01,boxHalfDepth>
      rotate y*(counter * segmentsAngle)
    }
    #declare counter = counter +1;
  #end
}


Post a reply to this message

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