[OpenSCAD] Rounded Polygon
Ronaldo Persiano
rcmpersiano at gmail.com
Sun May 19 18:48:57 EDT 2019
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 <rcmpersiano at gmail.com>
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.
[image: 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.
[image: 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20190519/fb1534da/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: G2corner.PNG
Type: image/png
Size: 61305 bytes
Desc: not available
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20190519/fb1534da/attachment.PNG>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: G2polyhedra.PNG
Type: image/png
Size: 19340 bytes
Desc: not available
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20190519/fb1534da/attachment-0001.PNG>
More information about the Discuss
mailing list