On Sunday, May 7, 2017 at 10:02:43 PM UTC+1, Rupert Smith wrote: > > On Friday, May 5, 2017 at 7:55:22 PM UTC+1, Ian Mackenzie wrote: >> >> So, nice library with lots of features, missed chance to work with a >>> better abstraction. >>> >> >> Ouch =) I've done lots of work with matrix-based libraries, and I've >> personally found matrices (and related stuff like quaternions) very >> powerful and flexible but also confusion- and error-prone. The OpenSolid >> libraries are my attempt to provide a better, more geometrically meaningful >> abstraction that still allows you to get good performance. >> > > Sorry, my bad and thanks for the explanation. I guess I was a little > fixated on the matrix approach, but with your explanation it is clear that > your approach is at least as good. >
There is potentially an advantage with matrices versus functions. A matrix could be thought of as a function, in the sense that its values capture a particular function that can be applied by multiplying by it. So you have captured the function as a lambda. Lambdas are opaque though, and when chained together to produce a new function, there is no way to guarantee that they will combine in such a way that they reduce to the simplest or most efficient representation; the compiler may do a good job though. Suppose you have a complex chain of transformations like: scale, rotate, translate (requires 3x3 matrix for 2d work), mirror. Represent this with matrices M1, .., M4. The entire transformation can then be captured as a single matrix Mt = M1 . M2 . M3 . M4. As lambdas, my assumption is the compiler will not be smart enough to reduce it so neatly, and it will always be applied as 4 separate operations. I guess you already know this... :-) -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
