 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Samuel B." <stb### [at] hotmail com> 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] hotmail com> wrote:
> "Samuel B." <stb### [at] hotmail com> 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] hotmail com> wrote:
> "Samuel B." <stb### [at] hotmail com> 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] gmail com> wrote:
> "Samuel B." <stb### [at] hotmail com> 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] netscape net> wrote:
> "Samuel B." <stb### [at] hotmail com> wrote:
> > "Samuel B." <stb### [at] hotmail com> 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] degroot org> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Samuel B." <stb### [at] hotmail com> wrote:
> Btw, what were you using this kind of geometry for?
Originally, I was using it to find the radius of the sphere I needed to subtract
from a (rounded) box to make a laptop keyboard key.
It's also useful for making any concave "cap" to a cylinder or a box.
https://news.povray.org/povray.general/message/%3Cweb.643317271ef881ca1f9dae3025979125%40news.povray.org%3E/#%3Cweb.643
317271ef881ca1f9dae3025979125%40news.povray.org%3E
I also needed this, or a variation thereof, to find the center of a very large
circle in order to model a sheet metal / screen development for making a
replacement globe for a vintage dual-fuel lantern I have.
Modeling software is great, since you can get the curve you need using the
actual center, since the entire workspce is virtual, but when laying out such an
arc IRL, one needs alternative approaches when either the center is inaccessible
or the radius makes scribing the arc wildly impractical. There are several
such ingenious approaches.
- BW
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Samuel B." <stb### [at] hotmail com> wrote:
> Macro incoming...
Second version of the macro.
Changes:
* glass now renders correctly
* can specify the position of the bottom horizontal frame member
* various clarification of comments
The macro:
#macro Gothic_Window
(
WW, // window box width (total window width divided by two)
WH, // window box height
WD, // window box depth
AH, // arch height (beginning from top [-y], should be >=window width and
<window height)
HY, // y-position for horizontal cross member (beginning from y, will only be
used if there is room for it)
FR, // frame radius (thickness of the frame)
ET, // enclosure thickness (window box, should be qual or less than frame
radius)
NA, // number of arch pieces
PT, // number of arch pieces
BW // window pane bevel width
)
#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 FR2 = .4 * FR;
// horizontal frame at bottom of curved arch
cylinder{-<WW, AH, 0>, <WW, -AH, 0>, FR}
cylinder{-<WW, AH, FR>, <WW, -AH, -FR>, FR2}
cylinder{-<WW, WH, 0>, <WW, -WH, 0>, FR}
cylinder{-<WW, WH, FR>, <WW, -WH, -FR>, FR2}
// bottom horizontal frame piece
#if(HY<WH-AH)
cylinder{<-WW, -WH+HY, 0>, <WW, -WH+HY, 0>, FR}
cylinder{<-WW, -WH+HY, -FR>, <WW, -WH+HY, -FR>, FR2}
#end
// multiarch setup
#for(I, 0, NA)
#if(I<NA)
#local ArchPiece =
intersection{
merge{
torus{
CR, FR
rotate x*90
translate CC+2*x*WW*I/NA
}
torus{
CR, FR2
rotate x*90
translate CC-z*FR+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*FR>, <-CC.x, CC.y, 2*FR>, CR}
#end
}
object{ArchPiece}
object{ArchPiece scale <-1, 1, 1>}
#end
cylinder{-<WW, WH, 0>, -<WW, AH, 0>, FR translate x*2*WW*I/NA}
cylinder{-<WW, WH, FR>, -<WW, AH, FR>, FR2 translate x*2*WW*I/NA}
#end
// fill the corners
sphere{-<WW, WH, 0>, FR}
sphere{<WW, -WH, 0>, FR}
sphere{-<WW, WH, FR>, FR2}
sphere{<WW, -WH, -FR>, FR2}
#local TexWindow =
texture{
pigment{rgb .75 transmit .85}
finish{reflection{0, 1 fresnel} conserve_energy}
}
// glass window pane
#if(true)
union{
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{
#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(HY<WH-AH)
,abs(y+WH-HY)
#end
) / BW
)
}
bump_size 1
accuracy .003
}
}
}
interior{ior 1.5}
double_illuminate
}
#end
// place object at y=0
translate y*WH
}
#end
Macro invocation:
object{
Gothic_Window(
1.0, // window box width (total window width divided by two)
4.0, // window box height
0.75, // window box depth
1.875, // arch height (beginning from top [-y], should be >=window width and
<window height)
0.375, // y-position for horizontal cross member (beginning from y, will only
be used if there is room for it)
0.05, // frame radius (thickness of the frame)
0.01, // enclosure thickness (window box, should be qual or less than frame
radius)
3, // number of arch pieces
0.01, // window pane thickness
0.125 // window pane bevel width
)
// window box material goes here
pigment{rgb .75}
}
Sam
Post a reply to this message
Attachments:
Download 'gothicarchb0m_59s.jpg' (73 KB)
Preview of image 'gothicarchb0m_59s.jpg'

|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Bald Eagle" <cre### [at] netscape net> wrote:
> "Samuel B." <stb### [at] hotmail com> wrote:
>
> > Btw, what were you using this kind of geometry for?
>
> Originally, I was using it to find the radius of the sphere I needed to subtract
> from a (rounded) box to make a laptop keyboard key.
>
> It's also useful for making any concave "cap" to a cylinder or a box.
>
>
https://news.povray.org/povray.general/message/%3Cweb.643317271ef881ca1f9dae3025979125%40news.povray.org%3E/#%3Cweb.6
43
> 317271ef881ca1f9dae3025979125%40news.povray.org%3E
>
> I also needed this, or a variation thereof, to find the center of a very large
> circle in order to model a sheet metal / screen development for making a
> replacement globe for a vintage dual-fuel lantern I have.
>
> Modeling software is great, since you can get the curve you need using the
> actual center, since the entire workspce is virtual, but when laying out such an
> arc IRL, one needs alternative approaches when either the center is inaccessible
> or the radius makes scribing the arc wildly impractical. There are several
> such ingenious approaches.
>
> - BW
It looks like a good solution, but I must admit I can't quite comprehend a lot
of it. (I will keep trying, though.)
Speaking of solutions, I've been making an effort to not use the trace()
function so much since it just adds more complications when porting to another
context. And I just like knowing how something is done instead of relying on a
'black box' function. (Not that trace() is very black-box in theory, but
figuring out every intersection for every traceable object is not a small task.)
Did you ever post the dual-lantern model? I can't remember if it was you, or
someone else on another forum using Blender. /Somebody/ posted a lantern, that's
all I know!
I keep getting stuck figuring out things like intricate geometry, rendering
efficiency, or some other complicated implementation of things. And then I burn
out any energy I had producing the thing I was after initially! :S Drawing
things is much easier than rendering them. The devil is in the details...
distracting me, I guess.
Sam
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|
 |