Skip to content
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

Running list of p5.dimensions Errors #13

Open
max0410 opened this issue Jan 15, 2017 · 12 comments
Open

Running list of p5.dimensions Errors #13

max0410 opened this issue Jan 15, 2017 · 12 comments

Comments

@max0410
Copy link
Contributor

max0410 commented Jan 15, 2017

Current Errors:

nVector function: "P5JS ERROR: Too many dimensions were entered!"
nCross function: "P5JS ERROR: Vectors must be 3 dimensional!"

@limzykenneth
Copy link

I had a look at the source and I have a couple questions about the errors above.

  1. I see that the number of dimensions are limited by the length of the array dimensionalSymbols, is the 52 dimension limit arbitrarily decided by this length? Is there some way to make it truly n-dimensional? I'm just curious since I doubt anyone would need that many dimensions.
  2. For nCross, I looked at the source and it seemed to be only doing cross product of 3 dimensional vectors? Are cross product of higher dimension not possible?

@Smilebags
Copy link
Owner

  1. It is indeed. We picked that without much consideration (being larger than 99% of use cases will need), but I can see a better format which would work for any number of dimensions. This would change the naming format of the dimensions, so maybe that is best left for v2.0.0. My idea is to use a constructor function which takes in a number and gives an object with dimensions named x,y,z,a... aa, ab, ac... aaa, aab etc.

  2. I realised after writing the function that currently there is no definition for cross products in n dimensions. Well documented in 3 dimensions, though. Strange that. Because of that I thought I should remove it, but haven't decided which is worse: obsolescence or lack of consistency.

@max0410
Copy link
Contributor Author

max0410 commented Feb 13, 2017

Yea, I remember writing the constructor function (or rewriting it, I think?), I tried to implement the infinite dimensions, but it was too much of a hassle. And just recently I was looking at the code, and I thought about doing infinite dimensions. But, a lot of code depends on the dimensionSymbols variable. I may implement it later.

@Smilebags
Copy link
Owner

Yeah, let's consider it for v2.0.0 since it will change (and potentially break) how people might use v1.

@limzykenneth
Copy link

limzykenneth commented Feb 15, 2017

Interesting, I had no idea cross product is a 3 dimension only thing! I personally think if that is the case then it probably should be removed here, not only is it already covered by p5.js (which could cause confusion I think), it isn't really benefitting from what this library is doing (which is providing useful n dimensional maths where cross is only 3 dimensions). People using this library might come to expect the nVector object created can be used with all of the provided functions.

@Smilebags
Copy link
Owner

Yes, I agree with your point. I will remove it.

@max0410
Copy link
Contributor Author

max0410 commented Feb 15, 2017

Technically you can also do cross product in 7 diemensions. When I was writing in I actually though about adding 7d cross products, but the formula is quite huge.

@max0410
Copy link
Contributor Author

max0410 commented Feb 15, 2017

@Smilebags
Copy link
Owner

Hmm interesting! Does it work in 5?

@Smilebags
Copy link
Owner

If it works in all odd dimensions it makes it still useful and out of the scope of p5's cross function.

@max0410
Copy link
Contributor Author

max0410 commented Feb 17, 2017

http://math.stackexchange.com/questions/706011/why-is-cross-product-only-defined-in-3-and-7-dimensions

I have no idea what they are saying, but they are proving that it is only defined in 3 and 7 dimensional space.

@Smilebags
Copy link
Owner

Smilebags commented Feb 17, 2017

Interesting... If it gives a complex result in other dimensions it might still be useful. In which case we should probably also think about introducing complex numbers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants