Vector compare ?
Posted: Fri May 20, 2016 12:43 am
Hi Andrew I can't get this vector compare to return true.
srl
srl
vector1.equalsFuzzy(vector2)To compare two doubles (real or floating point numeric values):
RMath.fuzzyCompare(value1, value2)The == operator should never be used when dealing with floating point values since floating point arithmetic is not always 100% accurate:
0.1+0.2==0.3 falseWith vectors and other objects, == does not work even if two vector are exactly identical since == compares the objects for identity, not the values inside:
var a = new RVector(0,0); var b = new RVector(0,0); a==b false a==a true