POV-Ray : Newsgroups : povray.general : Rounded prism? Server Time
27 Nov 2024 14:40:56 EST (-0500)
  Rounded prism? (Message 1 to 9 of 9)  
From: Rune
Subject: Rounded prism?
Date: 28 Jul 2008 17:25:00
Message: <488e392c$1@news.povray.org>
Hi,

I have forgotten - is there ever anyone who have made a macro for creating 
rounded prisms? I currently need a macro to create rounded prisms, where the 
rounded prism will fit inside a normal prism with the same points. In other 
words, the rounding thickness should not be added to the prism, but rather 
some volume should be taken away at the edges to get the rounding.

I tried to do the math myself, but it turned out to be a bit tricky for me.

I have searched on google for both rounded and smooth prism, but with no 
good results as far as I can see. I just seem to remember that such a macro 
existed, but I may be mixing up things...?

Rune
-- 
http://runevision.com


Post a reply to this message

From: Zeger Knaepen
Subject: Re: Rounded prism?
Date: 28 Jul 2008 18:37:24
Message: <488e4a24@news.povray.org>
"Rune" <nor### [at] runevisioncom> wrote in message 
news:488e392c$1@news.povray.org...
> Hi,
>
> I have forgotten - is there ever anyone who have made a macro for creating 
> rounded prisms? I currently need a macro to create rounded prisms, where 
> the rounded prism will fit inside a normal prism with the same points. In 
> other words, the rounding thickness should not be added to the prism, but 
> rather some volume should be taken away at the edges to get the rounding.
>
> I tried to do the math myself, but it turned out to be a bit tricky for 
> me.
>
> I have searched on google for both rounded and smooth prism, but with no 
> good results as far as I can see. I just seem to remember that such a 
> macro existed, but I may be mixing up things...?

as part of my greeble-macros, I made a beveled linear-spline prism macro. 
Those macros should be somewhere in p.b.s-f
Syntax:
RoundPrism(Points,R,H)
with Points the array of points defining the prism, R the radius of the 
bevel, and H the height of the bevel.

It's actually not rounded, but with the macro GetBeveledPrism(Points,R) you 
should be able to create a rounded linear-spline prism.  That macro just 
returns the points (as an array) of the beveled end of a beveled prism using 
points Points and bevel-radius R.

So, for example, let say you want to make a beveled 3-sided prism, you first 
define the points:
#local Points=array[3]{UV1,UV2,UV3};
Then you ask for the beveled points:
#local BeveledPoints=GetBeveledPrism(Points,Radius);
Then you make a linear prism, going from y=Radius to y=Height-Radius, using 
the points in the array Points.
You also make another linear prism going from y=0 to y=Height, using the 
points in the array BeveledPoints.
And then you add the beveled ends, by using cylinders, going through pairs 
of points in BeveledPoints, intersected by planes defined by the original 
point, the beveled point on the original height and the beveled point on the 
beveled height.

This will give you a prism with sharp corners, but round bevels.

I you want round corners and round bevels, you'll have to use a linear prism 
going from y=0 to y=Height using the points in BeveledPoints, spheres at 
every point in BeveledPoints with y=Radius and y=Height-Radius, cylinders 
going from sphere to sphere, and some more math for the sides... shouldn't 
be too hard.

The macros should work with any non self-intersecting set of points, as far 
as I know, but might give weird results if the radius is too high.


cu!
-- 
#macro G(b,e)b+(e-b)*C/50#end#macro _(b,e,k,l)#local C=0;#while(C<50)
sphere{G(b,e)+3*z.1pigment{rgb G(k,l)}finish{ambient 1}}#local C=C+1;
#end#end _(y-x,y,x,x+y)_(y,-x-y,x+y,y)_(-x-y,-y,y,y+z)_(-y,y,y+z,x+y)
_(0x+y.5+y/2x)_(0x-y.5+y/2x)            // ZK http://www.povplace.com


Post a reply to this message

From: Leroy Whetstone
Subject: Re: Rounded prism?
Date: 28 Jul 2008 23:38:53
Message: <488EAD9B.1040608@joplin.com>
Rune wrote:
> Hi,
> 
> I have forgotten - is there ever anyone who have made a macro for creating 
> rounded prisms? I currently need a macro to create rounded prisms, where the 
> rounded prism will fit inside a normal prism with the same points. In other 
> words, the rounding thickness should not be added to the prism, but rather 
> some volume should be taken away at the edges to get the rounding.

I am like you. I forget too!
There was a discussion a while back about rounded prisms. But I don't 
remember if anything came of it. I do know that I have 6 version of 
'rounded prisms' all of which I'm not proud of.

> 
> I tried to do the math myself, but it turned out to be a bit tricky for me.
> 

The math is tricky! Especially if you try and match a prism object.
And I'm always geting flat spots on all but the simplest prisms.
It might be best if we made a mesh shape object out of the prism data.
I might give it a go...

> I have searched on google for both rounded and smooth prism, but with no 
> good results as far as I can see. I just seem to remember that such a macro 
> existed, but I may be mixing up things...?

If you find a good one LET US KNOW please.

> 
> Rune


Post a reply to this message

From: Slime
Subject: Re: Rounded prism?
Date: 29 Jul 2008 00:15:58
Message: <488e997e@news.povray.org>
> I have forgotten - is there ever anyone who have made a macro for creating 
> rounded prisms?

http://www.slimeland.com/misc/roundedprism.inc

It only works with linear spline prisms, and looking back I don't think it's 
done in the most ideal way, but it should work fine.

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

From: Blue Herring
Subject: Re: Rounded prism?
Date: 29 Jul 2008 09:10:41
Message: <488f16d1$1@news.povray.org>
Rune wrote:
> Hi,
> 
> I have forgotten - is there ever anyone who have made a macro for creating 
> rounded prisms? I currently need a macro to create rounded prisms, where the 
> rounded prism will fit inside a normal prism with the same points. In other 
> words, the rounding thickness should not be added to the prism, but rather 
> some volume should be taken away at the edges to get the rounding.
> 
> I tried to do the math myself, but it turned out to be a bit tricky for me.
> 
> I have searched on google for both rounded and smooth prism, but with no 
> good results as far as I can see. I just seem to remember that such a macro 
> existed, but I may be mixing up things...?

Hi,
I don't think its quite what you're looking for, but in case it is:  my 
PointArrays macros in the object collection can convert a linear spline 
to a bezier spline with rounded corners.  The convex corners will lie 
inside the original as you want, but the rounding of the concave corners 
will not.  Also, it is still just a prism, so the y oriented edges will 
be round but the top and bottom faces will still have sharp edges.

If you're interested check out the PA_Linear_To_Bezier and 
PA_Linear_To_Bezier_Circ (and maybe PA_Linear_To_Bezier2) macros in the 
PointArrays package.  An example image can be seen here: 
http://news.povray.org/4856d321%40news.povray.org

Hope this helps.

-- 
-The Mildly Infamous Blue Herring


Post a reply to this message

From: Christian Froeschlin
Subject: Re: Rounded prism?
Date: 29 Jul 2008 10:03:53
Message: <488f2349$1@news.povray.org>
> Also, it is still just a prism, so the y oriented edges will be
> round but the top and bottom faces will still have sharp edges.

I didn't try your point array macros, but from the other sample
image (not the one you linked to), I think it might be able to
generate the object which needs to be differenced away from
the prism to get round edges at top and bottom.

Basically, the idea would be to use the same spline defining
the prism base for sweeping a 2d corner cutting shape.


Post a reply to this message

From: Rune
Subject: Re: Rounded prism?
Date: 31 Jul 2008 18:49:48
Message: <4892418c$1@news.povray.org>
"Slime" <fak### [at] emailaddress> wrote in message 
news:488e997e@news.povray.org...
> http://www.slimeland.com/misc/roundedprism.inc
>
> It only works with linear spline prisms, and looking back I don't think 
> it's done in the most ideal way, but it should work fine.

Thanks! This works perfectly. :)

Also thanks to everybody else who offered help.

Rune
-- 
http://runevision.com


Post a reply to this message

From: Rune
Subject: Re: Rounded prism?
Date: 31 Jul 2008 19:38:30
Message: <48924cf6$1@news.povray.org>
By the way, the automatic closing of the prism works fine if you replace 
this line:

#if (pointarray[dim-1].u != pointarray[0].u & pointarray[dim-1].v != 
pointarray[0].v)

with this:

#if ((pointarray[dim-1].u != pointarray[0].u) | (pointarray[dim-1].v != 
pointarray[0].v))

Rune
-- 
http://runevision.com


Post a reply to this message

From: Blue Herring
Subject: Re: Rounded prism?
Date: 1 Aug 2008 09:00:58
Message: <4893090a$1@news.povray.org>
Christian Froeschlin wrote:
> I didn't try your point array macros, but from the other sample
> image (not the one you linked to), I think it might be able to
> generate the object which needs to be differenced away from
> the prism to get round edges at top and bottom.
> 
> Basically, the idea would be to use the same spline defining
  the prism base for sweeping a 2d corner cutting shape.

That's a good idea, I haven't tried it in a while, and never tried it in 
quite this way.  May have to look into this again...

-- 
-The Mildly Infamous Blue Herring


Post a reply to this message

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