[OpenSCAD] multmatrix expands the input matrix to 4x4?

adrianv avm4 at cornell.edu
Wed Jul 3 18:17:25 EDT 2019


You can defend use cases for a variety of options.  If you want to rotate
around the x axis, for example, you could pass

[[],[0,cos(theta), sin(theta)], [0,-sin(theta),cos(theta)]]

It's not a huge advantage over passing [[1,0,0],...], though.  


nophead wrote
> Passing 3x3 makes sense if you only want to rotate, so some people might
> do
> that. Similarly 2x2 for rotate around z. And the first three elements on
> the last row are ignored anyway, so passing 3x4 also makes sense.
> 
> On Wed, 3 Jul 2019 at 22:47, adrianv <

> avm4@

> > wrote:
> 
>> I think the argument for tightening size requirements would be that
>> mathematically the size needs to be 4x4 and if it isn't it *could* be
>> intentional, or it could be programmer error, and by issuing a warning,
>> you
>> may help the programmer avoid bugs.
>>
>> The argument for the current behavior is that the programmer has the
>> convenience of specifying only what is needed, which may simplify the
>> code
>> and make it more readable and maintainable.
>>
>>
>> nophead wrote
>> > I think it should warn if you don't pass a vector of vectors, but other
>> > than that, what is the point in tightening up the size requirements?
>> >
>> > On Wed, 3 Jul 2019 at 22:24, adrianv <
>>
>> > avm4@
>>
>> > > wrote:
>> >
>> >> 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&gt
>> >> ;
>> >> > 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
>> >>
>>
>> > Discuss at .openscad
>>
>> >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>> >>
>> >
>> > _______________________________________________
>> > OpenSCAD mailing list
>>
>> > Discuss at .openscad
>>
>> > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>>
>>
>>
>>
>>
>> --
>> Sent from: http://forum.openscad.org/
>>
>> _______________________________________________
>> OpenSCAD mailing list
>> 

> Discuss at .openscad

>> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>>
> 
> _______________________________________________
> OpenSCAD mailing list

> Discuss at .openscad

> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org





--
Sent from: http://forum.openscad.org/



More information about the Discuss mailing list