Jon,
I attached some code with the basic math for unrolling a triangulated
surface. As expected the mapping is straightforward.
Also tested the surface separation with your object. Using n1*n2 > 0.9 works
perfectly fine.
http://forum.openscad.org/file/n19807/unroll.png
unroll.scad http://forum.openscad.org/file/n19807/unroll.scad
--
View this message in context: http://forum.openscad.org/flattening-curved-surfaces-tp19727p19807.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Nicely done, Parkinbot. To my understanding, the approach seems to be the
same as mine, only you presented in a much simpler way. While I said
earlier,
"it requires somewhat extensive user functions to calculate and copy/move
the angles and edges, which is not an easy task in OpenSCAD."
The simplicity of your code let me rethink that statement.
$ Runsun Pan, PhD $ libs: doctest , faces ( git ), offline doc ( git ), runscad.py ( 2 , git ), synwrite ( 2 ); $ tips: Collection of tips on github
--
View this message in context: http://forum.openscad.org/flattening-curved-surfaces-tp19727p19809.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Thanks!
OpenScad is well equipped to do this sort of vector and matrix calculations.
The handicap starts, whenever you want to juggle around with and manipulate
collections of structures like triags imported from an STL. You then wish to
have a (much) richer language. Caught within the functional paradigm code
gets really slow and clumsy and you are tempted to escape through the small
procedural backdoor of /C-style for/, which makes it even more unreadable
and mind blowing.
--
View this message in context: http://forum.openscad.org/flattening-curved-surfaces-tp19727p19813.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
LOL! Thanks! I just got the surfaces separated last night. Today I
flatten them. It has been entertaining. I've made lots of mistakes!
The specific application I have in mind involves accepting 3D designs
that were created using tools other than OpenSCAD, meaning that I need
to be able to work on STL files, so I'm not sure how many of the
OpenSCAD solutions that have been offered would be suitable. I suppose
one could convert an STL file into a polygon using an external script,
but doing it all in one place in one program seems best for me.
I was going to do as you did (take each triangle and rotate it and shift
it to flatten it to the existing surface) but I am now thinking I will
just create a new set of triangles on a plane directly.
:)
On 12/28/2016 10:18 PM, Parkinbot wrote:
Jon,
I attached some code with the basic math for unrolling a triangulated
surface. As expected the mapping is straightforward.
Also tested the surface separation with your object. Using n1*n2 > 0.9 works
perfectly fine.
http://forum.openscad.org/file/n19807/unroll.png
unroll.scad http://forum.openscad.org/file/n19807/unroll.scad
--
View this message in context: http://forum.openscad.org/flattening-curved-surfaces-tp19727p19807.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2016.0.7924 / Virus Database: 4739/13664 - Release Date: 12/28/16
jon_bondy wrote
I suppose one could convert an STL file into a polygon using an external
script,
Yeah. It is a trival IO-converter that picks the "normal" (optional) and
"vertex" lines and inserts some brackets and commas around and between the
numbers to get scad-Code.
A (masochistic) purist could also augment a pair of string quotes at the
beginning and the end of the STL and then try to parse the file with
OpenSCAD using an import like this:
a = include
<augmented.stl>
;
to enter the "rich" world of OpenSCAD's string manipulation. If have done
that a while ago just for fun to find out how much you can squeeze out of
OpenSCAD's string processing. The runtime was so poor (~3 minutes for a
200kB stl) that I never finished the code to also parse exponents. Anyone,
who is interested in it, can find the code attached and try to parse a
simple stl like a cube or a sphere with it.
jon_bondy wrote
but I am now thinking I will just create a new set of triangles on a plane
directly.
I wonder how you will implement the word "just" without parsing your STL
into a common-edge topology tree and unrolling this tree.
parse_stl.scad http://forum.openscad.org/file/n19816/parse_stl.scad
--
View this message in context: http://forum.openscad.org/flattening-curved-surfaces-tp19727p19816.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
My thought is to locate an edge triangle, and use recursion to go
through all of the other triangles. The first triangle will be placed
on the z=0 plane, and subsequent triangles will be placed next to the
previous triangle, just by knowing the shape of the triangle.
We will see. It's been a bumpy ride, and this may be just another bump.
Jon
On 12/29/2016 9:41 AM, Parkinbot wrote:
jon_bondy wrote
but I am now thinking I will just create a new set of triangles on a plane
directly.
I wonder how you will implement the word "just" without parsing your STL
into a common-edge topology tree and unrolling this tree.
parse_stl.scad http://forum.openscad.org/file/n19816/parse_stl.scad
What happens if you have a curve in more than one dimension that can't be
flattened without tares in it?
On 29 December 2016 at 15:12, jon jon@jonbondy.com wrote:
My thought is to locate an edge triangle, and use recursion to go through
all of the other triangles. The first triangle will be placed on the z=0
plane, and subsequent triangles will be placed next to the previous
triangle, just by knowing the shape of the triangle.
We will see. It's been a bumpy ride, and this may be just another bump.
Jon
On 12/29/2016 9:41 AM, Parkinbot wrote:
jon_bondy wrote
but I am now thinking I will just create a new set of triangles on a
plane
directly.
I wonder how you will implement the word "just" without parsing your STL
into a common-edge topology tree and unrolling this tree.
parse_stl.scad http://forum.openscad.org/file/n19816/parse_stl.scad
I imagine that you are correct. It happens that the particular
application I am working with assumes that each surface is a portion of
a cylinder, so it only curves in one direction.
On 12/29/2016 10:19 AM, nop head wrote:
What happens if you have a curve in more than one dimension that can't
be flattened without tares in it?
On 29 December 2016 at 15:12, jon <jon@jonbondy.com
mailto:jon@jonbondy.com> wrote:
My thought is to locate an edge triangle, and use recursion to go
through all of the other triangles. The first triangle will be
placed on the z=0 plane, and subsequent triangles will be placed
next to the previous triangle, just by knowing the shape of the
triangle.
We will see. It's been a bumpy ride, and this may be just another
bump.
Jon
On 12/29/2016 9:41 AM, Parkinbot wrote:
jon_bondy wrote
but I am now thinking I will just create a new set of
triangles on a plane
directly.
I wonder how you will implement the word "just" without
parsing your STL
into a common-edge topology tree and unrolling this tree.
parse_stl.scad
<http://forum.openscad.org/file/n19816/parse_stl.scad
<http://forum.openscad.org/file/n19816/parse_stl.scad>>
_______________________________________________
OpenSCAD mailing list
Discuss@lists.openscad.org <mailto:Discuss@lists.openscad.org>
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
<http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org>
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
No virus found in this message.
Checked by AVG - www.avg.com http://www.avg.com
Version: 2016.0.7924 / Virus Database: 4739/13667 - Release Date: 12/29/16
jon_bondy wrote
My thought is to locate an edge triangle, and use recursion to go
through all of the other triangles. The first triangle will be placed
on the z=0 plane, and subsequent triangles will be placed next to the
previous triangle, just by knowing the shape of the triangle.
that is a correct approach. But it needs to build a common edge tree (= no
circular pathes allowed) first, which you then can traverse recursively.
--
View this message in context: http://forum.openscad.org/flattening-curved-surfaces-tp19727p19821.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
I think I know how to do that! Time will tell!
On 12/29/2016 12:01 PM, Parkinbot wrote:
jon_bondy wrote
My thought is to locate an edge triangle, and use recursion to go
through all of the other triangles. The first triangle will be placed
on the z=0 plane, and subsequent triangles will be placed next to the
previous triangle, just by knowing the shape of the triangle.
that is a correct approach. But it needs to build a common edge tree (= no
circular pathes allowed) first, which you then can traverse recursively.
--
View this message in context: http://forum.openscad.org/flattening-curved-surfaces-tp19727p19821.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2016.0.7924 / Virus Database: 4739/13667 - Release Date: 12/29/16