Giter Site home page Giter Site logo

Vector operators about compas HOT 8 CLOSED

ZacZhangzhuo avatar ZacZhangzhuo commented on August 15, 2024
Vector operators

from compas.

Comments (8)

tomvanmele avatar tomvanmele commented on August 15, 2024 1

yes, we could implement the "r" versions of the magic methods, but i don't know if there would be any unwanted side-effects...

def __rmul__(self, factor):
    ...

from compas.

tomvanmele avatar tomvanmele commented on August 15, 2024 1

i agree, that is why never implemented the "r" versions. i think it is easy enough for the user to be explicit about their intent by writing the compas object first...

from compas.

gonzalocasas avatar gonzalocasas commented on August 15, 2024

Can it really be solved easily? I have the feeling it's not possible to define the binding of the star operator to take right hand operand as precedence...

from compas.

gonzalocasas avatar gonzalocasas commented on August 15, 2024

Ah true 👍

from compas.

ZacZhangzhuo avatar ZacZhangzhuo commented on August 15, 2024

yes, it's not a big issue. mathmatically the floating number is preferred in the front. like a = k b, a, b are vectors.

from compas.

jf--- avatar jf--- commented on August 15, 2024

@tomvanmele you're right that rmul would address the issue, and @ZacZhangzhuo is right in that operators in Vectors should be complete -- but float * Vector is quite counter intuitive?

from compas.

jf--- avatar jf--- commented on August 15, 2024

@tomvanmele I know I'm being frantic, but seems like this issue can be closed? The broader concept of vec ops isn't discussed.

from compas.

xarthurx avatar xarthurx commented on August 15, 2024

@tomvanmele you're right that rmul would address the issue, and @ZacZhangzhuo is right in that operators in Vectors should be complete -- but float * Vector is quite counter intuitive?

It is actually quite common and intuitive, especially when you compute a "WEIGHTED * long-expression"....

from compas.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.