|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hi,
Here's a piece of gothitecture I cooked up the last couple of days. It's a
generic gothic/medieval window macro. Nothing too involved. The glass beveling
is a simple surface normal, and everything else is just good old, traditional
CSG.
Macro incoming...
Sam
Post a reply to this message
Attachments:
Download 'gothicarchb6m_43s.jpg' (348 KB)
Preview of image 'gothicarchb6m_43s.jpg'
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Samuel B." <stb### [at] hotmailcom> wrote:
> Macro incoming...
Here's the macro. It's not exactly easy to invoke, as you can see by the number
of parameters. Be warned that the arch height cannot fall below the window
width, nor can the window height be less than the arch height. (If that seems
confusing, just play with the params.)
Scroll below the macro definition to see how it's used (includes comments).
#macro Gothic_Window(WW, AH, WH, WD, LT, ET, NA, PT, BW)
#local Eps = .0001; // a small value
union{
// -< window width, arch height, 0 >
#local P = -<WW, AH, 0>;
// arch circle center
#local CC = <.5*(P.x-P.y/(WW/AH)), -AH, 0>;
// arch circle radius
#local CR = vlength(CC);
// window box
box{<-WW, -WH+ET, -Eps>, <-WW+ET, -AH, WD+Eps>}
box{<WW-ET, -WH+ET, -Eps>, <WW, -AH, WD+Eps>}
box{<-WW, -WH, -Eps>, <WW, -WH+ET, WD+Eps>}
difference{
box{<-WW, -AH, 0>, <WW, 0, WD>}
intersection{
cylinder{<CC.x, CC.y, -Eps>, <CC.x, CC.y, WD+Eps>, CR-ET}
cylinder{<-CC.x, CC.y, -Eps>, <-CC.x, CC.y, WD+Eps>, CR-ET}
}
}
#local LT2 = .4 * LT;
// horizonals
cylinder{-<WW, AH, 0>, <WW, -AH, 0>, LT}
cylinder{-<WW, AH, LT>, <WW, -AH, -LT>, LT2}
cylinder{-<WW, WH, 0>, <WW, -WH, 0>, LT}
cylinder{-<WW, WH, LT>, <WW, -WH, -LT>, LT2}
// bottom horizontal, if there's enough room
#if(WH-AH > 16*LT)
cylinder{-<WW, WH-8*LT, 0>, <WW, -WH+8*LT, 0>, LT}
cylinder{-<WW, WH-8*LT, LT>, <WW, -WH+8*LT, -LT>, LT2}
#end
// fancy multiarch setup
#for(I, 0, NA)
#if(I<NA)
#local ArchPiece =
intersection{
merge{
torus{
CR, LT
rotate x*90
translate CC+2*x*WW*I/NA
}
torus{
CR, LT2
rotate x*90
translate CC-z*LT+2*x*WW*I/NA
}
}
plane{y, -AH inverse}
// use vertical cut for first item, otherwise use a cylinder
#if(I=0)
plane{x, 0}
#else
cylinder{<-CC.x, CC.y, -2*LT>, <-CC.x, CC.y, 2*LT>, CR}
#end
}
object{ArchPiece}
object{ArchPiece scale <-1, 1, 1>}
#end
cylinder{-<WW, WH, 0>, -<WW, AH, 0>, LT translate x*2*WW*I/NA}
cylinder{-<WW, WH, LT>, -<WW, AH, LT>, LT2 translate x*2*WW*I/NA}
#end
// fill the corners
sphere{-<WW, WH, 0>, LT}
sphere{<WW, -WH, 0>, LT}
sphere{-<WW, WH, LT>, LT2}
sphere{<WW, -WH, -LT>, LT2}
#local TexWindow =
texture{
pigment{rgb .75 transmit .85}
finish{reflection{0, 1 fresnel} conserve_energy}
}
// window pane
box{
<-WW+Eps, -WH+Eps, PT>, <WW-Eps, -Eps, PT>
texture{TexWindow}
inverse
}
box{
<-WW+Eps, -WH+Eps, Eps>, <WW-Eps, -Eps, Eps>
texture{
TexWindow
normal{
//pigment{ // debug
#local CX = CC.x;
#local CY = CC.y;
#local FA =
function{
min(
1
#for(I, 0, NA-1)
,abs(sqrt(pow(x-CX-2*WW*I/NA, 2)+pow(y-CY, 2)*(y>-AH))-CR)
#end
)
}
function{
min(
1,
min(
FA(x, y, 0),
FA(-x, y, 0),
abs(y+AH),
abs(y+WH)
#if(WH-AH > 16*LT)
,abs(y+WH-8*LT)
#end
) / BW
)
}
bump_size 1
accuracy .003
}
}
interior{ior 1.5}
double_illuminate
}
// place object at y=0
translate y*WH
}
#end
// invoke the macro
object{
Gothic_Window(
1.0, // window width (total_width/2)
1.875, // arch height (>=WW & <=WH)
4.0, // window height
0.75, // window depth
.05/1, // line thickness
.01, // thickness of enclosure around window (window box)
3, // number of arch pieces
.1, // window pane thickness
.2 // window pane bevel width
)
pigment{rgb .75}
}
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Samuel B." <stb### [at] hotmailcom> wrote:
> gothic/medieval window macro
And here's an image showcasing the underlying geometry behind all this.
Basically: for any given window width and arch height, find an appropriate
circle to describe the arch.
Post a reply to this message
Attachments:
Download 'gothicarchgeom.jpg' (22 KB)
Preview of image 'gothicarchgeom.jpg'
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Samuel B." <stb### [at] hotmailcom> wrote:
> Hi,
>
> Here's a piece of gothitecture I cooked up the last couple of days. It's a
> generic gothic/medieval window macro. Nothing too involved. The glass beveling
> is a simple surface normal, and everything else is just good old, traditional
> CSG.
>
> Macro incoming...
>
> Sam
Looked nice.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Samuel B." <stb### [at] hotmailcom> wrote:
> "Samuel B." <stb### [at] hotmailcom> wrote:
> > Macro incoming...
>
> Here's the macro. It's not exactly easy to invoke, as you can see by the number
> of parameters. Be warned that the arch height cannot fall below the window
> width, nor can the window height be less than the arch height. (If that seems
> confusing, just play with the params.)
>
> Scroll below the macro definition to see how it's used (includes comments).
>
> #macro Gothic_Window(WW, AH, WH, WD, LT, ET, NA, PT, BW)
> #local Eps = .0001; // a small value
>
> union{
>
> // -< window width, arch height, 0 >
> #local P = -<WW, AH, 0>;
>
> // arch circle center
> #local CC = <.5*(P.x-P.y/(WW/AH)), -AH, 0>;
>
> // arch circle radius
> #local CR = vlength(CC);
>
> // window box
> box{<-WW, -WH+ET, -Eps>, <-WW+ET, -AH, WD+Eps>}
> box{<WW-ET, -WH+ET, -Eps>, <WW, -AH, WD+Eps>}
> box{<-WW, -WH, -Eps>, <WW, -WH+ET, WD+Eps>}
> difference{
> box{<-WW, -AH, 0>, <WW, 0, WD>}
> intersection{
> cylinder{<CC.x, CC.y, -Eps>, <CC.x, CC.y, WD+Eps>, CR-ET}
> cylinder{<-CC.x, CC.y, -Eps>, <-CC.x, CC.y, WD+Eps>, CR-ET}
> }
> }
>
> #local LT2 = .4 * LT;
>
> // horizonals
> cylinder{-<WW, AH, 0>, <WW, -AH, 0>, LT}
> cylinder{-<WW, AH, LT>, <WW, -AH, -LT>, LT2}
>
> cylinder{-<WW, WH, 0>, <WW, -WH, 0>, LT}
> cylinder{-<WW, WH, LT>, <WW, -WH, -LT>, LT2}
>
> // bottom horizontal, if there's enough room
> #if(WH-AH > 16*LT)
> cylinder{-<WW, WH-8*LT, 0>, <WW, -WH+8*LT, 0>, LT}
> cylinder{-<WW, WH-8*LT, LT>, <WW, -WH+8*LT, -LT>, LT2}
> #end
>
> // fancy multiarch setup
> #for(I, 0, NA)
>
> #if(I<NA)
>
> #local ArchPiece =
> intersection{
> merge{
> torus{
> CR, LT
> rotate x*90
> translate CC+2*x*WW*I/NA
> }
> torus{
> CR, LT2
> rotate x*90
> translate CC-z*LT+2*x*WW*I/NA
> }
> }
> plane{y, -AH inverse}
> // use vertical cut for first item, otherwise use a cylinder
> #if(I=0)
> plane{x, 0}
> #else
> cylinder{<-CC.x, CC.y, -2*LT>, <-CC.x, CC.y, 2*LT>, CR}
> #end
> }
>
> object{ArchPiece}
> object{ArchPiece scale <-1, 1, 1>}
>
> #end
>
> cylinder{-<WW, WH, 0>, -<WW, AH, 0>, LT translate x*2*WW*I/NA}
> cylinder{-<WW, WH, LT>, -<WW, AH, LT>, LT2 translate x*2*WW*I/NA}
>
> #end
>
> // fill the corners
> sphere{-<WW, WH, 0>, LT}
> sphere{<WW, -WH, 0>, LT}
> sphere{-<WW, WH, LT>, LT2}
> sphere{<WW, -WH, -LT>, LT2}
>
> #local TexWindow =
> texture{
> pigment{rgb .75 transmit .85}
> finish{reflection{0, 1 fresnel} conserve_energy}
> }
>
> // window pane
> box{
> <-WW+Eps, -WH+Eps, PT>, <WW-Eps, -Eps, PT>
> texture{TexWindow}
> inverse
> }
> box{
> <-WW+Eps, -WH+Eps, Eps>, <WW-Eps, -Eps, Eps>
>
> texture{
> TexWindow
> normal{
> //pigment{ // debug
> #local CX = CC.x;
> #local CY = CC.y;
> #local FA =
> function{
> min(
> 1
> #for(I, 0, NA-1)
> ,abs(sqrt(pow(x-CX-2*WW*I/NA, 2)+pow(y-CY, 2)*(y>-AH))-CR)
> #end
> )
> }
> function{
> min(
> 1,
> min(
> FA(x, y, 0),
> FA(-x, y, 0),
> abs(y+AH),
> abs(y+WH)
> #if(WH-AH > 16*LT)
> ,abs(y+WH-8*LT)
> #end
> ) / BW
> )
> }
> bump_size 1
> accuracy .003
> }
> }
> interior{ior 1.5}
> double_illuminate
> }
>
> // place object at y=0
> translate y*WH
> }
> #end
>
> // invoke the macro
> object{
> Gothic_Window(
> 1.0, // window width (total_width/2)
> 1.875, // arch height (>=WW & <=WH)
> 4.0, // window height
> 0.75, // window depth
> .05/1, // line thickness
> .01, // thickness of enclosure around window (window box)
> 3, // number of arch pieces
> .1, // window pane thickness
> .2 // window pane bevel width
> )
> pigment{rgb .75}
> }
Nice Job! ...and thank you for the macro.
Mike
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Samuel B." <stb### [at] hotmailcom> wrote:
> "Samuel B." <stb### [at] hotmailcom> wrote:
> > gothic/medieval window macro
>
> And here's an image showcasing the underlying geometry behind all this.
> Basically: for any given window width and arch height, find an appropriate
> circle to describe the arch.
I've wound up deriving that solution from scratch about a dozen times :D
Nice macro.
- BW
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Op 18-7-2023 om 02:27 schreef Samuel B.:
> Hi,
>
> Here's a piece of gothitecture I cooked up the last couple of days. It's a
> generic gothic/medieval window macro. Nothing too involved. The glass beveling
> is a simple surface normal, and everything else is just good old, traditional
> CSG.
>
> Macro incoming...
>
> Sam
Aaah! I love this! Can it do the typically English 4-centered arch? I
have been trying to write a macro lately but did not get very far.
--
Thomas
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Mike Miller" <mil### [at] gmailcom> wrote:
> "Samuel B." <stb### [at] hotmailcom> wrote:
> > Macro incoming...
>
> Nice Job! ...and thank you for the macro.
> Mike
Thanks and np!
If you use it, keep in mind I failed to add a double_illuminate keyword and
interior ior to one of the boxes making up the window, so the glass won't be
physically accurate until fixed.
Sam
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Bald Eagle" <cre### [at] netscapenet> wrote:
> "Samuel B." <stb### [at] hotmailcom> wrote:
> > "Samuel B." <stb### [at] hotmailcom> wrote:
> > > gothic/medieval window macro
> >
> > And here's an image showcasing the underlying geometry behind all this.
> > Basically: for any given window width and arch height, find an appropriate
> > circle to describe the arch.
>
> I've wound up deriving that solution from scratch about a dozen times :D
>
> Nice macro.
>
>
> - BW
Isn't that just the way? So many times I've worked on a problem only to discover
that I had already solved it before, yet I somehow forgot! I think this was the
first time I figured out this particular problem, and the solution had me
stymied for a bit too long... but I had fun the whole time ^_^
Btw, what were you using this kind of geometry for?
Sam
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Thomas de Groot <tho### [at] degrootorg> wrote:
> Op 18-7-2023 om 02:27 schreef Samuel B.:
> >
> > Here's a piece of gothitecture I cooked up the last couple of days. [...]
>
> Aaah! I love this! Can it do the typically English 4-centered arch? I
> have been trying to write a macro lately but did not get very far.
>
> --
> Thomas
Thanks, Thomas!
Just looked up the 4-centered arch, and no, it cannot make those. This macro
only produces arches with single circular segments, while the 4-centered arch
seems to require at least two. Or worse, it uses some sort of curve not composed
entirely of circles. I'll look further into it though, and possibly make a
separate macro.
I've love to make a single all-purpose macro to cover everything, but there
seems to be as many window/arch variations as there are stars in the sky. (Ok,
that's a bit hyperbolic, but with all the extra details architects used, there
are a lot of designs out there.)
Sam
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|