Not signed in (Sign In)

Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthortlima
    • CommentTimeOct 27th 2017 edited
     

    Hi everyone. This is my first post. I'd like to collaborate on the project. But right now I am working from a Mac and I still haven't figured out a way to build for Macs so I could test code changes.

    I found a bug in the Geometry API. The * override is not working. I get an error from python saying 'float' and 'DPoint' are not compatible operands of '*'. In my script, I fixed that manually with the following code in the beginning.

    ```

    def mul(p, factor):
        newx, newy = factor * p.x, factor * p.y
        return pya.DPoint(newx, newy)
    
    pya.DPoint.__mul__ = mul
    pya.DPoint.__rmul__ = mul
    

    ```

    Thomas

    • CommentAuthorMatthias
    • CommentTimeOct 29th 2017 edited
     

    Hi Thomas,

    thanks for this hint.

    The other way is supported - "Point*Float" is allowed. "Float*Point" would be a method on "Float" in Ruby. Basically that's possible, but I don't like monkey-patching basic types too much. So I did not consider this way.

    So essentially, it's a matter of taste whether you want to write "5*DPoint" or just "DPoint*5". The result is the same.

    Matthias