POV-Ray : Newsgroups : povray.binaries.images : Archway macro Server Time
14 Nov 2024 16:24:04 EST (-0500)
  Archway macro (Message 1 to 10 of 15)  
Goto Latest 10 Messages Next 5 Messages >>>
From: Bill Pragnell
Subject: Archway macro
Date: 16 Aug 2006 10:00:01
Message: <web.44e32359326a0ad3731f01d10@news.povray.org>
Afternoon, all.

Not posted for a while; my laptops were stolen last month so raytracing's
been off the menu for a bit (unless I do it by hand - eek!).

I was doodling a few days ago during a lazy afternoon at work, and came up
with a half-decent archway macro. It builds arches with or without
keystones from curved, smooth-edged bricks using CSG. Arches are defined by
angle, number of bricks and inner / outer radius, centred on the origin.
Bricks can be spaced out or touching. Here's an example image with four
concentric arches of varying shape; it took ages to render but that's
mainly because of the radiosity and normals. I'll post source if anybody's
interested.

I was interested to note that when I hand-bounded the intersection shapes,
rendering sped up by about 4x!

Bill


Post a reply to this message


Attachments:
Download 'archbrick.png' (153 KB)

Preview of image 'archbrick.png'
archbrick.png


 

From: Stefan Viljoen
Subject: Re: Archway macro
Date: 16 Aug 2006 10:39:17
Message: <44e32e14@news.povray.org>
Bill Pragnell spake:

> Afternoon, all.
> 
> Not posted for a while; my laptops were stolen last month so raytracing's
> been off the menu for a bit (unless I do it by hand - eek!).
> 
> I was doodling a few days ago during a lazy afternoon at work, and came up
> with a half-decent archway macro. It builds arches with or without
> keystones from curved, smooth-edged bricks using CSG. Arches are defined
> by angle, number of bricks and inner / outer radius, centred on the
> origin. Bricks can be spaced out or touching. Here's an example image with
> four concentric arches of varying shape; it took ages to render but that's
> mainly because of the radiosity and normals. I'll post source if anybody's
> interested.
> 
> I was interested to note that when I hand-bounded the intersection shapes,
> rendering sped up by about 4x!
> 
> Bill

Nice! This will be quite useful for a large number of people.

Thanks
-- 
Stefan Viljoen
Software Support Technician / Programmer
Polar Design Solutions


Post a reply to this message

From: Thomas de Groot
Subject: Re: Archway macro
Date: 16 Aug 2006 10:59:23
Message: <44e332cb$1@news.povray.org>
"Stefan Viljoen polard.com>" <spamnot@<removethis> schreef in bericht 
news:44e32e14@news.povray.org...

>> Not posted for a while; my laptops were stolen last month so raytracing's
>> been off the menu for a bit (unless I do it by hand - eek!).

That's terrible! I hope you made backups to some other place?

>
> Nice! This will be quite useful for a large number of people.
>

Yesss! Yesss! Very useful!!!  :-)

Thomas


Post a reply to this message

From: Mark Birch
Subject: Re: Archway macro
Date: 16 Aug 2006 19:25:01
Message: <web.44e3a83e4f0e252c4daddc090@news.povray.org>
"Bill Pragnell" <bil### [at] hotmailcom> wrote:
>
> I was interested to note that when I hand-bounded the intersection shapes,
> rendering sped up by about 4x!
>
> Bill

I wrote an 'archtile' macro to create the same rounded tile shape (but not
the entire arch), and I found the same thing.  Unbounded tiles took ages to


Post a reply to this message

From: mine
Subject: Re: Archway macro
Date: 17 Aug 2006 03:15:01
Message: <web.44e416c94f0e252c53a817d10@news.povray.org>
Very cool, They look great.


Post a reply to this message

From: Kenneth
Subject: Re: Archway macro
Date: 17 Aug 2006 04:15:00
Message: <web.44e425074f0e252c8ec41e640@news.povray.org>
"Bill Pragnell" <bil### [at] hotmailcom> wrote:
> Afternoon, all.
>
> Not posted for a while; my laptops were stolen last month so raytracing's
> been off the menu for a bit ..

That sounds disastrous! You have my sympathies.

>
> I was doodling a few days ago during a lazy afternoon at work, and came up
> with a half-decent archway macro...

VERY cool, and useful.  Good to see that the loss of the laptops hasn't kept
you down! Always a pleasure to see what you're up to.

Ken


Post a reply to this message

From: Bill Pragnell
Subject: Re: Archway macro
Date: 17 Aug 2006 05:20:00
Message: <web.44e4343d4f0e252c731f01d10@news.povray.org>
"Thomas de Groot" <t.d### [at] internlnet> wrote:
> >> Not posted for a while; my laptops were stolen last month so raytracing's
> >> been off the menu for a bit (unless I do it by hand - eek!).
> That's terrible! I hope you made backups to some other place?

As luck would have it, I had backed up barely a week previously. I might
have lost a small number of photos, and the effort put into assembling my
iTunes library, but that's about it... :)

> "Stefan Viljoen polard.com>" <spamnot@<removethis> schreef in bericht
> news:44e32e14@news.povray.org...
> > Nice! This will be quite useful for a large number of people.

Sounds like there's some interest. I'll tidy it up and post it in a bit!

Bill


Post a reply to this message

From: Bill Pragnell
Subject: Re: Archway macro
Date: 17 Aug 2006 05:25:00
Message: <web.44e434dc4f0e252c731f01d10@news.povray.org>
"Mark Birch" <las### [at] hotmailcom> wrote:



perhaps I'd better check for it!


Post a reply to this message

From: Bill Pragnell
Subject: Re: Archway macro
Date: 17 Aug 2006 05:25:01
Message: <web.44e435ab4f0e252c731f01d10@news.povray.org>
"Kenneth" <kdw### [at] earthlinknet> wrote:
> That sounds disastrous! You have my sympathies.
Thanks. One of the computers was on its way out anyway, so a free upgrade is
quite welcome!

> VERY cool, and useful.  Good to see that the loss of the laptops hasn't kept
> you down! Always a pleasure to see what you're up to.
Ithankyou. It's probably not the best use of work resources, but at least
I'm not playing games...

B


Post a reply to this message

From: Bill Pragnell
Subject: Re: Archway macro
Date: 17 Aug 2006 05:50:00
Message: <web.44e43abb4f0e252c731f01d10@news.povray.org>
Right, here's the macro.

There has to be an even number of bricks in the arch, even without a
keystone. If the edge radius is zero, the macro leaves out all the edge
curved shapes to save memory, etc. Enjoy!

// curved-brick macro. creates bricks curved in x-z plane.
// rin = inner radius
// rout = outer radius
// redge = edge radius
// depf = thickness of brick perpendicular to curvature plane
// angl = angular size of brick
#macro ArcBrick(rin, rout, redge, depf, angl)
  #local h = depf/2;
  #local hin = depf/2-redge;
  #local xout = rout*sin(radians(angl/2));
  #local yin = rin*cos(radians(angl/2));
  intersection {
    union {
      difference {
        cylinder { <0, h, 0>, <0, -h, 0>, rout-redge }
        cylinder { <0, depf, 0>, <0, -depf, 0>, rin+redge } }
      difference {
        cylinder { <0, hin, 0>, <0, -hin, 0>, rout }
        cylinder { <0, depf, 0>, <0, -depf, 0>, rin } }
      #if (redge > 0)
        torus { rin+redge, redge translate <0, hin, 0> }
        torus { rin+redge, redge translate <0, -hin, 0> }
        torus { rout-redge, redge translate <0, hin, 0> }
        torus { rout-redge, redge translate <0, -hin, 0> }
      #end }
    plane { <-1, 0, 0>, -redge rotate <0, -angl/2, 0> }
    plane { <1, 0, 0>, -redge rotate <0, angl/2, 0> }
    #if (angl < 180)
      bounded_by { box { <-xout, -depf, yin>, <xout, depf, rout> } }
    #end }
  intersection {
    difference {
      cylinder { <0, hin, 0>, <0, -hin, 0>, rout-redge }
      cylinder { <0, depf, 0>, <0, -depf, 0>, rin+redge } }
    plane { <-1, 0, 0>, 0 rotate <0, -angl/2, 0> }
    plane { <1, 0, 0>, 0 rotate <0, angl/2, 0> }
    #if (angl < 180)
      bounded_by { box { <-xout, -depf, yin>, <xout, depf, rout> } }
    #end }
  #if (redge > 0)
    // corners
    sphere { <-redge, hin, rin+redge>, redge rotate <0, angl/2, 0> }
    sphere { <-redge, -hin, rin+redge>, redge rotate <0, angl/2, 0> }
    sphere { <-redge, hin, rout-redge>, redge rotate <0, angl/2, 0> }
    sphere { <-redge, -hin, rout-redge>, redge rotate <0, angl/2, 0> }
    sphere { <redge, hin, rin+redge>, redge rotate <0, -angl/2, 0> }
    sphere { <redge, -hin, rin+redge>, redge rotate <0, -angl/2, 0> }
    sphere { <redge, hin, rout-redge>, redge rotate <0, -angl/2, 0> }
    sphere { <redge, -hin, rout-redge>, redge rotate <0, -angl/2, 0> }
    // vertical edges
    cylinder { <-redge, -hin, rin+redge>, <-redge, hin, rin+redge>, redge
               rotate <0, angl/2, 0> }
    cylinder { <redge, -hin, rin+redge>, <redge, hin, rin+redge>, redge
               rotate <0, -angl/2, 0> }
    cylinder { <-redge, -hin, rout-redge>, <-redge, hin, rout-redge>, redge
               rotate <0, angl/2, 0> }
    cylinder { <redge, -hin, rout-redge>, <redge, hin, rout-redge>, redge
               rotate <0, -angl/2, 0> }
    // in-plane edges
    cylinder { <-redge, hin, rin+redge>, <-redge, hin, rout-redge>, redge
               rotate <0, angl/2, 0> }
    cylinder { <-redge, -hin, rin+redge>, <-redge, -hin, rout-redge>, redge
               rotate <0, angl/2, 0> }
    cylinder { <redge, hin, rin+redge>, <redge, hin, rout-redge>, redge
               rotate <0, -angl/2, 0> }
    cylinder { <redge, -hin, rin+redge>, <redge, -hin, rout-redge>, redge
               rotate <0, -angl/2, 0> }
  #end
#end

// archway macro. creates arches in x-y plane.
// Total_Angle = total angular size of arch
// Keystone_Angle = angular size of keystone
// nBricks = number of non-keystone bricks in arch (must be even)
// Padding = spacing between bricks as a fraction of total brick size
// rInner = inner radius
// rOuter = outer radius
// kInner = keystone inner radius
// kOuter = keystone outer radius
// Thickness = thickness of arch
// rEdge = edge radius
#macro Arch(Total_Angle, Keystone_Angle, nBricks, Padding, rInner, rOuter,
kInner, kOuter, Thickness, rEdge)
  #local Brick_Angle = (Total_Angle - Keystone_Angle)/nBricks;
  #local ang = -(Total_Angle/2 - Brick_Angle/2);
  #local n = 1;
  #while (n <= nBricks/2)
    union {
      ArcBrick(rInner, rOuter, rEdge, Thickness, (1-Padding/2)*Brick_Angle)
      rotate <-90, 0, 0> rotate <0, 0, ang> }
    #local n = n + 1;
    #local ang = ang + Brick_Angle;
  #end
  #if (Keystone_Angle > 0)
    union {
      ArcBrick(kInner, kOuter, rEdge, Thickness,
               Keystone_Angle-Brick_Angle*Padding/2)
      rotate <-90, 0, 0> }
  #end
  #local ang = Keystone_Angle/2 + Brick_Angle/2;
  #while (n <= nBricks)
    union {
      ArcBrick(rInner, rOuter, rEdge, Thickness, (1-Padding/2)*Brick_Angle)
      rotate <-90, 0, 0> rotate <0, 0, ang> }
    #local n = n + 1;
    #local ang = ang + Brick_Angle;
  #end
#end

// example arch:
union {
  Arch(240, 20, 24, 0.05, 0.75, 0.9, 0.7, 0.9, 0.3, 0.025)
  texture { Stone } }


Bill


Post a reply to this message

Goto Latest 10 Messages Next 5 Messages >>>

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