Giter VIP home page Giter VIP logo

Comments (9)

nbraud avatar nbraud commented on August 27, 2024

@astronouth7303 Is that supposed to be the projection of a on the surface normal to b?
'cause that wouldn't be it, I think.

Anyhow, yes, having a projection method seems reasonable to me.

from ppb-vector.

AstraLuma avatar AstraLuma commented on August 27, 2024

No, that would be the projection of a onto the vector b, not its normal, as per wikipedia.

Although maybe defining a version that operates on the normal make sense? Matches reflect then?

from ppb-vector.

nbraud avatar nbraud commented on August 27, 2024

@astronouth7303 Both make sense:

  • if we think of projecting and reflecting on surfaces (which makes extra sense in higher dimensions), we definitely want a normal;
  • if we think of projecting and reflecting on a line, defining it by a collinear vector also makes sense.

I guess we could have project_by (for the projection on a vector's normal) and project_unto (the vector's collinear line), and similarly reflect_by and reflect_unto (and deprecate reflect, as the name is ambiguous). The method names are just a placeholder proposal, I didn't think deeply about it and there might be better choices.

If that's something we agree on, I'd be happy to make it happen.

from ppb-vector.

AstraLuma avatar AstraLuma commented on August 27, 2024

Higher dimensions is something that's explicitly out of scope?

from ppb-vector.

nbraud avatar nbraud commented on August 27, 2024

@astronouth7303 This was a parenthesis specifically because of that; interpret that point as β€œit's an API which is sensible in 2D, and is the main thing you would want in 3D”.

I don't think it's out-of-scope to provide an API that's consistent with what happens in not-2D geometry (lowering cognitive load on users).

from ppb-vector.

AstraLuma avatar AstraLuma commented on August 27, 2024

@pathunstrom any perspective from the teaching/student side?

from ppb-vector.

pathunstrom avatar pathunstrom commented on August 27, 2024

I'm going to ask around, but first thoughts:

reflect is there because it's an algorithm I used regularly for physics based games (like Arkanoid clones). I've never needed reflect across a line. So my thought on that is Vector.reflect should be the physics based version, and something like Vector.reflect_across for the across a line version. (Also I'd prefer reflect_onto over reflect_unto but neither of those feel accurate to me.)

EDIT: Thinking about this further, is there that much of a difference between these two? Add a keyword argument to handle the offset that defaults to the null vector and the mechnics of both are the same? (Correct me if I'm wrong, please.)

I need to dig more into projection, another thing I've never needed so need to understand better before I can comment.

from ppb-vector.

AstraLuma avatar AstraLuma commented on August 27, 2024

I realized we might need it because @\eevee was discussing some physics they were doing and one of the steps involved projecting the momentum onto the ground. (They were dealing with momentum going over a hill causing the character to catch some air.)

from ppb-vector.

pathunstrom avatar pathunstrom commented on August 27, 2024

That's a good enough reason to add some kind of projection method, so good even if I don't grok it yet.

from ppb-vector.

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.