discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

library and code repository

M
MichaelAtOz
Wed, Sep 21, 2016 1:52 AM

Ronaldo wrote

Well, I am tempted to include one more ... but possibly away of the
intention of that chapter.
In fact, I see this more as a principle (a vector space one) than a trick.

Personally I don't think the repository should include Tricky code, unless
there is no straight forward solution.
While use of matrix maths is (when you refresh your pure maths from 30 years
ago) probably quite useful, it is probably over the head of the audience.

Perhaps an 'advanced topics' section, but anything there should explain its
function with a link to further info.

IMHO.


Admin - PM me if you need anything, or if I've done something stupid...

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.

The TPP is no simple “trade agreement.”  Fight it! http://www.ourfairdeal.org/  time is running out!

View this message in context: http://forum.openscad.org/library-and-code-repository-tp18354p18450.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Ronaldo wrote > Well, I am tempted to include one more ... but possibly away of the > intention of that chapter. > In fact, I see this more as a principle (a vector space one) than a trick. Personally I don't think the repository should include Tricky code, unless there is no straight forward solution. While use of matrix maths is (when you refresh your pure maths from 30 years ago) probably quite useful, it is probably over the head of the audience. Perhaps an 'advanced topics' section, but anything there should explain its function with a link to further info. IMHO. ----- Admin - PM me if you need anything, or if I've done something stupid... Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above. The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out! -- View this message in context: http://forum.openscad.org/library-and-code-repository-tp18354p18450.html Sent from the OpenSCAD mailing list archive at Nabble.com.
RP
Ronaldo Persiano
Wed, Sep 21, 2016 2:03 AM

I fully agree, Michael, and so I resisted the temptation and put it here.

2016-09-20 22:52 GMT-03:00 MichaelAtOz oz.at.michael@gmail.com:

Ronaldo wrote

Well, I am tempted to include one more ... but possibly away of the
intention of that chapter.
In fact, I see this more as a principle (a vector space one) than a

trick.

Personally I don't think the repository should include Tricky code, unless
there is no straight forward solution.
While use of matrix maths is (when you refresh your pure maths from 30
years
ago) probably quite useful, it is probably over the head of the audience.

Perhaps an 'advanced topics' section, but anything there should explain its
function with a link to further info.

IMHO.


Admin - PM me if you need anything, or if I've done something stupid...

Unless specifically shown otherwise above, my contribution is in the
Public Domain; to the extent possible under law, I have waived all
copyright and related or neighbouring rights to this work. Obviously
inclusion of works of previous authors is not included in the above.

The TPP is no simple “trade agreement.”  Fight it!
http://www.ourfairdeal.org/  time is running out!

View this message in context: http://forum.openscad.org/
library-and-code-repository-tp18354p18450.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

I fully agree, Michael, and so I resisted the temptation and put it here. 2016-09-20 22:52 GMT-03:00 MichaelAtOz <oz.at.michael@gmail.com>: > Ronaldo wrote > > Well, I am tempted to include one more ... but possibly away of the > > intention of that chapter. > > In fact, I see this more as a principle (a vector space one) than a > trick. > > Personally I don't think the repository should include Tricky code, unless > there is no straight forward solution. > While use of matrix maths is (when you refresh your pure maths from 30 > years > ago) probably quite useful, it is probably over the head of the audience. > > Perhaps an 'advanced topics' section, but anything there should explain its > function with a link to further info. > > IMHO. > > > > > ----- > Admin - PM me if you need anything, or if I've done something stupid... > > Unless specifically shown otherwise above, my contribution is in the > Public Domain; to the extent possible under law, I have waived all > copyright and related or neighbouring rights to this work. Obviously > inclusion of works of previous authors is not included in the above. > > The TPP is no simple “trade agreement.” Fight it! > http://www.ourfairdeal.org/ time is running out! > -- > View this message in context: http://forum.openscad.org/ > library-and-code-repository-tp18354p18450.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 >
RU
Richard Urwin
Wed, Sep 21, 2016 8:13 AM

2016-09-20 22:52 GMT-03:00 MichaelAtOz <oz.at.michael@>:

While use of matrix maths is (when you refresh your pure maths from 30
years
ago) probably quite useful, it is probably over the head of the audience.

It's OT, but I just bought this:
https://www.amazon.co.uk/gp/product/1482250926/ref=oh_aui_detailpage_o00_s00?ie=UTF8&psc=1

I remembered a very good book of 3D graphics on a home microcomputer in the
mid 1980's that went into matrix transformations and explained them well. I
couldn't find it -- probably long out of print -- but this looks like it
covers the subject in depth and detail, although maybe more heavily.

It might be better to build up a list of recommendations than to try to
explain the subject.

--
View this message in context: http://forum.openscad.org/library-and-code-repository-tp18354p18454.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

2016-09-20 22:52 GMT-03:00 MichaelAtOz &lt;oz.at.michael@&gt;: > While use of matrix maths is (when you refresh your pure maths from 30 > years > ago) probably quite useful, it is probably over the head of the audience. It's OT, but I just bought this: https://www.amazon.co.uk/gp/product/1482250926/ref=oh_aui_detailpage_o00_s00?ie=UTF8&psc=1 I remembered a very good book of 3D graphics on a home microcomputer in the mid 1980's that went into matrix transformations and explained them well. I couldn't find it -- probably long out of print -- but this looks like it covers the subject in depth and detail, although maybe more heavily. It might be better to build up a list of recommendations than to try to explain the subject. -- View this message in context: http://forum.openscad.org/library-and-code-repository-tp18354p18454.html Sent from the OpenSCAD mailing list archive at Nabble.com.
PR
Peter Ragosch
Wed, Sep 21, 2016 8:31 AM

Am Tue, 20 Sep 2016 18:52:29 -0700 (MST)
schrieb MichaelAtOz oz.at.michael@gmail.com:

Personally I don't think the repository should include Tricky code,
unless there is no straight forward solution.
While use of matrix maths is (when you refresh your pure maths from
30 years ago) probably quite useful, it is probably over the head of
the audience.

Perhaps an 'advanced topics' section, but anything there should
explain its function with a link to further info.

IMHO.

Well, I'm not so well in math/trigonometrie, and therefore I would like
to see solutions using simple, mid, and extreme math levels. The same
is valid for use of openSCAD constructs (polygon, vector and matrices
come in mind).

--
Mit freundlichen Grüßen
Kind Regards

Peter Ragosch

Am Tue, 20 Sep 2016 18:52:29 -0700 (MST) schrieb MichaelAtOz <oz.at.michael@gmail.com>: > Personally I don't think the repository should include Tricky code, > unless there is no straight forward solution. > While use of matrix maths is (when you refresh your pure maths from > 30 years ago) probably quite useful, it is probably over the head of > the audience. > > Perhaps an 'advanced topics' section, but anything there should > explain its function with a link to further info. > > IMHO. Well, I'm not so well in math/trigonometrie, and therefore I would like to see solutions using simple, mid, and extreme math levels. The same is valid for use of openSCAD constructs (polygon, vector and matrices come in mind). -- Mit freundlichen Grüßen Kind Regards Peter Ragosch
MS
Mark Schafer
Wed, Sep 21, 2016 10:08 AM

Neumann and Sproull was my favourite

On 9/21/2016 8:31 PM, Peter Ragosch wrote:

Am Tue, 20 Sep 2016 18:52:29 -0700 (MST)
schrieb MichaelAtOz oz.at.michael@gmail.com:

Personally I don't think the repository should include Tricky code,
unless there is no straight forward solution.
While use of matrix maths is (when you refresh your pure maths from
30 years ago) probably quite useful, it is probably over the head of
the audience.

Perhaps an 'advanced topics' section, but anything there should
explain its function with a link to further info.

IMHO.

Well, I'm not so well in math/trigonometrie, and therefore I would like
to see solutions using simple, mid, and extreme math levels. The same
is valid for use of openSCAD constructs (polygon, vector and matrices
come in mind).

Neumann and Sproull was my favourite On 9/21/2016 8:31 PM, Peter Ragosch wrote: > Am Tue, 20 Sep 2016 18:52:29 -0700 (MST) > schrieb MichaelAtOz <oz.at.michael@gmail.com>: > >> Personally I don't think the repository should include Tricky code, >> unless there is no straight forward solution. >> While use of matrix maths is (when you refresh your pure maths from >> 30 years ago) probably quite useful, it is probably over the head of >> the audience. >> >> Perhaps an 'advanced topics' section, but anything there should >> explain its function with a link to further info. >> >> IMHO. > Well, I'm not so well in math/trigonometrie, and therefore I would like > to see solutions using simple, mid, and extreme math levels. The same > is valid for use of openSCAD constructs (polygon, vector and matrices > come in mind). >
R
Ronaldo
Wed, Sep 21, 2016 5:54 PM

Although I agree with Michael that the section Tips & Tricks is not the
appropriate place for advanced techniques, I think such a place is missing.
And I don't think you need a lot of matrix theory fundamentals to conceive
them. Here are some examples.

We find functions to transpose a matrix in many libraries out there. They
have generally the form:

function transpose_3(m) =
[[m[0][0],m[1][0],m[2][0]],[m[0][1],m[1][1],m[2][1]],[m[0][2],m[1][2],m[2][2]]];
function transpose_4(m) = [[m[0][0],m[1][0],m[2][0],m[3][0]],
[m[0][1],m[1][1],m[2][1],m[3][1]],
[m[0][2],m[1][2],m[2][2],m[3][2]],
[m[0][3],m[1][3],m[2][3],m[3][3]]];

which is hard to read and very specialized to square 3x3 and 4x4 matrices.
Why not to define transpose generally?

function transpose(m) = // m is any rectangular matrix of objects
[ for(j=[0:len(m[0])-1]) [ for(i=[0:len(m)-1]) m[i][j] ] ];

That form is simpler, readable and concise besides general.

Another example. runsun  published
http://forum.openscad.org/Determining-what-data-type-a-variable-is-holding-tc16111.html#a16115
a few month ago here in the forum some type test functions. They are helpful
in many circumstances. What about to check if an object is a 3D point? The
trivial solution is to check if it is a list with 3 elements which are
floats. But a simpler code is:

function is_point(x, n=3) = ( 0*x == [for(i=[1:n]) 0]);

which is readable, concise and general. It is readable if you are aware of
what OpenSCAD do (and it does the right thing) when you multiply a
structured list of floats by a float number: it multiplies each float inside
the list by the number, regardless how deep in the list it is. For example:

echo(2*[1,[1],[1,1],[1,1,[1]]]);
// ECHO: [2,[2],[2,2],[2,2,[2]]]
echo(0*[1,[2],[3,4],[5,6,[7]]]);
// ECHO: [0,[0],[0,0],[0,0,[0]]]

We don't need much math here but just to know the extent of the scalar
product of a list. And enjoy it!

Although this may be a material beyond a beginner interest it is invaluable
for advanced geometric OpenSCAD programmers, those who write libraries for
beginners...

--
View this message in context: http://forum.openscad.org/library-and-code-repository-tp18354p18457.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Although I agree with Michael that the section Tips & Tricks is not the appropriate place for advanced techniques, I think such a place is missing. And I don't think you need a lot of matrix theory fundamentals to conceive them. Here are some examples. We find functions to transpose a matrix in many libraries out there. They have generally the form: > function transpose_3(m) = > [[m[0][0],m[1][0],m[2][0]],[m[0][1],m[1][1],m[2][1]],[m[0][2],m[1][2],m[2][2]]]; > function transpose_4(m) = [[m[0][0],m[1][0],m[2][0],m[3][0]], > [m[0][1],m[1][1],m[2][1],m[3][1]], > [m[0][2],m[1][2],m[2][2],m[3][2]], > [m[0][3],m[1][3],m[2][3],m[3][3]]]; which is hard to read and very specialized to square 3x3 and 4x4 matrices. Why not to define transpose generally? > function transpose(m) = // m is any rectangular matrix of objects > [ for(j=[0:len(m[0])-1]) [ for(i=[0:len(m)-1]) m[i][j] ] ]; That form is simpler, readable and concise besides general. Another example. runsun published <http://forum.openscad.org/Determining-what-data-type-a-variable-is-holding-tc16111.html#a16115> a few month ago here in the forum some type test functions. They are helpful in many circumstances. What about to check if an object is a 3D point? The trivial solution is to check if it is a list with 3 elements which are floats. But a simpler code is: > function is_point(x, n=3) = ( 0*x == [for(i=[1:n]) 0]); which is readable, concise and general. It is readable if you are aware of what OpenSCAD do (and it does the right thing) when you multiply a structured list of floats by a float number: it multiplies each float inside the list by the number, regardless how deep in the list it is. For example: > echo(2*[1,[1],[1,1],[1,1,[1]]]); > // ECHO: [2,[2],[2,2],[2,2,[2]]] > echo(0*[1,[2],[3,4],[5,6,[7]]]); > // ECHO: [0,[0],[0,0],[0,0,[0]]] We don't need much math here but just to know the extent of the scalar product of a list. And enjoy it! Although this may be a material beyond a beginner interest it is invaluable for advanced geometric OpenSCAD programmers, those who write libraries for beginners... -- View this message in context: http://forum.openscad.org/library-and-code-repository-tp18354p18457.html Sent from the OpenSCAD mailing list archive at Nabble.com.
J
jon
Wed, Sep 21, 2016 6:18 PM

I would love to see information in our repository that allows an
interested OpenSCAD user to grow and grow and grow.  The kind of content
found below would encourage that

Jon

On 9/21/2016 1:54 PM, Ronaldo wrote:

Although I agree with Michael that the section Tips & Tricks is not the
appropriate place for advanced techniques, I think such a place is missing.
And I don't think you need a lot of matrix theory fundamentals to conceive
them. Here are some examples.

We find functions to transpose a matrix in many libraries out there. They
have generally the form:

function transpose_3(m) =
[[m[0][0],m[1][0],m[2][0]],[m[0][1],m[1][1],m[2][1]],[m[0][2],m[1][2],m[2][2]]];
function transpose_4(m) = [[m[0][0],m[1][0],m[2][0],m[3][0]],
[m[0][1],m[1][1],m[2][1],m[3][1]],
[m[0][2],m[1][2],m[2][2],m[3][2]],
[m[0][3],m[1][3],m[2][3],m[3][3]]];

which is hard to read and very specialized to square 3x3 and 4x4 matrices.
Why not to define transpose generally?

function transpose(m) = // m is any rectangular matrix of objects
[ for(j=[0:len(m[0])-1]) [ for(i=[0:len(m)-1]) m[i][j] ] ];

That form is simpler, readable and concise besides general.

Another example. runsun  published
http://forum.openscad.org/Determining-what-data-type-a-variable-is-holding-tc16111.html#a16115
a few month ago here in the forum some type test functions. They are helpful
in many circumstances. What about to check if an object is a 3D point? The
trivial solution is to check if it is a list with 3 elements which are
floats. But a simpler code is:

function is_point(x, n=3) = ( 0*x == [for(i=[1:n]) 0]);

which is readable, concise and general. It is readable if you are aware of
what OpenSCAD do (and it does the right thing) when you multiply a
structured list of floats by a float number: it multiplies each float inside
the list by the number, regardless how deep in the list it is. For example:

echo(2*[1,[1],[1,1],[1,1,[1]]]);
// ECHO: [2,[2],[2,2],[2,2,[2]]]
echo(0*[1,[2],[3,4],[5,6,[7]]]);
// ECHO: [0,[0],[0,0],[0,0,[0]]]

We don't need much math here but just to know the extent of the scalar
product of a list. And enjoy it!

Although this may be a material beyond a beginner interest it is invaluable
for advanced geometric OpenSCAD programmers, those who write libraries for
beginners...

I would love to see information in our repository that allows an interested OpenSCAD user to grow and grow and grow. The kind of content found below would encourage that Jon On 9/21/2016 1:54 PM, Ronaldo wrote: > Although I agree with Michael that the section Tips & Tricks is not the > appropriate place for advanced techniques, I think such a place is missing. > And I don't think you need a lot of matrix theory fundamentals to conceive > them. Here are some examples. > > We find functions to transpose a matrix in many libraries out there. They > have generally the form: > >> function transpose_3(m) = >> [[m[0][0],m[1][0],m[2][0]],[m[0][1],m[1][1],m[2][1]],[m[0][2],m[1][2],m[2][2]]]; >> function transpose_4(m) = [[m[0][0],m[1][0],m[2][0],m[3][0]], >> [m[0][1],m[1][1],m[2][1],m[3][1]], >> [m[0][2],m[1][2],m[2][2],m[3][2]], >> [m[0][3],m[1][3],m[2][3],m[3][3]]]; > which is hard to read and very specialized to square 3x3 and 4x4 matrices. > Why not to define transpose generally? > >> function transpose(m) = // m is any rectangular matrix of objects >> [ for(j=[0:len(m[0])-1]) [ for(i=[0:len(m)-1]) m[i][j] ] ]; > That form is simpler, readable and concise besides general. > > Another example. runsun published > <http://forum.openscad.org/Determining-what-data-type-a-variable-is-holding-tc16111.html#a16115> > a few month ago here in the forum some type test functions. They are helpful > in many circumstances. What about to check if an object is a 3D point? The > trivial solution is to check if it is a list with 3 elements which are > floats. But a simpler code is: > >> function is_point(x, n=3) = ( 0*x == [for(i=[1:n]) 0]); > which is readable, concise and general. It is readable if you are aware of > what OpenSCAD do (and it does the right thing) when you multiply a > structured list of floats by a float number: it multiplies each float inside > the list by the number, regardless how deep in the list it is. For example: > >> echo(2*[1,[1],[1,1],[1,1,[1]]]); >> // ECHO: [2,[2],[2,2],[2,2,[2]]] >> echo(0*[1,[2],[3,4],[5,6,[7]]]); >> // ECHO: [0,[0],[0,0],[0,0,[0]]] > We don't need much math here but just to know the extent of the scalar > product of a list. And enjoy it! > > Although this may be a material beyond a beginner interest it is invaluable > for advanced geometric OpenSCAD programmers, those who write libraries for > beginners... >