Closed og76 closed 8 years ago
I implemented rounding in the debug node because otherwise you get these weird numbers everywhere and in most cases you don't care wether a number is 1.2 or 1.20000000001
Comparison between floats is always difficult. Most of the time you just check if the distance between two values or vectors is smaller than a specific epsilon.
ok
Hm I think rounding a vector doesn't make that much sense. And the Problem with comparison can appear after that as well. Changing he Compare node to have a Special behavior when comparing vectors and floats is possible but not suuuper nice from the coding point of view. Also, when do you really need a vector comparison? I never needed it.
first time I needed it was when doin object inside/outside mesh tests the bvh nearest or mesh closes point are very unreliable up to a point, cause they consider only polygons etc (long story..) so I extended them with sort of is on edge/is on vert variants for that I was comparing vectors. eventually I have fallen to vectors distance, but first I tried to make a node setup involving bool
another area is the geometry part, where sometimes you need to see if the point is on line or in plane etc. there also I'm trying to avoid this ..
they are marginal cases and with some doc we can skip implementing that
however, I see an issue if boolean compare supports vectors and the result is wrong, even if only in comparison to some debug
Note that rounding floats is ok! only vector/euler/quat arrays of floats are wrong when after rounding if u use mathutils... of them
or maybe boolean should not support vector euler quat and matrix ...
Well, a real comparison seems to work but in cases you described I think you should always use proximity or so. I don't think we should drop the support for comparing vectors etc...
This is a problem everyone who does something like you did has to deal with eventually. I don't see how we can solve this fundamental issue in a nice way.
This is not a An issue per se. But implications lead to several issues or non functional AN things. We need to deal with these somehow.
Core issue: mathutils.Vector and alike are converting (even rounded) values to floats so:
generally, precision is spoiled by the float representation if u use mathutils Vec etc.
Specific issues / use cases so far
Note that it does work inside nodes etc where functions/operations accept tuples or other triplets, but there too, mathutils spoils the bool if used (so don't use it, feed plain tuples if bool..)
Solutions?
round data node example blend and img from it
ps bumped first into this and more with bvh tree and others, but that is another (sad) story. :)