equalsEpsilon

fun equalsEpsilon(left: Matrix4? = definedExternally, right: Matrix4? = definedExternally, epsilon: Double? = definedExternally): Boolean(source)

Compares the provided matrices componentwise and returns true if they are within the provided epsilon, false otherwise.

//compares two Matrix4 instances

// a = [10.5, 14.5, 18.5, 22.5]
// [11.5, 15.5, 19.5, 23.5]
// [12.5, 16.5, 20.5, 24.5]
// [13.5, 17.5, 21.5, 25.5]

// b = [10.0, 14.0, 18.0, 22.0]
// [11.0, 15.0, 19.0, 23.0]
// [12.0, 16.0, 20.0, 24.0]
// [13.0, 17.0, 21.0, 25.0]

if(Matrix4.equalsEpsilon(a,b,0.1)){
console.log("Difference between both the matrices is less than 0.1");
} else {
console.log("Difference between both the matrices is not less than 0.1");
}

//Prints "Difference between both the matrices is not less than 0.1" on the console

Return

true if left and right are within the provided epsilon, false otherwise.

Parameters

left

The first matrix.

right

The second matrix.

epsilon

The epsilon to use for equality testing. Default value - 0

See also