On Thursday, May 4, 2017 at 5:53:36 PM UTC+1, Matthieu Pizenberg wrote:
>
> I definitely recommend looking at https://github.com/opensolid/geometry 
> (with it's svg counterpart : https://github.com/opensolid/svg).
> I've been using it a bit and it's awesome for what I understand you want.
>

This is nice and quite fully featured. 

It seems a shame that it is not Matrix based though. For example suppose I 
want to do a rotation of a shape, ultimately this comes down to mapping 
this vector rotation function over all points defining the shape:

rotateBy : Float -> Vector2d -> Vector2d
rotateBy angle =
    let
        cosine =
            cos angle

        sine =
            sin angle
    in
        \(Vector2d ( x, y )) ->
            Vector2d ( x * cosine - y * sine, y * cosine + x * sine )

Which means calculating sin and cos again for the same input values for 
each point.

If it was Matrix based, you'd calculate the rotation matrix once and then 
do just the matrix multiplication part for each point. Due to the 
properties of linear algebra, you can combine transformation matrices by 
multiplying them all together to capture a more complex transformation in a 
single operation.

So, nice library with lots of features, missed chance to work with a better 
abstraction.

-- 
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.

Reply via email to