@nophead: brilliant solution.
$ Runsun Pan, PhD $ libs: doctest , faces ( git ), offline doc ( git ), runscad.py ( 2 , git ), synwrite ( 2 ); $ tips: Bezier , hash ( 2 ), matrix ( 2 , 3 ), sweep ( 2 , 3 ), var ( 2 ), lerp , animation ( gif , prodVid , animlib ), precision ( 2 ), xl-control , type , rounded polygon , chfont , tailRecur ( 2 , 3 , 4 ), isosphere ( 2 ), area , vol/center , RGB , CurvedImg , tests ( 2 ), text , triang , unit ; $ Apps: rollApp , blockscad , openjscad , on AWS ( pdf ), support_tools
--
View this message in context: http://forum.openscad.org/flattening-curved-surfaces-tp19727p19780.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Thanks.
The union with nothing is of course redundant (part of some debug code I
forgot to remove) and intersection(c) should be just intersection().
On 27 December 2016 at 17:31, runsun runsun@gmail.com wrote:
@nophead: brilliant solution.
$ Runsun Pan, PhD $ libs: doctest , faces ( git ), offline doc ( git ),
runscad.py ( 2 , git ), synwrite ( 2 ); $ tips: Bezier , hash ( 2 ),
matrix ( 2 , 3 ), sweep ( 2 , 3 ), var ( 2 ), lerp , animation ( gif ,
prodVid , animlib ), precision ( 2 ), xl-control , type , rounded polygon ,
chfont , tailRecur ( 2 , 3 , 4 ), isosphere ( 2 ), area , vol/center , RGB
, CurvedImg , tests ( 2 ), text , triang , unit ; $ Apps: rollApp ,
blockscad , openjscad , on AWS ( pdf ), support_tools
--
View this message in context: http://forum.openscad.org/
flattening-curved-surfaces-tp19727p19780.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
Here is my polyhedron solution.
http://forum.openscad.org/file/n19782/161227_runsun_flatten_surface.png
In progress:
http://forum.openscad.org/file/n19782/161227_runsun_flatten_surface_2.png
http://forum.openscad.org/file/n19782/161227_runsun_flatten_surface_3.png
Conceptually it's easy to understand, and no need to worry about the
triangulation/edge-finding, etc. But:
a) As pointed out by Parkinbot on nophead's approach, this approach bears
the same condition that the shape needs to be known, and each shape has to
be handled separately.
b) In addition, it requires somewhat extensive user functions to calculate
and copy/move the angles and edges, which is not an easy task in OpenSCAD.
$ Runsun Pan, PhD $ libs: doctest , faces ( git ), offline doc ( git ), runscad.py ( 2 , git ), synwrite ( 2 ); $ tips: Bezier , hash ( 2 ), matrix ( 2 , 3 ), sweep ( 2 , 3 ), var ( 2 ), lerp , animation ( gif , prodVid , animlib ), precision ( 2 ), xl-control , type , rounded polygon , chfont , tailRecur ( 2 , 3 , 4 ), isosphere ( 2 ), area , vol/center , RGB , CurvedImg , tests ( 2 ), text , triang , unit ; $ Apps: rollApp , blockscad , openjscad , on AWS ( pdf ), support_tools
--
View this message in context: http://forum.openscad.org/flattening-curved-surfaces-tp19727p19782.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Hi,
I'm not a math guy, but came across this info and was curious if any
"real math" folks on this list have considered using gpu accelerated
code for some of the slow parts of OPENscad. Not a universal solution,
of course, but I suspect the majority of folks using OPENscad for
anything serious have some sort of decent graphics card in their
computer. Maybe a compile-time option to switch on accelerated functions?
see: https://developer.nvidia.com/gpu-accelerated-libraries for an idea
of what is out there already tuned up for gpu hardware...
Bill M
On 12/26/2016 05:28 AM, Parkinbot wrote:
It is always a good project to brush up your math.
dot product
This is the scalar product to be used for the threshold criterium. Apply it
with the normalized (i.e. length=1) normals of your triangles.
cross product
being applied to two vectors spanned by your triag's vertices will get you
the normal of your triangle. Adapt orientation by inverting the sign. Divide
this vector by its length and you get a normalized normal. If you start from
an STL you will already find this value for each triangle there.
angle between two vectors
the scalarproduct of two normalized vectors will be cos(angle). So
acos(dot(a,b)) is your friend.
rotate points around an axis
you find the three matrices in wikipedia
http://www.dtic.mil/dtic/tr/fulltext/u2/a218917.pdf
--
View this message in context: http://forum.openscad.org/flattening-curved-surfaces-tp19727p19760.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
How did you work out the original polyhedron? Did you calculate the
intersection of cylinders mathematically?
--
View this message in context: http://forum.openscad.org/flattening-curved-surfaces-tp19727p19784.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
nophead wrote
How did you work out the original polyhedron? Did you calculate the
intersection of cylinders mathematically?
It was done by making 3 arcs, one on the xy-plane (red line below), two on
the yz-plane (green and blue lines), then merge them (for each point, taking
x,y from the red, and z from the green or blue):
http://forum.openscad.org/file/n19786/161227_runsun_flatten_surface_4.png
The position of the centers as well as the radius of those arcs are manually
chosen to make the outcome match the shape presented by jon_bondy.
$ Runsun Pan, PhD $ libs: doctest , faces ( git ), offline doc ( git ), runscad.py ( 2 , git ), synwrite ( 2 ); $ tips: Bezier , hash ( 2 ), matrix ( 2 , 3 ), sweep ( 2 , 3 ), var ( 2 ), lerp , animation ( gif , prodVid , animlib ), precision ( 2 ), xl-control , type , rounded polygon , chfont , tailRecur ( 2 , 3 , 4 ), isosphere ( 2 ), area , vol/center , RGB , CurvedImg , tests ( 2 ), text , triang , unit ; $ Apps: rollApp , blockscad , openjscad , on AWS ( pdf ), support_tools
--
View this message in context: http://forum.openscad.org/flattening-curved-surfaces-tp19727p19786.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
runsun,
You say you don't have to worry about the triangulation but your code
implicitly knows the triangulation. In a more general case, you will need
to traverse it.
2016-12-27 16:46 GMT-02:00 nophead nop.head@gmail.com:
How did you work out the original polyhedron? Did you calculate the
intersection of cylinders mathematically?
--
View this message in context: http://forum.openscad.org/
flattening-curved-surfaces-tp19727p19784.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
Ronaldo wrote
You say you don't have to worry about the triangulation but your code
implicitly knows the triangulation. In a more general case, you will
need
to traverse it.
I only know that I coded without thinking anything about the triangulation,
which, is still a pretty new concept to me. It's likely that I have been
doing triangulation-related stuff but not aware it's called triangulation.
$ Runsun Pan, PhD $ libs: doctest , faces ( git ), offline doc ( git ), runscad.py ( 2 , git ), synwrite ( 2 ); $ tips: Bezier , hash ( 2 ), matrix ( 2 , 3 ), sweep ( 2 , 3 ), var ( 2 ), lerp , animation ( gif , prodVid , animlib ), precision ( 2 ), xl-control , type , rounded polygon , chfont , tailRecur ( 2 , 3 , 4 ), isosphere ( 2 ), area , vol/center , RGB , CurvedImg , tests ( 2 ), text , triang , unit ; $ Apps: rollApp , blockscad , openjscad , on AWS ( pdf ), support_tools
--
View this message in context: http://forum.openscad.org/flattening-curved-surfaces-tp19727p19793.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
I see, I didn't realise it was that simple. I think it is a special case
because the cylinders are orthogonal and aligned with the axes.
On 27 December 2016 at 20:02, runsun runsun@gmail.com wrote:
nophead wrote
How did you work out the original polyhedron? Did you calculate the
intersection of cylinders mathematically?
It was done by making 3 arcs, one on the xy-plane (red line below), two on
the yz-plane (green and blue lines), then merge them (for each point,
taking
x,y from the red, and z from the green or blue):
<http://forum.openscad.org/file/n19786/161227_runsun_flatten_surface_4.png
The position of the centers as well as the radius of those arcs are
manually
chosen to make the outcome match the shape presented by jon_bondy.
$ Runsun Pan, PhD $ libs: doctest , faces ( git ), offline doc ( git ),
runscad.py ( 2 , git ), synwrite ( 2 ); $ tips: Bezier , hash ( 2 ),
matrix ( 2 , 3 ), sweep ( 2 , 3 ), var ( 2 ), lerp , animation ( gif ,
prodVid , animlib ), precision ( 2 ), xl-control , type , rounded polygon ,
chfont , tailRecur ( 2 , 3 , 4 ), isosphere ( 2 ), area , vol/center , RGB
, CurvedImg , tests ( 2 ), text , triang , unit ; $ Apps: rollApp ,
blockscad , openjscad , on AWS ( pdf ), support_tools
--
View this message in context: http://forum.openscad.org/
flattening-curved-surfaces-tp19727p19786.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
FYI
polgonal python based STL file unfolder:
https://github.com/osresearch/papercraft
--
View this message in context: http://forum.openscad.org/flattening-curved-surfaces-tp19727p19806.html
Sent from the OpenSCAD mailing list archive at Nabble.com.