POV-Ray : Newsgroups : povray.binaries.images : HELP, table top clipped by object, HOW? Server Time
4 Oct 2024 17:19:01 EDT (-0400)
  HELP, table top clipped by object, HOW? (Message 1 to 4 of 4)  
From: Mark Palmquist
Subject: HELP, table top clipped by object, HOW?
Date: 24 Feb 1999 21:44:07
Message: <36D4BAA3.928622E7@earthlink.net>
I have made a loop to render [X] sided extruded polygons for an
octaconal table, gazebo, etc...  It works fine exept now I need a way to
clip a box with the object for shelves and top.  As a somewhat newcommer
to POV I just can't seem to get this solved.  I have attached an image
and here is the source.  The red 'top' was scaled to move it away from
the main base object.  I now that clipped_by is not right but how to end
up with an octagonal piece?

#include "colors.inc"
#include "metals.inc"
#include "glass.inc"

global_settings
{
  assumed_gamma 1.0
}

// ----------------------------------------
camera
{
  location  <1.0, 40, -10>
  direction 1.5*z
  right     4/3*x
  look_at   <1.0, 0.0, 0>
}

light_source
{
  0*x // light's position (translated below)
  color red 1.0  green 1.0  blue 1.0  // light's color
  translate <-30, 30, -30>
}

// ----------------------------------------

#declare S = 6                        //number of segments
#declare OR = 4                       //object radius
#declare ANGLE = 360/S                //Angle of each segment

#declare PT = texture {T_Glass3}    //texture of panes
#declare PD = .1                      //pane thickness
#declare PH = 6                       //pane Top
#declare PB = 1                       //pane Bottom

#declare DT = texture {T_Copper_1D}   //texture of panes
#declare DH = 6.001                   //divider Top
#declare DB = 0                       //divider Bottom
#declare DD = .4                      //divider diameter

#declare L = (2*OR) * tan(radians(ANGLE/2))  //Pane length

//table

//base
#declare SA = S

#declare base =
union{
  #while (S >=0)
    union{
      box{ <-PD/2, PB, 0>, < PD/2, PH, L> texture {PT}}
      cylinder{ <0,DB,0>, <0,DH,0> DD texture {DT}}
      translate <OR,0,-L/2>
      rotate <0,(ANGLE*S),0>
    }
    #declare S = S - 1;
  #end
  }

#declare S = SA
#declare baseclip =
union{
  #while (S >=0)
    union{
      box{ <-PD/2, PB, 0>, < PD/2, PH, L> }
      translate <OR,0,-L/2>
      rotate <0,(ANGLE*S),0>
    }
    #declare S = S - 1;
  #end
  }

object {base}

  box {<-10,6,-10>,<10,6.1,10> pigment{Red}
  clipped_by{object{baseclip}}
  scale <1.5,1,1.5>
  }


Post a reply to this message


Attachments:
Download 'extrude_poly.jpg' (14 KB)

Preview of image 'extrude_poly.jpg'
extrude_poly.jpg


 

From: GrimDude
Subject: Re: HELP, table top clipped by object, HOW?
Date: 25 Feb 1999 00:51:11
Message: <36d4e4cf.0@news.povray.org>
Uh, use a prism/prisms? :)

GrimDude
vos### [at] arkansasnet


Post a reply to this message

From: Karsten Senz
Subject: Re: HELP, table top clipped by object, HOW?
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

From: Gregoire Millette
Subject: Re: HELP, table top clipped by object, HOW?
Date: 10 Mar 1999 23:54:19
Message: <36E74C98.E14A2FE1@sympatico.ca>
Octagonol should be 8 sided and not 6 :)
Just thought I might point that out to you.

greg


Post a reply to this message

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