POV-Ray : Newsgroups : povray.newusers : cutting irregular holes?! : Re: cutting irregular holes?! Server Time
30 Jul 2024 06:26:03 EDT (-0400)
  Re: cutting irregular holes?!  
From: Mike Williams
Date: 14 Sep 2004 04:44:44
Message: <AsIMVEAY9qRBFw02@econym.demon.co.uk>
Wasn't it frozen who wrote:

>I try to build a medieval building using a photo of a real castle as
>reference. Right now I'm stuck at "cutting" the windows into it. I used a
>large box for the building itself. Now I need to cut the windows into it,
>and so I thought I could use a difference CSG. But the windows have a
>shape, which is different from a box or sphere or anything like this. They
>somehow look like a box in the lower part with two archs building the upper
>part. Using a CSG to cut a box-shaped window is no problem. But what kind
>of shape can be used to build the desired arched window AND is usable in a
>CSG? Using a mesh for example leads to an parsing error, since meshes
>aren't allowed in CSGs.

Using a mesh doesn't normally lead to a parsing error, but it won't do
quite what you want unless you ensure that the mesh has a well defined
inside. To achieve that, you need the mesh to be closed and you need to
define the inside_vector.

Or you could create your window shapes from the unions and intersections
of simpler shapes, something like this: [Note that there are slight
overlaps between the parts that make up the Window shape, without these
overlaps the surfaces between the parts would sometimes become visible.]


camera {location  <7,4,-10> look_at <0,0,0> angle 20}
light_source {<-30, 100, -30> color rgb 1}

// A simple box shape doe the body of the building
#declare Wall = difference {
  box {<-1.02,0,-1.02><1.02,0.98,1.02>}
  box {<-1,0,-1><1,1,1>}
}

// The window is a box plus two arches
#declare Window = union {
  box {-1,1}
  intersection {
    cylinder{<1,1,-1><1,1,1>,2}
    box{<-1,0.9,-1> <0.01,3,1>}
  }
  intersection {
    cylinder{<-1,1,-1><-1,1,1>,2}
    box{<1,0.9,-1> <0,3,1>}
  }
  scale 0.1
}

// Remove several copies of the window from the box
difference {
  object {Wall}
  object {Window translate <0,0.5,-1>}
  object {Window translate <-0.6,0.5,-1>}
  object {Window translate <0.6,0.5,-1>}
  object {Window rotate y*90 translate <1,0.5,0>}
  pigment {rgb 1}
}

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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