POV-Ray : Newsgroups : povray.binaries.images : Four-Centered Arch Server Time
22 Dec 2024 07:52:09 EST (-0500)
  Four-Centered Arch (Message 1 to 10 of 11)  
Goto Latest 10 Messages Next 1 Messages >>>
From: Samuel B 
Subject: Four-Centered Arch
Date: 23 Jul 2023 21:20:00
Message: <web.64bdd18d508f1507f8c47d526e741498@news.povray.org>
Hi,

A four-centered arch. Macro coming up shortly.

Sam


Post a reply to this message


Attachments:
Download '4-centeredarchc.jpg' (19 KB)

Preview of image '4-centeredarchc.jpg'
4-centeredarchc.jpg


 

From: Samuel B 
Subject: Re: Four-Centered Arch
Date: 23 Jul 2023 21:30:00
Message: <web.64bdd37db7f509a4f8c47d526e741498@news.povray.org>
"Samuel B." <stb### [at] hotmailcom> wrote:
> [...] Macro coming up shortly.

Here it is. The outer and inner arches are defined separately by width, height
and corner radius (smallest circle). Everything else applies to the entire
object.

#macro FourCenteredArch
 (
  AW1, // arch width 1 (from center)
  AH1, // arch height 1 (from ground)
  CR1, // radius 1 (outer corner, >=0 & <=AW1)

  AW2, // arch width 2 (from center)
  AH2, // arch height 2 (from ground)
  CR2, // radius 2 (inner corner, >=0 & <=AW2)

  AD, // arch depth (to -z)
  BV, // edge bevel radius
 )

 // a small value
 #local Eps = .0001;

 // intersection of a vertical line and circle, produces a y value (circle
radius, line x-position)
 #macro CircleLineIntercept(CirR, LinX)
  #local V = pow(CirR, 2) - pow(LinX, 2);
  #if(V>=0)
   (sqrt(V))
  #else
   (0)
  #end
 #end

 // calculate and return various values for shape and bevel macros
 #macro GetValues(AW, AH, CR, IO) // IO = is outside inside shape
  #declare CR = max(CR, BV*IO+Eps); // prevent circle radius from being negative
  #if(CR>=AW) #declare CR = AW-Eps; #end // prevent degenerate plane normal
  #declare CV  = <AW-CR, AH, 0>; // small circle position
  #declare CRT = 2 * CV.x; // get a temporarory circle radius based on distance
between initial circle centers
  #declare CY = (CircleLineIntercept(CRT, CV.x)); // get intercept of line and
1st circle
  #declare CV2 = CV - 2 * <CV.x, CY, 0>; // large  circle's position (will be
used directly for geometry)
  #declare CRL = 2 * CRT + CR; // large (second) circle's radius
  #declare CY2 = (CircleLineIntercept(CRL, CV2.x)); // value needed for shifting
geometry down (get y intercept of line and 2nd circle)
  #declare CO = (CV2.y+CY2-AH); // offset amount to shift geometry downward, to
fit inside box and top margin
  #declare CV = <CV.x, CV.y-CO, 0>; // offset CV
  #declare CV2 = <CV2.x, CV2.y-CO, 0>; // offset CV2
  #declare Dir = vnormalize(CV - CV2); // angle between 1st and 2nd circle
centers, used for various things
  #declare DirP = <Dir.y, -Dir.x, 0>; // perpendicular to Dir
  #declare ISP = <CV2.x-(CV2.y-CV.y)*Dir.x/Dir.y, CV.y, 0>; // find an
intersection to be used to prevent future CSG issues
  #declare PlaneDirP = plane{<CV2.y-CV.y, -CV2.x+CV.x, 0>, 0 translate CV}
 #end

 // basic shape
 #macro MakeShape(AW, AH, CR, AD, IC, IO)
  GetValues(AW, AH, CR, IO)
  #local IC = Eps * IC; // is a cutting object, so make an offset
  union{
   // solid portion under curve
   box{<-IC, -IC, 0-IC>, <AW, CV.y+Eps, AD+IC>}

   #macro Curve()
    union{
     difference{
      cylinder{
       z*(-IC), z*(AD+IC), CR
       translate CV
      }
      plane{y, CV.y-Eps}
      object{PlaneDirP inverse}
     }
     difference{
      cylinder{
       z*(-IC), z*(AD+IC), CRL
       translate CV2
      }
      plane{x, -IC}
      object{PlaneDirP translate -y*IC}
     }
    }
   #end

   object{Curve()}

   translate -z*AD
  }
 #end

 // bevels for curved portion
 #macro MakeBevel(AW, AH, CR, IO)
  GetValues(AW, AH, CR, IO)
  union{
   difference{
    torus{
     CR, BV
     rotate x*90
     translate CV+z*(BV-AD)
    }
    plane{y, CV.y}
    object{PlaneDirP inverse}
   }
   difference{
    torus{
     CRL, BV
     rotate x*90
     translate CV2+z*(BV-AD)
    }
    plane{x, 0}
    object{PlaneDirP}
   }
  }
 #end

 // final object
 union{
  #local ArchHalf =
   union{
    // shape offset +z by bevel value
    difference{
     MakeShape(AW1, AH1, CR1, AD-BV, false, true)
     MakeShape(AW2, AH2, CR2, AD-BV, true, false)
    }
    // shape inset by bevel value
    #if(BV>0)
     difference{
      MakeShape(AW1-BV, AH1-BV, CR1-BV, AD, false, true)
      MakeShape(AW2+BV, AH2+BV, CR2+BV, AD, true, false)
     }
     // bevels
     union{
      object{MakeBevel(AW1-BV, AH1-BV, CR1-BV, true)}
      cylinder{<AW1-BV, 0, -AD+BV>, <AW1-BV, CV.y, -AD+BV>, BV}
      object{MakeBevel(AW2+BV, AH2+BV, CR2+BV, false)}
      cylinder{<AW2+BV, 0, -AD+BV>, <AW2+BV, CV.y, -AD+BV>, BV}
     }
    #end
   }
  object{ArchHalf}
  object{ArchHalf scale <-1, 1, 1>}
 }

#end

Here's how to call the macro:

object{
 FourCenteredArch(
  1.0, // arch width 1 (from center)
  2.0, // arch height 1 (from ground)
  0.5, // radius 1 (outer corner, >=0 & <=arch width 1)

  0.6, // arch width 2 (from center)
  1.4, // arch height 2 (from ground)
  0.2, // radius 2 (inner corner, >=0 & <=arch width 2)

  0.3, // arch depth (to -z)
  0.03 // edge bevel radius (>arch depth)
 )
}


Post a reply to this message

From: Mike Miller
Subject: Re: Four-Centered Arch
Date: 23 Jul 2023 21:35:00
Message: <web.64bdd42eb7f509a4b5177e91dabc9342@news.povray.org>
"Samuel B." <stb### [at] hotmailcom> wrote:
> Hi,
>
> A four-centered arch. Macro coming up shortly.
>
> Sam

Nice job!


Post a reply to this message

From: Samuel B 
Subject: Re: Four-Centered Arch
Date: 23 Jul 2023 21:35:00
Message: <web.64bdd46ab7f509a4f8c47d526e741498@news.povray.org>
"Samuel B." <stb### [at] hotmailcom> wrote:
> A four-centered arch.

Here's a helper macro to make arches with inset surfaces. You can specify both
inset amount and inset depth.

#macro FourCenteredArch_Inset(AW1, AH1, CR1,  AW2, AH2, CR2,  AD, BV, IN, ID)
 #local Eps = .0001;
 union{
  FourCenteredArch(AW1, AH1, CR1,  AW2, AH2, CR2,  AD-ID, BV)
  object{
   #local DP =  max(BV+Eps, ID);
   FourCenteredArch(AW1-IN, AH1-IN, CR1-IN,  AW2+IN, AH2+IN, CR2+IN, DP, BV)
   translate - z*(AD-DP)
  }
 }
#end

And its usage:

object{
    FourCenteredArch_Inset(
     1.0, // arch width 1 (from center)
     2.0, // arch height 1 (from ground)
     0.3, // radius 1 (outer corner, >=0 & <=arch width 1)

     0.6, // arch width 2 (from center)
     1.35, // arch height 2 (from ground)
     0.1, // radius 2 (inner corner, >=0 & <=arch width 2)

     0.3, // arch depth (to -z)
     0.013, // edge bevel radius (>arch depth)

     0.05 // inset amount
     0.025 // inset depth
    )
   }


Post a reply to this message


Attachments:
Download '4-centeredarchc-inset.jpg' (23 KB)

Preview of image '4-centeredarchc-inset.jpg'
4-centeredarchc-inset.jpg


 

From: Samuel B 
Subject: Re: Four-Centered Arch
Date: 23 Jul 2023 21:55:00
Message: <web.64bdd91cb7f509a4f8c47d526e741498@news.povray.org>
"Mike Miller" <mil### [at] gmailcom> wrote:
> "Samuel B." <stb### [at] hotmailcom> wrote:
> > Hi,
> >
> > A four-centered arch. Macro coming up shortly.
> >
> > Sam
>
> Nice job!

Thank you, Mike~


Post a reply to this message

From: Thomas de Groot
Subject: Re: Four-Centered Arch
Date: 24 Jul 2023 02:15:23
Message: <64be16fb$1@news.povray.org>
Op 24/07/2023 om 03:19 schreef Samuel B.:
> Hi,
> 
> A four-centered arch. Macro coming up shortly.
> 
> Sam

That is an excellent piece of work, Sam. Thanks for the two macros. RL 
is draining me at the moment so I shall not get round to them 
immediately, but they are on my ToDo list next to the cathedral window 
generator.

-- 
Thomas


Post a reply to this message

From: And
Subject: Re: Four-Centered Arch
Date: 24 Jul 2023 06:50:00
Message: <web.64be574fb7f509a42eea71a2aa81652d@news.povray.org>
"Samuel B." <stb### [at] hotmailcom> wrote:
> "Samuel B." <stb### [at] hotmailcom> wrote:
> > A four-centered arch.
>
> Here's a helper macro to make arches with inset surfaces. You can specify both
> inset amount and inset depth.
>
> #macro FourCenteredArch_Inset(AW1, AH1, CR1,  AW2, AH2, CR2,  AD, BV, IN, ID)
>  #local Eps = .0001;
>  union{
>   FourCenteredArch(AW1, AH1, CR1,  AW2, AH2, CR2,  AD-ID, BV)
>   object{
>    #local DP =  max(BV+Eps, ID);
>    FourCenteredArch(AW1-IN, AH1-IN, CR1-IN,  AW2+IN, AH2+IN, CR2+IN, DP, BV)
>    translate - z*(AD-DP)
>   }
>  }
> #end
>
> And its usage:
>
> object{
>     FourCenteredArch_Inset(
>      1.0, // arch width 1 (from center)
>      2.0, // arch height 1 (from ground)
>      0.3, // radius 1 (outer corner, >=0 & <=arch width 1)
>
>      0.6, // arch width 2 (from center)
>      1.35, // arch height 2 (from ground)
>      0.1, // radius 2 (inner corner, >=0 & <=arch width 2)
>
>      0.3, // arch depth (to -z)
>      0.013, // edge bevel radius (>arch depth)
>
>      0.05 // inset amount
>      0.025 // inset depth
>     )
>    }



Looks beautiful.


Post a reply to this message

From: Samuel B 
Subject: Re: Four-Centered Arch
Date: 24 Jul 2023 19:05:00
Message: <web.64bf034eb7f509a4f8c47d526e741498@news.povray.org>
Thomas de Groot <tho### [at] degrootorg> wrote:
> Op 24/07/2023 om 03:19 schreef Samuel B.:
> > Hi,
> >
> > A four-centered arch. Macro coming up shortly.
>
> That is an excellent piece of work, Sam. Thanks for the two macros. RL
> is draining me at the moment so I shall not get round to them
> immediately, but they are on my ToDo list next to the cathedral window
> generator.
>
> --
> Thomas

Thank you, Thomas. I mainly made it for fun, and to keep my mind busy; I don't
expect anyone to use it, since everyone's got their own favorite projects going
;P

I hope things become less exhausting for you in the near future~

Sam


Post a reply to this message

From: Samuel B 
Subject: Re: Four-Centered Arch
Date: 24 Jul 2023 19:05:00
Message: <web.64bf0361b7f509a4f8c47d526e741498@news.povray.org>
"And" <49341109@ntnu.edu.tw> wrote:
> "Samuel B." <stb### [at] hotmailcom> wrote:
> > "Samuel B." <stb### [at] hotmailcom> wrote:
> > > A four-centered arch.>
>
> Looks beautiful.

Thanks, And.


Post a reply to this message

From: Thomas de Groot
Subject: Re: Four-Centered Arch
Date: 25 Jul 2023 10:38:38
Message: <64bfde6e$1@news.povray.org>
Op 25-7-2023 om 01:03 schreef Samuel B.:
> Thank you, Thomas. I mainly made it for fun, and to keep my mind busy; I don't
> expect anyone to use it, since everyone's got their own favorite projects going
> ;P
> 
I know what you mean. I think I can come up with some project using your 
work here. I did for instance with your 'strands' macros. Not good 
enough to show here (yet) I am afraid...

> I hope things become less exhausting for you in the near future~
> 
Thanks indeed, Sam.

-- 
Thomas


Post a reply to this message

Goto Latest 10 Messages Next 1 Messages >>>

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