POV-Ray : Newsgroups : povray.advanced-users : Creating Circular walls (using prisms ?) Server Time
31 Oct 2024 23:32:53 EDT (-0400)
  Creating Circular walls (using prisms ?) (Message 1 to 6 of 6)  
From: Kene
Subject: Creating Circular walls (using prisms ?)
Date: 17 Sep 2010 16:15:00
Message: <web.4c93cb55eb91d5981dec65700@news.povray.org>
I am trying to create circular walls with radius and diameter values or from
which I can obtain said values. I am trying to stay away from CSG so I am
thinking of cubic_splines in prisms. I have been studying the code from Block
Wall Macros specifically the macro Blockwall_Arc(360,"") but it has been
difficult for me. Is there anybody that can make this code clearer for me...
tried to find a way to contact Chris Bartlett (I think, who wrote the code but
he seems very scarce on the net). Any help will be greatly appreciated. I am
guessing this is OK to include the code here. Perhaps studying it here will make
it easier for somebody to explain it to me.

Basically, I want to be able to plug in radius and/or diameter values to get a
circular wall or I would like to use this method but then be able to extract
radius and/or diameter values from it. Cheers!

//  This macro creates a circular (cylindrical) wall or a segment of a circular
wall.
//
#macro Blockwall_Arc (Blockwall_ArcDegrees, Blockwall_BlockType)
  #ifndef(Blockwall_Radius) #declare Blockwall_Radius  = 1;    #end
  #declare Blockwall_Spline = spline {
    cubic_spline
    #local Blockwall_I = -0.25;
    #while (Blockwall_I<=1.25)
      Blockwall_I, vrotate(Blockwall_Radius*z,
y*Blockwall_I*Blockwall_ArcDegrees)
      #local Blockwall_I = Blockwall_I + 0.01;
    #end
  }
  object {Blockwall_FollowSpline(Blockwall_BlockType)}
#end


Post a reply to this message

From: Alain
Subject: Re: Creating Circular walls (using prisms ?)
Date: 17 Sep 2010 16:53:01
Message: <4c93d52d$1@news.povray.org>

> I am trying to create circular walls with radius and diameter values or from
> which I can obtain said values. I am trying to stay away from CSG so I am
> thinking of cubic_splines in prisms. I have been studying the code from Block
> Wall Macros specifically the macro Blockwall_Arc(360,"") but it has been
> difficult for me. Is there anybody that can make this code clearer for me...
> tried to find a way to contact Chris Bartlett (I think, who wrote the code but
> he seems very scarce on the net). Any help will be greatly appreciated. I am
> guessing this is OK to include the code here. Perhaps studying it here will make
> it easier for somebody to explain it to me.
>
> Basically, I want to be able to plug in radius and/or diameter values to get a
> circular wall or I would like to use this method but then be able to extract
> radius and/or diameter values from it. Cheers!
>
> //  This macro creates a circular (cylindrical) wall or a segment of a circular
> wall.
> //
> #macro Blockwall_Arc (Blockwall_ArcDegrees, Blockwall_BlockType)
>    #ifndef(Blockwall_Radius) #declare Blockwall_Radius  = 1;    #end
>    #declare Blockwall_Spline = spline {
>      cubic_spline
>      #local Blockwall_I = -0.25;
>      #while (Blockwall_I<=1.25)
>        Blockwall_I, vrotate(Blockwall_Radius*z,
> y*Blockwall_I*Blockwall_ArcDegrees)
>        #local Blockwall_I = Blockwall_I + 0.01;
>      #end
>    }
>    object {Blockwall_FollowSpline(Blockwall_BlockType)}
> #end
>
>
>

That macro is not self contained.
First : It create a spline that follows a circular path. For that, it 
use an externaly created variable: Blockwall_Radius.
It also use 2 passed parameters: A value in degrees and a reference 
value defining what kind of blocks to use.

Then, once the spline is constructed, it use another macro 
(Blockwall_FollowSpline) to place blocks along that spline, surely 
binded in an union so that you can place the result anywhere you need it.

What this macro _DON'T DO_: Create a prism.
It /DOES/ use CSG as an union of numerous blocks.



Alain


Post a reply to this message

From: Kene
Subject: Re: Creating Circular walls (using prisms ?)
Date: 17 Sep 2010 17:20:00
Message: <web.4c93da964a0086d41dec65700@news.povray.org>
Alain <aze### [at] qwertyorg> wrote:

>
> That macro is not self contained.
> First : It create a spline that follows a circular path. For that, it
> use an externaly created variable: Blockwall_Radius.
> It also use 2 passed parameters: A value in degrees and a reference
> value defining what kind of blocks to use.
>
> Then, once the spline is constructed, it use another macro
> (Blockwall_FollowSpline) to place blocks along that spline, surely
> binded in an union so that you can place the result anywhere you need it.
>
> What this macro _DON'T DO_: Create a prism.
> It /DOES/ use CSG as an union of numerous blocks.
>
>
>
> Alain

I suspected that. OK, is there a way to create a spline path that can be used to
draw a prism of a particular radius or diameter. I can do trial and error and
end up with an approximation but I was wondering if there is a way to get a
mathematically precise method that can generate values for any radius or
diameter.


Post a reply to this message

From: clipka
Subject: Re: Creating Circular walls (using prisms ?)
Date: 17 Sep 2010 17:37:50
Message: <4c93dfae$1@news.povray.org>
Am 17.09.2010 23:16, schrieb Kene:

> I suspected that. OK, is there a way to create a spline path that can be used to
> draw a prism of a particular radius or diameter. I can do trial and error and
> end up with an approximation but I was wondering if there is a way to get a
> mathematically precise method that can generate values for any radius or
> diameter.

There's no mathematically /exact/ way whatsoever to represent a circular 
arc with a finite sequence of cubic splines (and all splines in POV-Ray 
are effectively cubic splines or special cases thereof). Neither for the 
general case, nor for any specific case (except maybe pathological ones).


Post a reply to this message

From: Alain
Subject: Re: Creating Circular walls (using prisms ?)
Date: 17 Sep 2010 17:52:24
Message: <4c93e318$1@news.povray.org>

> Alain<aze### [at] qwertyorg>  wrote:
>
>>
>> That macro is not self contained.
>> First : It create a spline that follows a circular path. For that, it
>> use an externaly created variable: Blockwall_Radius.
>> It also use 2 passed parameters: A value in degrees and a reference
>> value defining what kind of blocks to use.
>>
>> Then, once the spline is constructed, it use another macro
>> (Blockwall_FollowSpline) to place blocks along that spline, surely
>> binded in an union so that you can place the result anywhere you need it.
>>
>> What this macro _DON'T DO_: Create a prism.
>> It /DOES/ use CSG as an union of numerous blocks.
>>
>>
>>
>> Alain
>
> I suspected that. OK, is there a way to create a spline path that can be used to
> draw a prism of a particular radius or diameter. I can do trial and error and
> end up with an approximation but I was wondering if there is a way to get a
> mathematically precise method that can generate values for any radius or
> diameter.
>
>

Quick and dirty:
- Remove the call to the other macro.
- Start your prism.
- Call the macro twice: once with the inside radius of your wall and 
travel it to create the iner part of the prism. (use a loop)
- SAVE the first point!
- Call the macro a second time with the outside radius and travel the 
spline backward to create the outside of the prism.
- Close the prism by adding the last point equal to the first one.
- Add any needed transformation and texturing.
- Finish the prism.

That's for a prism using a linear_spline interpolation.
If you want to use a cubic_spline interpolation, then the last TWO 
points must repeat the first two points. The first and last points are 
controls, the second and secont to last are real points.


Alain


Post a reply to this message

From: Kene
Subject: Re: Creating Circular walls (using prisms ?)
Date: 17 Sep 2010 19:05:00
Message: <web.4c93f3474a0086d4531cc5f00@news.povray.org>
Alain <aze### [at] qwertyorg> wrote:

> > Alain<aze### [at] qwertyorg>  wrote:

>
> Quick and dirty:
> - Remove the call to the other macro.
> - Start your prism.
> - Call the macro twice: once with the inside radius of your wall and
> travel it to create the iner part of the prism. (use a loop)
> - SAVE the first point!
> - Call the macro a second time with the outside radius and travel the
> spline backward to create the outside of the prism.
> - Close the prism by adding the last point equal to the first one.
> - Add any needed transformation and texturing.
> - Finish the prism.
>
> That's for a prism using a linear_spline interpolation.
> If you want to use a cubic_spline interpolation, then the last TWO
> points must repeat the first two points. The first and last points are
> controls, the second and secont to last are real points.
>
>
> Alain

Interesting! This is what I am looking for. Let me see if I can get it to work.
Thanks...


Post a reply to this message

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