POV-Ray : Newsgroups : povray.general : fillets and rounded corners Server Time
29 Apr 2024 07:37:09 EDT (-0400)
  fillets and rounded corners (Message 15 to 24 of 24)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Le Forgeron
Subject: Re: fillets and rounded corners
Date: 6 Sep 2016 10:17:56
Message: <57ced014$1@news.povray.org>
Le 06/09/2016 à 12:33, scott a écrit :
>>
>> The intersection of two conic section primitives, will itself be a conic
>> section, so that an equation for it could be written for an extra CSG
>> component
>> in the form of a sphere sweep following that equation. All under the
>> hood of
>> course!
>
> The sphere sweep doesn't follow the intersection curve, that would give
> you a "bead" along the edge. The sphere sweep needs to be offset a
> variable amount to ensure that the contact between the sphere sweep and
> both CSG surfaces is exactly tangent along the whole length. Then the
> CSG is not trivial, you need just the bit of material between the sphere
> sweep object and the two surfaces.
>

Is sphere_sweep able to follow a circle ?

The Devil's advocate sets the following situation:
Two cylinders of identical diameter and axis in the same plane intersect 
each other with an angle of exactly 90°.

The intersection curve is a sheared circle whose minor radius is the 
radius of the cylinder and major radius is sqrt(2) time the radius of 
the cylinder.

You could sub-sample, but you cannot follow exactly a part of circle 
with a sphere_sweep (you need rational curve to do it).


Post a reply to this message

From: scott
Subject: Re: fillets and rounded corners
Date: 6 Sep 2016 11:03:05
Message: <57cedaa9@news.povray.org>
>> The sphere sweep doesn't follow the intersection curve, that would give
>> you a "bead" along the edge. The sphere sweep needs to be offset a
>> variable amount to ensure that the contact between the sphere sweep and
>> both CSG surfaces is exactly tangent along the whole length. Then the
>> CSG is not trivial, you need just the bit of material between the sphere
>> sweep object and the two surfaces.
>>
>
> Is sphere_sweep able to follow a circle ?

Indeed, I didn't think of that limitation with sphere_sweep and 
following arcs.

> The Devil's advocate sets the following situation:
> Two cylinders of identical diameter and axis in the same plane intersect
> each other with an angle of exactly 90°.
>
> The intersection curve is a sheared circle whose minor radius is the
> radius of the cylinder and major radius is sqrt(2) time the radius of
> the cylinder.

And then ... what is the mathematical definition of the surface needed 
to create this simple round between these two cylinders (highlighted red 
in the attachment).  And for extra marks, make it general for any 
diameter, any plane, any offset (green in the attachment)... Should be 
easy, right, I mean this is just two cylinders intersecting...


Post a reply to this message


Attachments:
Download 'rounds2.png' (151 KB)

Preview of image 'rounds2.png'
rounds2.png


 

From: Le Forgeron
Subject: Re: fillets and rounded corners
Date: 7 Sep 2016 09:41:03
Message: <57d018ef@news.povray.org>
I can change the texture around the fillets (for two objects only), but 
I'm afraid it would be a nightmare to make a real 3D shape for it.

(and I needed the proximity pattern of hgpovray)

It might be possible to have a pattern taking the children of a CSG to 
compute that kind of effect over a complete object :
* for each child, eval the proximity pattern --> V_i
* Find the two maximal values amongst V_i, multiply them


Post a reply to this message


Attachments:
Download 'pro.png' (115 KB) Download 'pro.pov.txt' (1 KB)

Preview of image 'pro.png'
pro.png

From: clipka
Subject: Re: fillets and rounded corners
Date: 7 Sep 2016 09:51:34
Message: <57d01b66$1@news.povray.org>
Am 07.09.2016 um 15:41 schrieb Le_Forgeron:
> I can change the texture around the fillets (for two objects only), but
> I'm afraid it would be a nightmare to make a real 3D shape for it.
> 
> (and I needed the proximity pattern of hgpovray)
> 
> It might be possible to have a pattern taking the children of a CSG to
> compute that kind of effect over a complete object :
> * for each child, eval the proximity pattern --> V_i
> * Find the two maximal values amongst V_i, multiply them

Would using the proximity pattern in an isosurface do the trick?


Post a reply to this message

From: lelama
Subject: Re: fillets and rounded corners
Date: 8 Sep 2016 12:10:01
Message: <web.57d1851dc06f3de321263ef70@news.povray.org>
scott <sco### [at] scottcom> wrote:
>
>
> You'll need much more than the "impact curve" in order to build the
> mesh. [...]
>
> Also what happens when the sharp edge / impact curve that is needed to
> create the round is not visible in the image (because it's obscured by
> another part of the shape or just pointing away from the camera)?
> Attached example.




If some part is not visible, we don't care: The proposed algorithm starts from
the 2D image.

Let me give with some details the algorithm which computes the mesh of the
rounded corner for clarity.


Let us represent the pixels on the 2D image as squares on a chess board. Let us
call segment the piece of line which is at the interface of two adjacent squares
on the board. For each square s on the board, by the hypothesis, we have the
following parametrized data: an impact point p(s) in the 3D space, an object
o(s) which contains the impact point p(s), the normal n(s) at the impact point.
(Recall that I supposed that for each pixel in the rendering,  the impact
surface and the corresponding normal was accessible).


An sharpEdge is a segment such that the two adajacent squares s1,s2 on each side
verify:
- there are on two different surfaces o(s1)!=o(s2) and the user asked to smooth
the intersection of these two surfaces
- the distance between the two corresponding points p(s1) p(s2) in the 3d space
is small enough ( small depends on the user input parameters).

2 sharpEdges are called connected if
- they are connected on the chess board, ie they have in common the corner of a
square
- the two segments have the same objects on each side

( If unclear, The last condition may be described precisely as follows
- if the two edges form a right angle, the three squares s1,s2,s3 on the
exterior of the curve have the same object o(s1)=o(s2)=o(s3)
- it the two edges are along a line, and if s1 s2 are two squares adjacent to
the edges and on the same side of the edges, then o(s1)=o(s2)

If we put a set of connected edges together, we get a connected component of
sharpEdges. This is a ray that we see on the 2D image where we want to smooth.
After a moment of thouhgt, we see that a connected component is a set of
sharpEdges which is not a general tree, but a simple branch.  For instance, in
the example you propose, there are 3 connected components of straight edges :
one component for each pair of surface.

Thus now, we have a well defined branch, with 2 sides, which I call left and
right for simplicity, and we want to produce a mesh around this branch.
There is an object o(l) on the left of the branch and an object o(r) on the
right. By construction, all the squares adjacent to the left side
parametrize ray whose impact is in o(l) and same thing for the right.


Now, we delimit the zone around the branch that we shall smooth out. We
construct a set S(l) containing squares on the left side. The squares s in S(l):
- are connected to the left side of the branch
- are  sufficiently closed to the curve: ie there is s' adjacent to the curve
with p(s)-p(s') small enough
- have impact in the required surface ie o(s)=o(l)

The boundary of S(l) is a union of segments which is closed curve: this is a
deformed circles. More
precisely, it is a union of 2 pieces: the sharp edges that we are
trying to smooth out, and a residual piece which I call the left boundary
B(l).

Similarly, there is a right boundary B(r). THe union of B(l) and B(r) is a
closed curve around the connected component that I call the total boundary B.

The boundary B is a union of segments, and it is a deformed circle. We want to
smooth the zone corresponding to the squares inside B,

If a square s is in the circonference of the deformed circle, ie if it
adjacent to some segment in B, we keep unchanged the
information p(s),n(s),o(s) we started from.

For the other squares, which are inside the circle but not on the
circumferentce, we use an algorithm to interpolate the values
p(s),n(s),o(s) (basically by averaging while keeping the circumference
unchanged)

Once we have computed the values p(s),n(s),o(s) for s in B, this is easy to
produce the mesh.

Laurent.


Post a reply to this message

From: clipka
Subject: Re: fillets and rounded corners
Date: 8 Sep 2016 12:52:51
Message: <57d19763$1@news.povray.org>
Am 08.09.2016 um 18:07 schrieb lelama:

> Let me give with some details the algorithm which computes the mesh of the
> rounded corner for clarity.

Given the unwavering enthusiasm you show for this topic, you should
probably go ahead and write a patch for POV-Ray ;)

Because, seriously, while I can't speak for the other active developers,
I know for a fact that I myself certainly won't.

I have participated in this discussion to show how complex the matter
is, in order to help you come to terms with what I believe to be the
hard truth: That your proposal will in all likelyhood not be picked up
by the official developers.

If you can demonstrate that your proposal works, can be implemented in
POV-Ray with reasonable effort, and produces reasonably good results,
then let me know, and I'll happily provide support to get it into
official POV-Ray; but until that happens, I personally am convinced that
it will not be worth spending any more time on it.

In other words: Everyone feel free to continue discussing this idea, but
count me out.


Post a reply to this message

From: Le Forgeron
Subject: Re: fillets and rounded corners
Date: 8 Sep 2016 13:32:46
Message: <57d1a0be$1@news.povray.org>
Le 08/09/2016 à 18:52, clipka a écrit :
> Am 08.09.2016 um 18:07 schrieb lelama:
> 
>> > Let me give with some details the algorithm which computes the mesh of the
>> > rounded corner for clarity.
> Given the unwavering enthusiasm you show for this topic, you should
> probably go ahead and write a patch for POV-Ray ;)

I foresee one or two problems: refraction & reflection.

The algorithm would work fine for a scanline engine, but introduce a mirror or a prism
and it will not provide the expected result.


Post a reply to this message

From: Alain
Subject: Re: fillets and rounded corners
Date: 8 Sep 2016 17:01:08
Message: <57d1d194@news.povray.org>

> scott <sco### [at] scottcom> wrote:
>>
>>
>> You'll need much more than the "impact curve" in order to build the
>> mesh. [...]
>>
>> Also what happens when the sharp edge / impact curve that is needed to
>> create the round is not visible in the image (because it's obscured by
>> another part of the shape or just pointing away from the camera)?
>> Attached example.
>
>
>
>
> If some part is not visible, we don't care: The proposed algorithm starts from
> the 2D image.

What about transparency with refraction? Or even without any refraction 
for that matter?
What about parts that are visible through reflection?
What if the non-visible part can have any notable effects on the visible 
parts?

>
> Let me give with some details the algorithm which computes the mesh of the
> rounded corner for clarity.

Tesselation is really touchy and often unreliable whan you are dealyng 
with complex shapes.
Remember that POV-Ray don't work with meshes outside the hight_field, 
mesh and mesh2 primitives.

>
>
> Let us represent the pixels on the 2D image as squares on a chess board. Let us
> call segment the piece of line which is at the interface of two adjacent squares
> on the board. For each square s on the board, by the hypothesis, we have the
> following parametrized data: an impact point p(s) in the 3D space, an object
> o(s) which contains the impact point p(s), the normal n(s) at the impact point.
> (Recall that I supposed that for each pixel in the rendering,  the impact
> surface and the corresponding normal was accessible).
>
>
> An sharpEdge is a segment such that the two adajacent squares s1,s2 on each side
> verify:
> - there are on two different surfaces o(s1)!=o(s2) and the user asked to smooth
> the intersection of these two surfaces
> - the distance between the two corresponding points p(s1) p(s2) in the 3d space
> is small enough ( small depends on the user input parameters).
>
> 2 sharpEdges are called connected if
> - they are connected on the chess board, ie they have in common the corner of a
> square
> - the two segments have the same objects on each side

In an union, the objects on each sides of an edge are effectively 
distinct and ultimately unrelated. This will cause some problems for 
your resolution.
You can't reliably tell whether any two surfaces that appear to be in 
contact in 2D are really contacting each other in 3D.

>
> ( If unclear, The last condition may be described precisely as follows
> - if the two edges form a right angle, the three squares s1,s2,s3 on the
> exterior of the curve have the same object o(s1)=o(s2)=o(s3)


between 2 3D surfaces CAN appear as a right angle depending on the 
direction from whitch it's seen.

> - it the two edges are along a line, and if s1 s2 are two squares adjacent to
> the edges and on the same side of the edges, then o(s1)=o(s2)
>
> If we put a set of connected edges together, we get a connected component of
> sharpEdges. This is a ray that we see on the 2D image where we want to smooth.
> After a moment of thouhgt, we see that a connected component is a set of
> sharpEdges which is not a general tree, but a simple branch.  For instance, in
> the example you propose, there are 3 connected components of straight edges :
> one component for each pair of surface.
>
> Thus now, we have a well defined branch, with 2 sides, which I call left and
> right for simplicity, and we want to produce a mesh around this branch.
> There is an object o(l) on the left of the branch and an object o(r) on the
> right. By construction, all the squares adjacent to the left side
> parametrize ray whose impact is in o(l) and same thing for the right.
>
>
> Now, we delimit the zone around the branch that we shall smooth out. We
> construct a set S(l) containing squares on the left side. The squares s in S(l):
> - are connected to the left side of the branch
> - are  sufficiently closed to the curve: ie there is s' adjacent to the curve
> with p(s)-p(s') small enough
> - have impact in the required surface ie o(s)=o(l)
>
> The boundary of S(l) is a union of segments which is closed curve: this is a
> deformed circles. More
> precisely, it is a union of 2 pieces: the sharp edges that we are
> trying to smooth out, and a residual piece which I call the left boundary
> B(l).
>
> Similarly, there is a right boundary B(r). THe union of B(l) and B(r) is a
> closed curve around the connected component that I call the total boundary B.
>
> The boundary B is a union of segments, and it is a deformed circle. We want to
> smooth the zone corresponding to the squares inside B,
>
> If a square s is in the circonference of the deformed circle, ie if it
> adjacent to some segment in B, we keep unchanged the
> information p(s),n(s),o(s) we started from.
>
> For the other squares, which are inside the circle but not on the
> circumferentce, we use an algorithm to interpolate the values
> p(s),n(s),o(s) (basically by averaging while keeping the circumference
> unchanged)
>
> Once we have computed the values p(s),n(s),o(s) for s in B, this is easy to
> produce the mesh.
>
> Laurent.
>
>
>
>
>
>
>
>
>
>
>


Post a reply to this message

From: John Greenwood
Subject: Re: fillets and rounded corners
Date: 13 Sep 2016 12:05:00
Message: <web.57d822aec06f3de3a7cafab50@news.povray.org>
I see now that creating rounds as cgs objects is difficult and inelegant. To
find an elegant solution one must adopt the point of view of a ray.

I have had some thoughts which I am posting on a new thread: rounded_objects: a
new object?"


Post a reply to this message

From: Alain
Subject: Re: fillets and rounded corners
Date: 13 Sep 2016 13:20:40
Message: <57d83568$1@news.povray.org>

> I see now that creating rounds as cgs objects is difficult and inelegant. To
> find an elegant solution one must adopt the point of view of a ray.
>
> I have had some thoughts which I am posting on a new thread: rounded_objects: a
> new object?"
>
>

You can find some for specific cases that already exist. There are some 
macros to make rounded cylinders, cones and boxes in shapes.inc.
There are some cases that can be made with isosurfaces, look at the 
blobbing functions.
But all those are quite limited in scope and functionality.


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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