|
|
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'
|
|
|
|
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
|
|