New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PVector lacks a PVector.add(PVector, float, float) method #3593

Closed
teo1978 opened this Issue Aug 13, 2015 · 4 comments

Comments

Projects
None yet
3 participants
@teo1978

teo1978 commented Aug 13, 2015

With a "3D PVector" you can do:

PVector mypv=new PVector(100, 200, 300); 
mypv.add(10, 20, 30); // returns (110, 220, 330)

However, with a "2D PVector" you cannot do:

PVector mypv=new PVector(100, 200); 
mypv.add(10, 20); // compile error

I know, there's no such thing as a 2D PVector. PVector always has a z component and you could always do .add(x, y, 0). However, if you allow to write new PVector(x,y) omitting the z, giving the illusion that one is handling a 2D point without forcing to include a zero z component, it's inconsistent to not allow the same syntax and the same "illusion" when adding.

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Aug 14, 2015

Member

Your call, @shiffman. We'd need sub() as well.

Member

benfry commented Aug 14, 2015

Your call, @shiffman. We'd need sub() as well.

@shiffman

This comment has been minimized.

Show comment
Hide comment
@shiffman

shiffman Aug 14, 2015

Member

Yes, I am in favor. I'm hesitant to add new functionality, but I think this is more of a case of cleaning up old functionality. No new documentation is really required. I also like the "illusion" of PVector objects being 2D or 3D and this helps with that. I can implement if you like, just assign to me.

Member

shiffman commented Aug 14, 2015

Yes, I am in favor. I'm hesitant to add new functionality, but I think this is more of a case of cleaning up old functionality. No new documentation is really required. I also like the "illusion" of PVector objects being 2D or 3D and this helps with that. I can implement if you like, just assign to me.

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Aug 14, 2015

Member

Nah, it's easy and I have the stuff open. All set for beta 4.

Member

benfry commented Aug 14, 2015

Nah, it's easy and I have the stuff open. All set for beta 4.

@benfry benfry closed this Aug 14, 2015

@teo1978

This comment has been minimized.

Show comment
Hide comment
@teo1978

teo1978 Aug 14, 2015

What does that mean?

teo1978 commented Aug 14, 2015

What does that mean?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment