# multmatrix expands the input matrix to 4x4?

15 messages
Open this post in threaded view
|

## multmatrix expands the input matrix to 4x4?

 What is the actual behavior of multmatrix()?   It appears that I can supply M, a list of lists such that the rows, M[i], can be a list of any length, even zero.  If len(M[i])<4 then M[i] is expanded to have length 4.  If len(M[i])>4 then the extra values are ignored.  Furthermore, len(M) can be anything.  Unspecified values are filled in to create an identity matrix, and extra ones are ignored.  So for example, multmatrix([[3]]) will scale in the x direction by 3.   Is this a correct interpretation?    Assuming I can rely on this behavior, I can simplify code by not explicitly transforming 3x3 matrices into 4x4 ones.   -- Sent from: http://forum.openscad.org/_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: multmatrix expands the input matrix to 4x4?

 On 02.07.19 18:52, adrianv wrote: > Assuming I can rely on this behavior, No, you can't. Well nobody can force you to stop poking holes in places that are not clearly defined, there's definitely lots of those. But you have to keep the pieces when it breaks ;-). ciao,   Torsten. _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org -- Torsten
Open this post in threaded view
|

## Re: multmatrix expands the input matrix to 4x4?

 What can I rely on?  From what I can tell, the manual isn't necessarily definitive, being rather a collection of the community's description of the behavior of the code as opposed to being a specification.   Is this behavior accidental?  Subject to change?  Likely to change?    Is it on a list as a bug to fix somewhere?   Why do you call it "poking holes"?  It's what OpenSCAD does.  It's not "wrong", but it is undocumented.  I see it as uncovering shortcomings in the manual, not problems with OpenSCAD.  I was prompted to investigate this because somebody posted a while back that you could pass a 3x4 matrix to multmatrix, so there is undoubtedly code relying on *that* behavior, at least, already out there.   -- Sent from: http://forum.openscad.org/_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: multmatrix expands the input matrix to 4x4?

 On 02.07.19 20:09, adrianv wrote: > Why do you call it "poking holes"?  It's what OpenSCAD does. Yes, and that's what I meant. Things are not clearly specified so there are lots of undefined places. The first tiny steps for reducing that are the latest improvements implementing warnings for a number of those cases. So I guess there's 2 options: 1) Define all the holes as feature and basically make it impossible to change the OpenSCAD language. 2) Slowly move to a clearer specification by improving both code and documentation. I hope we will end up with the 2nd option, and I hope people will help going into that direction. ciao,   Torsten. _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org -- Torsten
Open this post in threaded view
|

## Re: multmatrix expands the input matrix to 4x4?

Open this post in threaded view
|

## Re: multmatrix expands the input matrix to 4x4?

Open this post in threaded view
|

## Re: multmatrix expands the input matrix to 4x4?

Open this post in threaded view
|

## Re: multmatrix expands the input matrix to 4x4?

Open this post in threaded view
|

## Re: multmatrix expands the input matrix to 4x4?

 This sounds like pretty intentional behavior.  Is there a prevailing (or at least common) belief that it's wrong and needs to change?   nophead wrote > The code > <https://github.com/openscad/openscad/blob/69bf5a55475102be43c2ddc698198e85821332b3/src/transform.cc#L204>> creates > a 4x4 identity matrix and then for each element it looks to see if the > corresponding element exists in the passed matrix and if it does it > overwrites that entry. > > So basically it tries as hard as it can to convert any shape matrix to > fit. > Any element it can't find is left as the value from the identity. If the > argument isn't even a matrix it silently uses the identity. -- Sent from: http://forum.openscad.org/_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: multmatrix expands the input matrix to 4x4?

Open this post in threaded view
|

## Re: multmatrix expands the input matrix to 4x4?

Open this post in threaded view
|

## Re: multmatrix expands the input matrix to 4x4?

Open this post in threaded view
|