Smilebags / p5.dimensions.js

An addon for p5.js which adds support for higher dimensional calculations.
72 stars 24 forks source link

get v1.nFunction(v2) to work #14

Closed Smilebags closed 7 years ago

Smilebags commented 7 years ago

We have completed all the initial functions from p5.Vector. Great work! Next I think we should work on adding v1.nAdd(v2) functionality, which should behave the same as nAdd(v1,v2) I have tried adding that functionality to a few functions but I don't believe it is working.

max0410 commented 7 years ago

I would know how to implement that, but would happen to the old functions? Would they just become deprecated? Would we have both nAdd() function and vector.nAdd() function?

Smilebags commented 7 years ago

It should be able to work as the one function. Check out how p5.Vector works, it seems to just look at the arguments then decides how to run the function.

I believe v1.nAdd(v2) should actually just call nAdd(this,v2) inside the function, but I might have forgotten to return the result in my playing around.

Smilebags commented 7 years ago

I just reviewed the p5.Vector code and maybe their functions aren't working in the same way as what I am thinking. If you think you know how to implement it, give it a try, it would be great to see.

max0410 commented 7 years ago

I made a PR for this!

Smilebags commented 7 years ago

I wasn't sure how to do this, nice work!