POV-Ray : Newsgroups : povray.binaries.images : Rounded block section, isosurface equivalent Server Time
28 Mar 2024 16:10:58 EDT (-0400)
  Rounded block section, isosurface equivalent (Message 1 to 5 of 5)  
From: StephenS
Subject: Rounded block section, isosurface equivalent
Date: 5 Sep 2016 15:06:20
Message: <57cdc22c@news.povray.org>
I have macros for rounded_box, rounded_cylinder, and 
rounded_cylinder_section, for both CSG and isosurface.

I need help with the rounded_cylinder_section, isosurface.
I only need from >0 to 180 degrees sections
(I know this has no rounding yet)
How do I make my second cut at an angle?  Hints?

isosurface{
  function {
   max(
    sqrt(pow(x,2)+pow(z,2))-Radius+Block_gap,
    abs(y-Height/2)-Height/2+Block_gap,  // cylinder height
    abs(z-Radius/2)-Radius/2+Block_gap,  // my reference edge
    abs(x-Radius/2)-Radius/2+Block_gap   // wrong except for 90 degrees
    )
   +Block_surface_iso_noise(x,y,z)
  }
  contained_by { box { <-Radius,0,-Radius>, <Radius,Height,Radius> } }
}


The bottom right of the second image wants to be 120 degrees each.

Stephen S


Post a reply to this message


Attachments:
Download 'stone_blocks_csg.png' (733 KB) Download 'stone_blocks_isosurface.png' (776 KB)

Preview of image 'stone_blocks_csg.png'
stone_blocks_csg.png

Preview of image 'stone_blocks_isosurface.png'
stone_blocks_isosurface.png


 

From: Le Forgeron
Subject: Re: Rounded block section, isosurface equivalent
Date: 5 Sep 2016 16:09:04
Message: <57cdd0e0$1@news.povray.org>
Help yourself,

Le 05/09/2016 à 21:04, StephenS a écrit :
> abs(x-Radius/2)-Radius/2+Block_gap   // wrong except for 90 degrees
>    )

What is abs(x-Radius/2)-Radius/2+Block_gap, but the projection of the coordinate on
the normal of the plane, for a very particular case,

Actually, abs is slicing twice, so
abs(x-Radius/2)-Radius/2+Block_gap can be replaced by -x+Block_gap for the same effect
of cutting along a plane.

now, replace the -x by the computation of the distance along the normal at 120° and
you are nearly done.


isosurface{
 function {
  max(
   sqrt(pow(x,2)+pow(z,2))-Radius+Block_gap,
   abs(y-Height/2)-Height/2+Block_gap,  // cylinder height
   abs(z-Radius/2)-Radius/2+Block_gap,  // my reference edge
   -x*sin(radians(120))+z*cos(radians(120))+Block_gap
   )
 }
 contained_by { box { <-Radius,0,-Radius>, <Radius,Height,Radius> } }
 texture { pigment { color rgb 1 } }
}


Have a good night.


Post a reply to this message

From: StephenS
Subject: Re: Rounded block section, isosurface equivalent
Date: 5 Sep 2016 16:26:09
Message: <57cdd4e1$1@news.povray.org>
On 05/09/2016 4:09 PM, Le_Forgeron wrote:
> Help yourself,
>
> Le 05/09/2016 à 21:04, StephenS a écrit :
>> abs(x-Radius/2)-Radius/2+Block_gap   // wrong except for 90 degrees
>>    )
>
> What is abs(x-Radius/2)-Radius/2+Block_gap, but the projection of the coordinate on
the normal of the plane, for a very particular case,
>
> Actually, abs is slicing twice, so
> abs(x-Radius/2)-Radius/2+Block_gap can be replaced by -x+Block_gap for the same
effect of cutting along a plane.
I may have seen this if I started from scratch, but I started from my 
box code.
>
> now, replace the -x by the computation of the distance along the normal at 120° and
you are nearly done.
>
>
> isosurface{
>  function {
>   max(
>    sqrt(pow(x,2)+pow(z,2))-Radius+Block_gap,
>    abs(y-Height/2)-Height/2+Block_gap,  // cylinder height
>    abs(z-Radius/2)-Radius/2+Block_gap,  // my reference edge
>    -x*sin(radians(120))+z*cos(radians(120))+Block_gap
I saw this from the isosurface tutorial, but was not sure how to fit, 
abs(x-Radius/2)-Radius/2+Block_gap, to it.
>    )
>  }
>  contained_by { box { <-Radius,0,-Radius>, <Radius,Height,Radius> } }
>  texture { pigment { color rgb 1 } }
> }
>
>
> Have a good night.
>
Not yet, still time for one more render ;-)

Thanks.

Stephen S


Post a reply to this message

From: Le Forgeron
Subject: Re: Rounded block section, isosurface equivalent
Date: 6 Sep 2016 04:28:14
Message: <57ce7e1e$1@news.povray.org>
Le 05/09/2016 à 22:24, StephenS a écrit :
> I saw this from the isosurface tutorial, but was not sure how to fit,
> abs(x-Radius/2)-Radius/2+Block_gap, to it.

The problem is that abs(...) is from a BOX code, with two parallel 
planes. You only need one plane for your rounded block, because the 
other "side" is circular and done with the sqrt() part.

abs(x - Foo) - Foo : it is for a box with x from 0 to 2*Foo.

Just solve the equation for 0 (all the isosurface is in the negative 
domain of the function):
For x = 0, the value is 0.
For x = Foo, the value is -Foo, so inside
For x = 2Foo, the value is 0.

But you do not need the wall at 2Foo. so forget abs().


Post a reply to this message

From: StephenS
Subject: Re: Rounded block section, isosurface equivalent
Date: 6 Sep 2016 21:56:41
Message: <57cf73d9@news.povray.org>
On 05/09/2016 3:04 PM, StephenS wrote:
> I have macros for rounded_box, rounded_cylinder, and
> rounded_cylinder_section, for both CSG and isosurface.

And now rounded_cylinder_arc_section.
Except there's no rounding. Large radius, small radius, flat surface is 
more math than I can remember.

I might only need the large/small radius to match. I should be able to 
figure that out.

This is for CSG.

Stephen S


Post a reply to this message


Attachments:
Download 'stone_blocks_0000.png' (160 KB)

Preview of image 'stone_blocks_0000.png'
stone_blocks_0000.png


 

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