R
runsun
Mon, Nov 16, 2015 10:37 PM
Hi Trygon. Wikipedia uses the term "perspective transformation" for what
you call a conic transformation.
I tried using the perspective transformation matrix from wikipedia in
OpenSCAD and it didn't work, I got a run-time error. Don't remember the
details, it was a while ago. At the time, I concluded that we don't
support
arbitrary affine transformations.
If someone has working code, I'd like to see it.
What needed is a line-plane intersection function. As shown in the following
fig ( source
http://www.geom.uiuc.edu/docs/reference/CRC-formulas/node16.html ):
http://forum.openscad.org/file/n14586/img47.gif
Let p = a point on P, q= a point on Q. A projective transformation focusing
on point O can be obtained by calculating the intersection of line pO with
plane Q. This is achievable.
$ Runsun Pan, PhD
$ libs: doctest , faces ( git ), offline doc ( git ),runscad.py( 1 , 2 , git );
$ tips: hash( 1 , 2 ), sweep , var , lerp , animGif
--
View this message in context: http://forum.openscad.org/Non-Linear-Transformations-tp14539p14586.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
doug.moen wrote
> Hi Trygon. Wikipedia uses the term "perspective transformation" for what
> you call a conic transformation.
>
> I tried using the perspective transformation matrix from wikipedia in
> OpenSCAD and it didn't work, I got a run-time error. Don't remember the
> details, it was a while ago. At the time, I concluded that we don't
> support
> arbitrary affine transformations.
>
> If someone has working code, I'd like to see it.
What needed is a line-plane intersection function. As shown in the following
fig ( source
<http://www.geom.uiuc.edu/docs/reference/CRC-formulas/node16.html> ):
<http://forum.openscad.org/file/n14586/img47.gif>
Let p = a point on P, q= a point on Q. A projective transformation focusing
on point O can be obtained by calculating the intersection of line pO with
plane Q. This is achievable.
-----
$ Runsun Pan, PhD
$ libs: doctest , faces ( git ), offline doc ( git ),runscad.py( 1 , 2 , git );
$ tips: hash( 1 , 2 ), sweep , var , lerp , animGif
--
View this message in context: http://forum.openscad.org/Non-Linear-Transformations-tp14539p14586.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
N
Neon22
Tue, Nov 17, 2015 12:16 AM
I applaud the approach of use mathematical equations to define the curve.
However IMHO we also want to easily support the user making the curve
manually. (current list-comprehensions and paths, lofts not quite easy
enough to use IMHO)
E.g.
A 2D polygon (profile) extruded along its (face) normal by D. Then rotated
around its center by Rz degrees.
Loop this N times to get an extruded "twist" of the profile.
E.g.
Same as above but also rotating Rx each increment around the X axis (on edge
of profile shape).
Changing the above into a twisted arch.
E.g
Same as above but starting profile is a square and ending profile is a
pentagon.
Changing the above into a more complex mesh.
So critical aspects are:
- Derived normal per iteration, so we tell which direction vector to move
along.
- Looping construct around the outside for N steps. (for)
- Local transformation, so rotating around edge of profile has new
location(globally) but same location(locally) when in middle of the
sequence.
- Ideally a way to interpolate an intermediate shape between two shapes with
different numbers of vertices.
Either by:
- sampling the edges intitially and making more intermediate points, then
moving each vertex in linear interp(say) at each step.
- AND/OR by auto-triangulation when increasing number of vertices.
These are the aspects I would like to see in OpenSCAD, to make it easy to
make many more complex useful objects in an incremental, rather than math
function, way.
--
View this message in context: http://forum.openscad.org/Non-Linear-Transformations-tp14539p14588.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
I applaud the approach of use mathematical equations to define the curve.
However IMHO we also want to easily support the user making the curve
manually. (current list-comprehensions and paths, lofts not quite easy
enough to use IMHO)
E.g.
A 2D polygon (profile) extruded along its (face) normal by D. Then rotated
around its center by Rz degrees.
Loop this N times to get an extruded "twist" of the profile.
E.g.
Same as above but also rotating Rx each increment around the X axis (on edge
of profile shape).
Changing the above into a twisted arch.
E.g
Same as above but starting profile is a square and ending profile is a
pentagon.
Changing the above into a more complex mesh.
So critical aspects are:
- Derived normal per iteration, so we tell which direction vector to move
along.
- Looping construct around the outside for N steps. (for)
- Local transformation, so rotating around edge of profile has new
location(globally) but same location(locally) when in middle of the
sequence.
- Ideally a way to interpolate an intermediate shape between two shapes with
different numbers of vertices.
Either by:
- sampling the edges intitially and making more intermediate points, then
moving each vertex in linear interp(say) at each step.
- AND/OR by auto-triangulation when increasing number of vertices.
These are the aspects I would like to see in OpenSCAD, to make it easy to
make many more complex useful objects in an incremental, rather than math
function, way.
--
View this message in context: http://forum.openscad.org/Non-Linear-Transformations-tp14539p14588.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
C
ctchin
Tue, Nov 17, 2015 5:44 AM
kintel spoted my mistake, x*z is non-affine so, sorry I was wrong on that
point. I was thinking (I forgot the proper term until doug gave it) about
perspective transformation which can be represented by a 4x4 matrix but not
supported in OpenSCAD.
But he also gave an important clue why a lot of this is loony ideas:
kintel wrote
don’t support non-affine transformations because CGAL doesn’t.
So yes, now that I've been better educated I remember at one point needing
perspective transformation desperately and cursing OpenSCAD for not doing it
for me. But after some attempts, I switch track to trying to solve my
problem by some ways other than transformation. Of course there's no
general solution to substituting a general perspective transformation with
legal OpenSCAD commands, but I found a way to do exactly what I wanted to
design at the time, printed it, published it and be done with it.
I see OpenSCAD as a toy, a fantastic toy (hope no one takes offense). But
it's not a proper programming language. If my design involves some complex
math or algorithm, I would rather do the math in a language I normally use
for math and engineering problems. I have written a ton of codes in Matlab,
C, VC, Java, perl, python, Basic, Fortran and even a few scripting languages
on Unix. Even if OpenSCAD+ or OpenSCAD2 adopt function pointers (I use them
extensively in Matlab and C), typedef, object/solid handle/pointers, mutable
variables, etc etc. Things that make OpenSCAD not nearly as convenient as
conventional procedural languages. It's actually re-assuring OpenSCAD is
handicapped. It motivates me to keep using the languages I'm familiar with
for math and engineering. And only use OpenSCAD for 3D (printing) output.
If another still remember PostScript, I remember learning a tiny of of its
syntax and some commands. I remember being told PostScript can do
"anything". And I remember tell myself, don't get sucked in, just fix the
thesis (so that the printer can accept it) and graduate and get out of
school.
In my work, I am making a prototype which involves over a hundred hexagons
arranged in a way based on the geodesic dome. Now I don't know if it's
possible to realize this hexagonal geodesic in OpenSCAD. Even if it's
possible I know for sure I can do it faster and more powerful in Matlab, so
I use Matlab to calculate the hexagons, have Matlab generate a module
hexs.scad which contain 100+ hexagonal cylinders. And then a prototype.scad
that use<hexs.scad> and add the structural support, base, drill holes for
mounting screws and even imprint a logo on the base.
For my own selfish purpose, I'd rather spend time hacking together a
solution with all the available tools (of which OpenSCAD is but one)
((another being KraGle)) than prodding or telling someone smarter than me
how to do their things my way.
When I choose a tool, I look not only at its (advertised) features and
functions, I more often make a judgement on the user community + development
team. OpenJSCAD and various other similar programmatic CAD may have more
powerful features, but OpenSCAD is the only one enjoying a wide(ish) user
base and actively maintained and supported. And I fear that some of the
radical changes being requested will destroy it. Not due to technical
merits but human/societal factors.
--
View this message in context: http://forum.openscad.org/Non-Linear-Transformations-tp14539p14591.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
kintel spoted my mistake, x*z is non-affine so, sorry I was wrong on that
point. I was thinking (I forgot the proper term until doug gave it) about
perspective transformation which can be represented by a 4x4 matrix but not
supported in OpenSCAD.
But he also gave an important clue why a lot of this is loony ideas:
kintel wrote
> don’t support non-affine transformations because CGAL doesn’t.
So yes, now that I've been better educated I remember at one point needing
perspective transformation desperately and cursing OpenSCAD for not doing it
for me. But after some attempts, I switch track to trying to solve my
problem by some ways other than transformation. Of course there's no
general solution to substituting a general perspective transformation with
legal OpenSCAD commands, but I found a way to do exactly what I wanted to
design at the time, printed it, published it and be done with it.
I see OpenSCAD as a toy, a fantastic toy (hope no one takes offense). But
it's not a proper programming language. If my design involves some complex
math or algorithm, I would rather do the math in a language I normally use
for math and engineering problems. I have written a ton of codes in Matlab,
C, VC, Java, perl, python, Basic, Fortran and even a few scripting languages
on Unix. Even if OpenSCAD+ or OpenSCAD2 adopt function pointers (I use them
extensively in Matlab and C), typedef, object/solid handle/pointers, mutable
variables, etc etc. Things that make OpenSCAD not nearly as convenient as
conventional procedural languages. It's actually re-assuring OpenSCAD is
handicapped. It motivates me to keep using the languages I'm familiar with
for math and engineering. And only use OpenSCAD for 3D (printing) output.
If another still remember PostScript, I remember learning a tiny of of its
syntax and some commands. I remember being told PostScript can do
"anything". And I remember tell myself, don't get sucked in, just fix the
thesis (so that the printer can accept it) and graduate and get out of
school.
In my work, I am making a prototype which involves over a hundred hexagons
arranged in a way based on the geodesic dome. Now I don't know if it's
possible to realize this hexagonal geodesic in OpenSCAD. Even if it's
possible I know for sure I can do it faster and more powerful in Matlab, so
I use Matlab to calculate the hexagons, have Matlab generate a module
hexs.scad which contain 100+ hexagonal cylinders. And then a prototype.scad
that use<hexs.scad> and add the structural support, base, drill holes for
mounting screws and even imprint a logo on the base.
For my own selfish purpose, I'd rather spend time hacking together a
solution with all the available tools (of which OpenSCAD is but one)
((another being KraGle)) than prodding or telling someone smarter than me
how to do their things my way.
When I choose a tool, I look not only at its (advertised) features and
functions, I more often make a judgement on the user community + development
team. OpenJSCAD and various other similar programmatic CAD may have more
powerful features, but OpenSCAD is the only one enjoying a wide(ish) user
base and actively maintained and supported. And I fear that some of the
radical changes being requested will destroy it. Not due to technical
merits but human/societal factors.
--
View this message in context: http://forum.openscad.org/Non-Linear-Transformations-tp14539p14591.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
T
Trygon
Tue, Nov 17, 2015 9:23 AM
The dark art of non affine transformations ;-) :
// Joukowsky airfoil
// circle -> airfoil, using a non affine transformation
// Trygon Nov2015
n=40; // number of facets
s=20; // scale factor
l=250; // wing length
ro=s/40; // offset radius (used to thicken material around trailing edge
cusp)
x=-0.15;
y=0.15;
r=norm([1,0]-[x,y]);
/*
linear_extrude(height=200) offset(r=ro) scale([s,s,s])
transform()=[x*(xx+yy+1)/(xx+yy),y*(xx+yy-1)/(xx+yy)]
translate([x,y,0]) circle(r,$fn=n);
*/
// manually build vertex set for circle
p1=[for(i=[0:n-1]) let(a=i360/n) [rsin(a)+x,r*cos(a)+y]];
// transform vertex set
p2=[for(i=p1) [si[0](i[0]*i[0]+i[1]*i[1]+1)/(i[0]i[0]+i[1]i[1]),
si[1](i[0]*i[0]+i[1]*i[1]-1)/(i[0]*i[0]+i[1]*i[1])]];
linear_extrude(height=l) offset(r=ro) polygon(p2);
--
View this message in context: http://forum.openscad.org/Non-Linear-Transformations-tp14539p14593.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
The dark art of non affine transformations ;-) :
// Joukowsky airfoil
// circle -> airfoil, using a non affine transformation
// Trygon Nov2015
n=40; // number of facets
s=20; // scale factor
l=250; // wing length
ro=s/40; // offset radius (used to thicken material around trailing edge
cusp)
x=-0.15;
y=0.15;
r=norm([1,0]-[x,y]);
/*
linear_extrude(height=200) offset(r=ro) scale([s,s,s])
transform()=[x*(x*x+y*y+1)/(x*x+y*y),y*(x*x+y*y-1)/(x*x+y*y)]
translate([x,y,0]) circle(r,$fn=n);
*/
// manually build vertex set for circle
p1=[for(i=[0:n-1]) let(a=i*360/n) [r*sin(a)+x,r*cos(a)+y]];
// transform vertex set
p2=[for(i=p1) [s*i[0]*(i[0]*i[0]+i[1]*i[1]+1)/(i[0]*i[0]+i[1]*i[1]),
s*i[1]*(i[0]*i[0]+i[1]*i[1]-1)/(i[0]*i[0]+i[1]*i[1])]];
linear_extrude(height=l) offset(r=ro) polygon(p2);
--
View this message in context: http://forum.openscad.org/Non-Linear-Transformations-tp14539p14593.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
AC
Alan Cox
Tue, Nov 17, 2015 10:05 AM
For my own selfish purpose, I'd rather spend time hacking together a
solution with all the available tools (of which OpenSCAD is but one)
((another being KraGle)) than prodding or telling someone smarter than me
how to do their things my way.
Likewise I mostly use other tools to output OpenSCAD object
representations. Having OpenSCAD to do the grunt work is brilliant and if
- ok when - I need to debug the results of my programs it the UI and the
integration are great. Some stuff I use ImplicitCAD for because OpenSCAD
really can't handle the object, but my choice is definitely OpenSCAD.
I could in theory do it all in OpenSCAD but it would be ugly and probably
I would need to add the ability to bend a 3D object to a path for some of
the stuff I generate.
I'd also rather keep the stranger things I need to do from messing up
OpenSCAD for novices, and losing its friendly, easy to get nature for
beginners - especially non programmers. Lots of people need a beginner 3D
design tool, not many people need tools for generating model railway
carriage shells to match etched brass sides 8)
Alan
> For my own selfish purpose, I'd rather spend time hacking together a
> solution with all the available tools (of which OpenSCAD is but one)
> ((another being KraGle)) than prodding or telling someone smarter than me
> how to do their things my way.
>
Likewise I mostly use other tools to output OpenSCAD object
representations. Having OpenSCAD to do the grunt work is brilliant and if
- ok when - I need to debug the results of my programs it the UI and the
integration are great. Some stuff I use ImplicitCAD for because OpenSCAD
really can't handle the object, but my choice is definitely OpenSCAD.
I could in theory do it all in OpenSCAD but it would be ugly and probably
I would need to add the ability to bend a 3D object to a path for some of
the stuff I generate.
I'd also rather keep the stranger things I need to do from messing up
OpenSCAD for novices, and losing its friendly, easy to get nature for
beginners - especially non programmers. Lots of people need a beginner 3D
design tool, not many people need tools for generating model railway
carriage shells to match etched brass sides 8)
Alan
RW
Rob Ward
Tue, Nov 17, 2015 11:34 AM
That is very cool!!!
On 17/11/15 20:23, Trygon wrote:
The dark art of non affine transformations ;-) :
// Joukowsky airfoil
// circle -> airfoil, using a non affine transformation
// Trygon Nov2015
n=40; // number of facets
s=20; // scale factor
l=250; // wing length
ro=s/40; // offset radius (used to thicken material around trailing edge
cusp)
x=-0.15;
y=0.15;
r=norm([1,0]-[x,y]);
/*
linear_extrude(height=200) offset(r=ro) scale([s,s,s])
transform()=[x*(xx+yy+1)/(xx+yy),y*(xx+yy-1)/(xx+yy)]
translate([x,y,0]) circle(r,$fn=n);
*/
// manually build vertex set for circle
p1=[for(i=[0:n-1]) let(a=i360/n) [rsin(a)+x,r*cos(a)+y]];
// transform vertex set
p2=[for(i=p1) [si[0](i[0]*i[0]+i[1]*i[1]+1)/(i[0]i[0]+i[1]i[1]),
si[1](i[0]*i[0]+i[1]*i[1]-1)/(i[0]*i[0]+i[1]*i[1])]];
linear_extrude(height=l) offset(r=ro) polygon(p2);
--
View this message in context: http://forum.openscad.org/Non-Linear-Transformations-tp14539p14593.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
That is very cool!!!
On 17/11/15 20:23, Trygon wrote:
> The dark art of non affine transformations ;-) :
>
> // Joukowsky airfoil
> // circle -> airfoil, using a non affine transformation
> // Trygon Nov2015
>
> n=40; // number of facets
> s=20; // scale factor
> l=250; // wing length
> ro=s/40; // offset radius (used to thicken material around trailing edge
> cusp)
>
> x=-0.15;
> y=0.15;
> r=norm([1,0]-[x,y]);
>
> /*
> linear_extrude(height=200) offset(r=ro) scale([s,s,s])
> transform()=[x*(x*x+y*y+1)/(x*x+y*y),y*(x*x+y*y-1)/(x*x+y*y)]
> translate([x,y,0]) circle(r,$fn=n);
> */
>
> // manually build vertex set for circle
> p1=[for(i=[0:n-1]) let(a=i*360/n) [r*sin(a)+x,r*cos(a)+y]];
>
> // transform vertex set
> p2=[for(i=p1) [s*i[0]*(i[0]*i[0]+i[1]*i[1]+1)/(i[0]*i[0]+i[1]*i[1]),
> s*i[1]*(i[0]*i[0]+i[1]*i[1]-1)/(i[0]*i[0]+i[1]*i[1])]];
>
> linear_extrude(height=l) offset(r=ro) polygon(p2);
>
>
>
>
> --
> View this message in context: http://forum.openscad.org/Non-Linear-Transformations-tp14539p14593.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
>
T
Trygon
Tue, Nov 17, 2015 11:37 AM
Just because a command exists, doesn't mean you have to use it.
If the command transform() existed in OpenSCAD, I wouldn't include it in an
example intended for a beginner, nor would I include multmatrix() which also
has immense geometry mangling capability!
If OpenSCAD was to be made "safe" for beginners, I think the polygon() &
polyhedron() commands would need to be removed for starters, since they
expose vertex data... where would this end?
Books on C programming don't start with pointer arithmetic. In fact
Kernighan & Ritchie state, "Pointers ... [are] a marvelous way to create
impossible-to-understand programs ... however, pointers can also be used to
achieve clarity and simplicity." I think this sums up the potential of an
OpenSCAD transform() command: powerful, but dangerous if used without care.
-Trygon
--
View this message in context: http://forum.openscad.org/Non-Linear-Transformations-tp14539p14596.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Just because a command exists, doesn't mean you have to use it.
If the command transform() existed in OpenSCAD, I wouldn't include it in an
example intended for a beginner, nor would I include multmatrix() which also
has immense geometry mangling capability!
If OpenSCAD was to be made "safe" for beginners, I think the polygon() &
polyhedron() commands would need to be removed for starters, since they
expose vertex data... where would this end?
Books on C programming don't start with pointer arithmetic. In fact
Kernighan & Ritchie state, "Pointers ... [are] a marvelous way to create
impossible-to-understand programs ... however, pointers can also be used to
achieve clarity and simplicity." I think this sums up the potential of an
OpenSCAD transform() command: powerful, but dangerous if used without care.
-Trygon
--
View this message in context: http://forum.openscad.org/Non-Linear-Transformations-tp14539p14596.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
P
Parkinbot
Tue, Nov 17, 2015 12:30 PM
Having followed this thread now for a while, I can see that obviously many of
us are trying to merge stuff implemented in several languages with OpenSCAD
and vice versa. One might call it loony stuff, but isn't a programming
language meant for being able to do loony stuff, without being loony itself?
The usual affine (and also some non affine) stuff can also be done with
other CAD programs by people, who love to drag around things with their
mouse. So there is an urgent need for more flexibility in a programming
language. And to be honest, the way functions and loops are expressed in
OpenSCAD is even more loony than in most programming languages that have
crossed my way in 35 years of programming. Prolog seems to be closest to it,
but this code is somehow better readable. I know that declarative
programming has its pros and cons, so please don't understand this as severe
criticism. It has been done great job so far, and a steadily growing
community is a good proof for this.
But as we are talking here about new features, their impact to the language
and how to use and implement them, it gets more and more clear to me that
OpenSCAD either needs more expressive power in terms of function and include
flexibility or minimum an API-function allowing to access library stuff
implemented in other languages. This service could be started on the basis
of a function prototype allowing for input and output of vectors only (maybe
also for strings) and lead to a steadily growing OpenSCAD automation model
with client and server functionality.
For now people like Kintel and me output .scad files from Matlab or other
high level languages to at least import vectors or other programmatic stuff,
that cannot be expressed in OpenSCAD with reasonable effort.
I'm currently doing a hard job implementing multidimensional cubic spline
functionality in OpenSCAD, which you get in Matlab with three lines, using
cscvn() or with five lines using 2D cubic splines. My aim is to escape
affinity and to be able to sweep around parametrized 2D-airfoil data in 3D
space and get smooth transitions between different parameter sets, without
having to code it the very hard way, as I have done it in
http://www.thingiverse.com/thing:900137
http://www.thingiverse.com/thing:900137
This is what I get out of a 7 by 4 vector using spline interpolation to
sweep around circles:
http://forum.openscad.org/file/n14597/loony.png
Loony stuff, especially when you think about using it n-dimensional for
other shapes like airfoils, gears and so on. But isn't it, what programmers
want to do and why programmers are programmers and not users?
--
View this message in context: http://forum.openscad.org/Non-Linear-Transformations-tp14539p14597.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Having followed this thread now for a while, I can see that obviously many of
us are trying to merge stuff implemented in several languages with OpenSCAD
and vice versa. One might call it loony stuff, but isn't a programming
language meant for being able to do loony stuff, without being loony itself?
The usual affine (and also some non affine) stuff can also be done with
other CAD programs by people, who love to drag around things with their
mouse. So there is an urgent need for more flexibility in a programming
language. And to be honest, the way functions and loops are expressed in
OpenSCAD is even more loony than in most programming languages that have
crossed my way in 35 years of programming. Prolog seems to be closest to it,
but this code is somehow better readable. I know that declarative
programming has its pros and cons, so please don't understand this as severe
criticism. It has been done great job so far, and a steadily growing
community is a good proof for this.
But as we are talking here about new features, their impact to the language
and how to use and implement them, it gets more and more clear to me that
OpenSCAD either needs more expressive power in terms of function and include
flexibility or minimum an API-function allowing to access library stuff
implemented in other languages. This service could be started on the basis
of a function prototype allowing for input and output of vectors only (maybe
also for strings) and lead to a steadily growing OpenSCAD automation model
with client and server functionality.
For now people like Kintel and me output .scad files from Matlab or other
high level languages to at least import vectors or other programmatic stuff,
that cannot be expressed in OpenSCAD with reasonable effort.
I'm currently doing a hard job implementing multidimensional cubic spline
functionality in OpenSCAD, which you get in Matlab with three lines, using
cscvn() or with five lines using 2D cubic splines. My aim is to escape
affinity and to be able to sweep around parametrized 2D-airfoil data in 3D
space and get smooth transitions between different parameter sets, without
having to code it the very hard way, as I have done it in
http://www.thingiverse.com/thing:900137
<http://www.thingiverse.com/thing:900137>
This is what I get out of a 7 by 4 vector using spline interpolation to
sweep around circles:
<http://forum.openscad.org/file/n14597/loony.png>
Loony stuff, especially when you think about using it n-dimensional for
other shapes like airfoils, gears and so on. But isn't it, what programmers
want to do and why programmers are programmers and not users?
--
View this message in context: http://forum.openscad.org/Non-Linear-Transformations-tp14539p14597.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
J
jon
Tue, Nov 17, 2015 12:46 PM
I love the "organic" sense of the PNG you provided. While others in
this group have come up with organic shapes with apparent ease, this is
one area where I struggle. I look forward to learning more about the
tools you are using and creating.
Thank you!
Jon
On 11/17/2015 7:30 AM, Parkinbot wrote:
Having followed this thread now for a while, I can see that obviously many of
us are trying to merge stuff implemented in several languages with OpenSCAD
and vice versa. One might call it loony stuff, but isn't a programming
language meant for being able to do loony stuff, without being loony itself?
The usual affine (and also some non affine) stuff can also be done with
other CAD programs by people, who love to drag around things with their
mouse. So there is an urgent need for more flexibility in a programming
language. And to be honest, the way functions and loops are expressed in
OpenSCAD is even more loony than in most programming languages that have
crossed my way in 35 years of programming. Prolog seems to be closest to it,
but this code is somehow better readable. I know that declarative
programming has its pros and cons, so please don't understand this as severe
criticism. It has been done great job so far, and a steadily growing
community is a good proof for this.
But as we are talking here about new features, their impact to the language
and how to use and implement them, it gets more and more clear to me that
OpenSCAD either needs more expressive power in terms of function and include
flexibility or minimum an API-function allowing to access library stuff
implemented in other languages. This service could be started on the basis
of a function prototype allowing for input and output of vectors only (maybe
also for strings) and lead to a steadily growing OpenSCAD automation model
with client and server functionality.
For now people like Kintel and me output .scad files from Matlab or other
high level languages to at least import vectors or other programmatic stuff,
that cannot be expressed in OpenSCAD with reasonable effort.
I'm currently doing a hard job implementing multidimensional cubic spline
functionality in OpenSCAD, which you get in Matlab with three lines, using
cscvn() or with five lines using 2D cubic splines. My aim is to escape
affinity and to be able to sweep around parametrized 2D-airfoil data in 3D
space and get smooth transitions between different parameter sets, without
having to code it the very hard way, as I have done it in
http://www.thingiverse.com/thing:900137
http://www.thingiverse.com/thing:900137
This is what I get out of a 7 by 4 vector using spline interpolation to
sweep around circles:
http://forum.openscad.org/file/n14597/loony.png
Loony stuff, especially when you think about using it n-dimensional for
other shapes like airfoils, gears and so on. But isn't it, what programmers
want to do and why programmers are programmers and not users?
--
View this message in context: http://forum.openscad.org/Non-Linear-Transformations-tp14539p14597.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.7227 / Virus Database: 4457/11015 - Release Date: 11/17/15
I love the "organic" sense of the PNG you provided. While others in
this group have come up with organic shapes with apparent ease, this is
one area where I struggle. I look forward to learning more about the
tools you are using and creating.
Thank you!
Jon
On 11/17/2015 7:30 AM, Parkinbot wrote:
> Having followed this thread now for a while, I can see that obviously many of
> us are trying to merge stuff implemented in several languages with OpenSCAD
> and vice versa. One might call it loony stuff, but isn't a programming
> language meant for being able to do loony stuff, without being loony itself?
>
> The usual affine (and also some non affine) stuff can also be done with
> other CAD programs by people, who love to drag around things with their
> mouse. So there is an urgent need for more flexibility in a programming
> language. And to be honest, the way functions and loops are expressed in
> OpenSCAD is even more loony than in most programming languages that have
> crossed my way in 35 years of programming. Prolog seems to be closest to it,
> but this code is somehow better readable. I know that declarative
> programming has its pros and cons, so please don't understand this as severe
> criticism. It has been done great job so far, and a steadily growing
> community is a good proof for this.
>
> But as we are talking here about new features, their impact to the language
> and how to use and implement them, it gets more and more clear to me that
> OpenSCAD either needs more expressive power in terms of function and include
> flexibility or minimum an API-function allowing to access library stuff
> implemented in other languages. This service could be started on the basis
> of a function prototype allowing for input and output of vectors only (maybe
> also for strings) and lead to a steadily growing OpenSCAD automation model
> with client and server functionality.
> For now people like Kintel and me output .scad files from Matlab or other
> high level languages to at least import vectors or other programmatic stuff,
> that cannot be expressed in OpenSCAD with reasonable effort.
> I'm currently doing a hard job implementing multidimensional cubic spline
> functionality in OpenSCAD, which you get in Matlab with three lines, using
> cscvn() or with five lines using 2D cubic splines. My aim is to escape
> affinity and to be able to sweep around parametrized 2D-airfoil data in 3D
> space and get smooth transitions between different parameter sets, without
> having to code it the very hard way, as I have done it in
> http://www.thingiverse.com/thing:900137
> <http://www.thingiverse.com/thing:900137>
>
> This is what I get out of a 7 by 4 vector using spline interpolation to
> sweep around circles:
>
> <http://forum.openscad.org/file/n14597/loony.png>
>
> Loony stuff, especially when you think about using it n-dimensional for
> other shapes like airfoils, gears and so on. But isn't it, what programmers
> want to do and why programmers are programmers and not users?
>
>
>
>
> --
> View this message in context: http://forum.openscad.org/Non-Linear-Transformations-tp14539p14597.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.7227 / Virus Database: 4457/11015 - Release Date: 11/17/15
>
>
C
clothbot
Tue, Nov 17, 2015 2:01 PM
Just because a command exists, doesn't mean you have to use it.
If the command transform() existed in OpenSCAD, I wouldn't include it in
an example intended for a beginner, nor would I include multmatrix() which
also has immense geometry mangling capability!
Trygon wrote
> Just because a command exists, doesn't mean you have to use it.
>
> If the command transform() existed in OpenSCAD, I wouldn't include it in
> an example intended for a beginner, nor would I include multmatrix() which
> also has immense geometry mangling capability!
I disagree, but with the qualification that translate(), rotate(), scale(),
mirror() and multmatrix() should be introduced in the context of forward
kinematics (see https://en.wikipedia.org/wiki/Forward_kinematics).
Side note: We *really* need a matrix inverse() function for completeness.
The eigen3 library which OpenSCAD makes use of has matrix inverse functions
(see
http://eigen.tuxfamily.org/dox/classEigen_1_1MatrixBase.html#aa2834da4c855fa35fed8c4030f79f9da),
along with other useful things like plane-to-plane intersection (see
http://eigen.tuxfamily.org/dox/classEigen_1_1Hyperplane.html#ad10ca15c93ee4d825f92a2c4563ed678).
The scale(), rotate(), mirror() and translate() operators can be thought of
as "convenience wrappers" for the general-purpose multmatrix() operator. I
find multi-axis rotate() operations are easier to get a handle on if you
understand the order in which successive matrix multiplications are
happening -
https://github.com/openscad/openscad/blob/master/src/transform.cc#L119 - but
more often than not I'll break them up into explicit, single-axis rotate()
operations to keep track of where things are going.
Andrew.
--
View this message in context: http://forum.openscad.org/Non-Linear-Transformations-tp14539p14599.html
Sent from the OpenSCAD mailing list archive at Nabble.com.