Rounded Polygon

classic Classic list List threaded Threaded
172 messages Options
1 ... 6789
Reply | Threaded
Open this post in threaded view
|

Re: Rounded Polygon

Ronaldo
I would like to come back to our discussion of more than 1 month ago.

Em sáb, 6 de abr de 2019 às 17:01, Ronaldo Persiano <[hidden email]> escreveu:
Based on that considerations we could try to build a patch that meets the C1 condition (and perhaps the C2 condition) at the joints. However, what we really need is G1 and G2 continuity, that is a geometric differentiabilty and not a parametric one. Hard stuff!

It was clear, I suppose, that there is no C1 triangular Bezier patch (tripatch) that meets the conditions we were looking for to round the corner of a cube. And we were looking for a C2 patch joint! Meanwhile, I have studied the conditions for a G2 tripatch joint, that is, conditions that assures a geometric continuity of first and second derivatives instead of parametric continuity. In a G1 joint between two patches they must have the same tangent plane at each joint point. A similar weaker condition is demanded for G2 patch joints. Geometric conditions are in general weaker than the parametric ones.

I will not present here the development and theoretical support of the G2 tripatch I have found. This development is a bit technical so I will just show one solution for a tripatch with a G2 joint to round corners where exactly 3 edges meet. It is intended to be considered for modeling evaluation.

Fixing the 2 possible form factors, the control points of the standard 5th degree tripatch is:

Q = [   [[0,1,1]],
        [[0,1,0.68],[0,0.68,1]],
        [[0,1,0.24],[0,0.6,0.6],[0,0.24,1]],
        [[0.24,1,0],[0,0.6,0],[0,0,0.6],[0.24,0,1]],
        [[0.68,1,0],[0.6,0.6,0],[0.6,0,0],[0.6,0,0.6],[0.68,0,1]],
        [[1,1,0],[1,0.68,0],[1,0.24,0],[1,0,0.24],[1,0,0.68],[1,0,1]]
    ];

By standard, I mean it should be affine transformed to meet the corner position, edge directions and rounding extension. So, to round a given corner with coordinates P0 and edge directions d1, d2 and d3 with an extension r, the CPs of the rounded corner are computed by:

v1  = r*d1/norm(d1);
v2  = r*d2/norm(d2);
v3  = r*d3/norm(d3);
T   = [ v1, v2, v3 ];
  
CP  = [for(cpi=Q) [for(cpij=cpi) P0 + cpij*T ] ] ;

This tripatch is G2 and it meets the condition of geometric continuity of first and second derivatives. Here is an image of that tripatch meeting its mirror transform for a corner at the origin and edges along the axis.

G2corner.PNG 

In the image, the joint curve is represented in yellow.

Thanks to the standard tripatch, we could round all the corners of some polyhedra other than cubes. Here is an example of its application to a tetrahedron, a dodecahedron and a slanted dodecahedron.

G2polyhedra.PNG

In the computation of the standard control points, two form factors may be arbitrated by the caller, one of them being the form factor of the 4th degree curve which is the joint curve of the patches. The computation implies the solution of a linear system of 6 equations for each pair of form factors. The logic behind that computation is, as I said, a bit technical. I may disclose the code that does the computation if someone is interested in but be aware that, although it is fully commented, it is not easily understandable without the technical fundamentals.


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Rounded Polygon

adrianv
That is very interesting.  Here is a comparison of a cube made from a hull of
triangular patches and a cube made from a hull of (degenerate) rectangular
patches.   <http://forum.openscad.org/file/t2477/cubes.png>

It sort of looks like there's something funny going on at the boundary of
the tripatch, but I suppose it must be just a rendering artifact.  I am
printing some test cubes to see if I can tell the difference.  






--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Rounded Polygon

adrianv
Does the boundary of your tripatch have an order 4 bezier representation?  It
sounds like you constructed the match to match up with such a curve?  What
are the order 4 control points for the patch you posted?  

My FDM printed models are inconclusive because the shape of the roundovers
is not similar enough.  The case I did with spheres does seem worse, despite
the limited resolution of my layer thickness---I printed with 0.15mm layers.
I might try another test with 0.05 layers after a better effort to match the
shape of the roundovers.  But ultimately there's a problem that the limited
z resolution makes this less important.  I suppose someone with SLS or some
other higher resolution output device would notice the difference more
clearly.  




--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Rounded Polygon

adrianv
I was studying my 3d printed models some more and noticed that the highlights
on the roundover from the right direction appear to have a corner, which
raises questions about the curvature continuity.  Another observation is
that the behavior of those highlights is visually odd, as compared to the
highlights from the degenerate rectangular patch, where the highlights don't
do anything strange.  




--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Rounded Polygon

Ronaldo
In reply to this post by adrianv
Thank you for your interest in the solution I proposed.

adrianv <[hidden email]> wrote:
Does the boundary of your tripatch have an order 4 bezier representation?  It
sounds like you constructed the match to match up with such a curve?  What
are the order 4 control points for the patch you posted? 

Yes, the border of the standard 5th degree tripatch is indeed 4th degree Bezier curve like the ones we considered for 2D cases with curvature continuity. Its degree was elevated to 5 in order to have more freedom in the internal control points of the patch. The control points of the 3 border curves of the standard 5th degree tripatch are:

[[1, 1, 0], [1, 0.6, 0], [1, 0, 0], [1, 0, 0.6], [1, 0, 1]]

[[0, 1, 1], [0, 1, 0.6], [0, 1, 0], [0.6, 1, 0], [1, 1, 0]]

[[1, 0, 1], [0.6, 0, 1], [0, 0, 1], [0, 0.6, 1], [0, 1, 1]]


They correspond to 4th degree curves with a form factor of r0=0.4.
Another possible form factor appeared in the development of the tripatch. Its effect is restricted to the interior of the patch and do not affect its border. That form factor were arbitrated to be 1 in the standard 5th degree tripatch I proposed before.
My FDM printed models are inconclusive because the shape of the roundovers
is not similar enough.  The case I did with spheres does seem worse, despite
the limited resolution of my layer thickness---I printed with 0.15mm layers.
I might try another test with 0.05 layers after a better effort to match the
shape of the roundovers.  But ultimately there's a problem that the limited
z resolution makes this less important.  I suppose someone with SLS or some
other higher resolution output device would notice the difference more
clearly. 

It seems to me that to compare the standard tripatch with the degenerated rectangular one, this last one should be generated with the same form factor 0.4. Otherwise, the corner border curves (and the edge roundover) may be very different.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Rounded Polygon

Ronaldo
In reply to this post by adrianv
adrianv <[hidden email]> wrote:
I was studying my 3d printed models some more and noticed that the highlights
on the roundover from the right direction appear to have a corner, which
raises questions about the curvature continuity. 

What do you mean here by "right direction"?
 
Another observation is
that the behavior of those highlights is visually odd, as compared to the
highlights from the degenerate rectangular patch, where the highlights don't
do anything strange. 

If you give me the form factor value you are using in your degenerate rectangular roundover , I could generate a standard 5th degree tripatch that meets the same form factor. Besides the form factor itself, it would be nice to have the patch border control points to check against mine patch.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Rounded Polygon

adrianv
In reply to this post by Ronaldo
Ronaldo wrote
> It seems to me that to compare the standard tripatch with the degenerated
> rectangular one, this last one should be generated with the same form
> factor 0.4. Otherwise, the corner border curves (and the edge roundover)
> may be very different.

I agree, hence the inconclusive nature of the test.  

However, I am definitely bothered by the funky highlights.  In the pictures
the tripatch is on the left, degenerate rectangle in the middle, and
circular roundover on the right.  The highlights look odd, which in an of
itself is a negative characteristic of the printed model.  It's probably the
most noticeable characteristic of the curves.  It seems like the tripatch
has some sort of bulge compared to the other ones.  

<http://forum.openscad.org/file/t2477/hilights.jpg>
<http://forum.openscad.org/file/t2477/highlights2.jpg>



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Rounded Polygon

adrianv
In reply to this post by Ronaldo
Ronaldo wrote
> adrianv &lt;

> avm4@

> &gt; wrote:
>
>> I was studying my 3d printed models some more and noticed that the
>> highlights
>> on the roundover from the right direction appear to have a corner, which
>> raises questions about the curvature continuity.
>
>
> What do you mean here by "right direction"?

To use more precise language:  There exists a direction from which the
highlight line on the model appears to have a corner (highlight has a
discontinuity in its derivative).   This is visible in the photo I posted in
my other message.  


> If you give me the form factor value you are using in your degenerate
> rectangular roundover , I could generate a standard 5th degree tripatch
> that meets the same form factor. Besides the form factor itself, it would
> be nice to have the patch border control points to check against mine
> patch.

I generated my patch like this:

Q = cornerPatchCP([0,0,0],1.5, 0.3);

using the cornerPatchCP that you previously posted.   I was comparing this
patch to the patch you originally posted, so the length of d disagrees, I
think.  I can change the patch, but for print test a larger curve is better.  





--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Rounded Polygon

Ronaldo
adrianv <[hidden email]> wrote:
To use more precise language:  There exists a direction from which the
highlight line on the model appears to have a corner (highlight has a
discontinuity in its derivative).   This is visible in the photo I posted in
my other message.

I understand it now. In fact, the images suggest something odd in the border of the tripatch. See bellow.

I generated my patch like this:

Q = cornerPatchCP([0,0,0],1.5, 0.3);

using the cornerPatchCP that you previously posted.   I was comparing this
patch to the patch you originally posted, so the length of d disagrees, I
think.  I can change the patch, but for print test a larger curve is better. 

The standard patch has a unitary "radius". To get a bigger roundover to print, just scale it up.
The value 1.5 of the second argument in cornerPatchCP correspond to scale up the standard patch by 1.5.
To match the form factor of the border curves of  cornerPatchCP([0,0,0],1, 0.3) you may use the following standard patch CPs:

[[0, 1, 1]]

[[0, 1, 0.76], [0, 0.76, 1]]

[[0, 1, 0.28], [0, 0.7, 0.7], [0, 0.28, 1]]

[[0.28, 1, 0], [0, 0.55, 0], [0, 0, 0.55], [0.28, 0, 1]]

[[0.76, 1, 0], [0.7, 0.7, 0], [0.55, 0, 0], [0.7, 0, 0.7], [0.76, 0, 1]]

[[1, 1, 0], [1, 0.76, 0], [1, 0.28, 0], [1, 0, 0.28], [1, 0, 0.76], [1, 0, 1]] 

That patch may be somewhat bulged when compared with a sphere, for instance.

The best approximation I got of a sphere surface with a G2 tripatch has the following CPs:

[[0, 1, 0.904], [0, 0.904, 1]]

[[0, 1, 0.352], [0, 0.88, 0.88], [0, 0.352, 1]]

[[0.352, 1, 0], [0, 0.52, 0], [0, 0, 0.52], [0.352, 0, 1]]

[[0.904, 1, 0], [0.88, 0.88, 0], [0.52, 0, 0], [0.88, 0, 0.88], [0.904, 0, 1]]

[[1, 1, 0], [1, 0.904, 0], [1, 0.352, 0], [1, 0, 0.352], [1, 0, 0.904], [1, 0, 1]]


whose border curves should match the border curves of cornerPatchCP([0,0,0],1, 0.12).

The second form factor I mentioned before does not affect the patch border but controls the bulge of the patch. When we decrease its value, but keeping the border curves fixed, the patch curvature varies very fast, although continuously, near the patch border which may appear as a discontinuity. Which means that the 3rd derivative near the border is higher. Perhaps, that is the cause of the highlight behavior we observe in your images. The last patch above seems to be a reasonable compromise.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Rounded Polygon

Ronaldo
I have bad news. The patches I have stated as G2 are just G1. I have found a bug in my checkG2 function. I am sorry.


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Rounded Polygon

adrianv
Does this mean you think a G2 patch does not exist?  Or just that it requires
different constraints?  




--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Rounded Polygon

Ronaldo
It means there is no degree 5 G2 tripatch that meet the constraints. I am still working on higher degrees.

Em qua, 29 de mai de 2019 às 22:08, adrianv <[hidden email]> escreveu:
Does this mean you think a G2 patch does not exist?  Or just that it requires
different constraints? 




--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
1 ... 6789