Coder Social home page Coder Social logo

Comments (2)

sebcrozet avatar sebcrozet commented on May 30, 2024

Computing the matrix on-the-fly based on the angle would make applying the rotation to a point/vector quite expensive. Storing the matrix sin/cos in Rotation2 is a deliberate choice to optimize for this particular use-case. If benchmarks show that there is a need to cache this angle value, then it makes sense to leave it up to the user.

from nalgebra.

edgimar avatar edgimar commented on May 30, 2024

@sebcrozet, I'm not sure if I understand your point correctly. It would seem that if you start with an angle, and want to apply the rotation to a point/vector, then you would need to pay the cost of converting to sin/cos at some point (either when you create the Rotation2 instance, or when you apply the rotation). It can also be the case that you want to work only with the angle, and don't ever need to compute the sin/cos values. The point is to lazily compute (and cache) either angle or sin/cos as needed, but to avoid computing it if not needed.

Let me know if it would be helpful / worthwhile to submit a PR that demonstrates the idea.

from nalgebra.

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.