While playing with springs I found that the way I split quads into two
triangles has a big effect on the appearance.
Here I split them the one way and it looks wrong shading wise.
[image: image.png]
Here I split them on the other diagonal and it looks much smoother.
[image: image.png]
Here I present them to polyhedron as quads and let F5 triangulate them.
[image: image.png]
It seems to be random, so not optimum.
If I reverse the handedness of the spiral then the other diagonal is the
correct one. Does anybody know the correct algorithm? The length of the two
diagonals is the same so that can't be used to choose between them.
I am thinking that one way makes a convex surface patch and the other way
concave. I think that if the surface is convex in the area of the patch
then the diagonal should be chosen to give a convex patch and vice versa.
Does that make sense?
Not sure how I would code that efficiently. Is there a better way than
calculating the normals of the triangles to determine if the patch is
concave or convex. And is there an easy way to determine if the surface is
locally concave or convex? In this case it is always convex so I could
cheat and always assume that. It would be right most of the time as a swept
surface must always be partially convex.
If this is a thing why doesn't OpenSCAD's built in triangulation do it?
Things like linear_extrude with twist seem to get this wrong. Twisting a
circle in the negative direction looks better than in the positive
direction.
[image: image.png]
Looking at subdivision surface stuff makes me think you could try taking the
average of all the neighbor points and then picking the diagonal that's
furthest from it.
--
Sent from: http://forum.openscad.org/
nophead,
There is many aspects in your observations and questions. First, there are
points where you can't classify (with respect to its interior) the surface
of a solid as convex or concave. For instance, the points in your spring
that are nearest to the axis: they have a positive curvature in one
direction and negative in other.
Besides, there is a torsion effect that makes things worst. Your cylinder
is an example: if all circular level cuts were translations, the quads
would be planar. In particular, the sweep of the list comprehension demos
produces a twist between sections along a helicoidal path and the quads are
non planar. This could be avoided by untwisting it. I have a version of
sweep.scad which do that.
When a quad is non planar it induces a saddle surface that is neither
convex or concave. If the diagonals have different length to choose the
smallest one may a good measure for convex surfaces. Otherwise, none of the
two diagonals is best.
Yes the non-planar quads are not concave or convex in isolation but when
you add the diagonal the two triangle are. When they form a concave dimple
the shading alternates between light and dark and makes it visible that
they are dimples in a surface that should be all convex. When split the
correct way the shading changes monotonically, so it looks smoothly convex.
Not only is the shading no longer alternating but it also has smaller
changes between adjacent triangles, so you can get away with less of them.
Since the quads in a sweep are not in arbitrary places, they are arranged
in rings, I think it is probably sufficient to work out which way the quad
is twisting to pick the correct diagonal.
How do you get rid of the twist?
On Thu, 24 Jan 2019 at 00:01, Ronaldo Persiano rcmpersiano@gmail.com
wrote:
nophead,
There is many aspects in your observations and questions. First, there are
points where you can't classify (with respect to its interior) the surface
of a solid as convex or concave. For instance, the points in your spring
that are nearest to the axis: they have a positive curvature in one
direction and negative in other.
Besides, there is a torsion effect that makes things worst. Your cylinder
is an example: if all circular level cuts were translations, the quads
would be planar. In particular, the sweep of the list comprehension demos
produces a twist between sections along a helicoidal path and the quads are
non planar. This could be avoided by untwisting it. I have a version of
sweep.scad which do that.
When a quad is non planar it induces a saddle surface that is neither
convex or concave. If the diagonals have different length to choose the
smallest one may a good measure for convex surfaces. Otherwise, none of the
two diagonals is best.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Are you sure, you have squares? You seem to twist the extrusion. Then your
rects are crooked and it is natural that the shorter diagonal is better.
This is how a spring from my springs and springmaker library
https://www.thingiverse.com/thing:3252637 looks:
http://forum.openscad.org/file/t887/springquad.png
--
Sent from: http://forum.openscad.org/
Yes the minimum rotation algorithm seems to create the twist, not sure why.
I wonder if a real spring is twisted.
Frenet-Serret isn't twisted but it gets weird at the discontinuities in
curvature near the ends.
[image: image.png]
I made a mistake earlier when I said the diagonals were equal. I was
subtracting the indices instead of the coordinates. Fixing that and picking
the shortest diagonal works for clockwise and anti-clockwise springs.
Thanks for pointing that out.
Why doesn't linear_extrude pick the shortest diagonal if that is the
solution?
On Thu, 24 Jan 2019 at 11:20, Parkinbot rudolf@digitaldocument.de wrote:
Are you sure, you have squares? You seem to twist the extrusion. Then your
rects are crooked and it is natural that the shorter diagonal is better.
This is how a spring from my springs and springmaker library
https://www.thingiverse.com/thing:3252637 looks:
http://forum.openscad.org/file/t887/springquad.png
--
Sent from: http://forum.openscad.org/
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
nophead wrote
Why doesn't linear_extrude pick the shortest diagonal if that is the
solution?
Good question. You are right!
linear_extrude(50, twist = 360, slices=20)
translate([5,0]) square(10);
I have not observed it because it was never very important to me. To be
honest I don't know, whether linear_extrude() is implemented to produce
triags or quads. But you are right, the result would be way better if it
used always the shorter diagonal. Looks like an adversity that can easily be
fixed.
--
Sent from: http://forum.openscad.org/
nop head nop.head@gmail.com wrote:
How do you get rid of the twist?
Just calculate the total section angular rotation about its "center" and
distribute this total angle along the path. It is an aproximation because
the twist rate may vary along the path but it works very fine with
helicoidal paths. You can accesses my version in:
https://github.com/RonaldoCMP/list-comprehension-demos/blob/master/sweep.scad
https://github.com/RonaldoCMP/list-comprehension-demos/blob/master/sweep.scad
The untwist is done by construct_transform_path().
... I wonder if a real spring is twisted.
Coil springs mostly act in torsion - they twist and the spring expands and
contracts. They're usually made by wrapping wire or rod around a mandrel, so
they're not that twisted at rest.
... Why doesn't linear_extrude pick the shortest diagonal if that is the
solution? ...
Are you sure it's "the solution?" Maybe it always works right for rotate
extrude, but I'm pretty certain that "longer diagonal" does not work as a
general answer.
--
Sent from: http://forum.openscad.org/
No its the shorter diagonal, not the longer. I am pretty sure it isn't a
general solution for any quad patch on a 3D surface. It might be for a
sweep where the quads are always in rings, but I don't know. Seems to work
with helical springs.
The spring machines I have seen feed wire though a nozzle against an anvil
that forces it to turn into a helix . The anvil moves allowing it to vary
the pitch and diameter continuously if necessary. Then it cuts it off and
starts a new one.
On Thu, 24 Jan 2019 at 17:47, NateTG nate-openscadforum@pedantic.org
wrote:
... I wonder if a real spring is twisted.
Coil springs mostly act in torsion - they twist and the spring expands and
contracts. They're usually made by wrapping wire or rod around a mandrel,
so
they're not that twisted at rest.
... Why doesn't linear_extrude pick the shortest diagonal if that is the
solution? ...
Are you sure it's "the solution?" Maybe it always works right for rotate
extrude, but I'm pretty certain that "longer diagonal" does not work as a
general answer.
--
Sent from: http://forum.openscad.org/
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org