Przemator wrote: ↑Thu May 02, 2019 8:34 am
How is it better than hump.vector? or hump.vector-light?
I did not know the existence of that, I have seen it now and I see that there is not much difference, only that there are some methods that my library does not have but also there are some things that library does not have that mine if, like the round() and dot() for example.
In addition, my library returns a new vector in the operations and methods, for example vecA + vecB = vecC where vecC has all the methods, instead, the other library only returns its properties x, y.
I apologize for my bad English, I used the google translator.
hump.vector also has dot product. it's done using the __mul operator (vector * vector). it's not only returning the x, y, it creates a new vector (or you can explicitly use methods, which modify the vector itself). There is no round, but there is normalized and trimmed. The way I see it, you've done a lot of effort for nothing
raidho36 wrote: ↑Wed May 01, 2019 7:53 pm
It generates new strings every time it uses assert, that will be slow. Otherwise, looks like vector library from CPML.
Here's what I use. It's a bit more involved and explicit, but it runs fast.
the vector table does not inherit the checkError () method, it is a proprietary method that instantiates in the "require" once nothing else, like the constants vector.RIGHT, vector.LEFT, etc.
Przemator wrote: ↑Thu May 02, 2019 7:15 pm
hump.vector also has dot product. it's done using the __mul operator (vector * vector). it's not only returning the x, y, it creates a new vector (or you can explicitly use methods, which modify the vector itself). There is no round, but there is normalized and trimmed. The way I see it, you've done a lot of effort for nothing
I only share it to receive a critique, they mentioned that the assert () loads strings that make the vector slow, it's a bit exaggerated but in my case, it is not, the checkError () method is not inherited, just like some pre-generated variables like vector.RIGHT, vector.LEFT, etc. it's just a reference, on the other hand in that library there's assert everywhere and it's instantiated in the vector, it strikes me.
damv wrote: ↑Thu May 02, 2019 7:22 pm
the vector table does not inherit the checkError () method, it is a proprietary method that instantiates in the "require" once nothing else, like the constants vector.RIGHT, vector.LEFT, etc.
damv wrote: ↑Thu May 02, 2019 7:22 pm
the vector table does not inherit the checkError () method, it is a proprietary method that instantiates in the "require" once nothing else, like the constants vector.RIGHT, vector.LEFT, etc.
adding
checkerror math add: vector(1, 2)
checkerror math add: vector(3, 4)
checkerror type add: vector(1, 2)
checkerror type add: vector(3, 4)
done
Well it clearly does and it clearly runs a lot of these all the time.
print 4 times because it checks if in operation "a" and "b" are numbers or vectors, so you can make vector (0, 0) + 4 or vector (0,0) + vector (4,4), but do you think I should omit those assert? I thought it referred to the assert string.