Skip to content

Commit

Permalink
Bug fix in Vector.is_equal()
Browse files Browse the repository at this point in the history
The tolerance argument in Vector.is_equal() now works for nested arrays.
  • Loading branch information
JamesWigglesworth authored Jun 1, 2019
1 parent 4d0cdbc commit 43852a9
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions math/Vector.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//Vector and Matrix math functions
//James Wigglesworth
//Started: 6_18_16
//Updated: 8_8_18
//Updated: 6_1_19

var dde_github_issues = "https://github.com/cfry/dde/issues"

Expand Down Expand Up @@ -715,7 +715,7 @@ class Vector{
}
result = true
for(var i = 0; i < array1_temp.length; i++){
if (array1_temp[i] != array2_temp[i]){
if (JSON.stringify(array1_temp[i]) != JSON.stringify(array2_temp[i])){
return false
}
}
Expand All @@ -729,7 +729,8 @@ class Vector{

case "percent_difference":
if(tolerance > 1){
warning("Percent difference tolerance should be within 0 and 1.</br>Input of "

warning("Percent difference tolerance should be within 0 and 1.</br>Input of "
+ tolerance + " changed to " + (tolerance/100) + ".")
tolerance = tolerance/100
}
Expand Down Expand Up @@ -2716,4 +2717,12 @@ function matrix_invert(M){
module.exports = Vector
var Convert = require("./Convert.js")
var {sind, cosd, tand, asind, acosd, atand, atan2d} = require("./Trig_in_Degrees.js")
var {warning} = require("../core/utils.js")
var {warning} = require("../core/utils.js")
/*
if("dde" !== platform){
module.exports = Vector
var Convert = require("./Convert.js")
var {sind, cosd, tand, asind, acosd, atand, atan2d} = require("./Trig_in_Degrees.js")
var {warning} = require("../core/utils.js")
}
*/

0 comments on commit 43852a9

Please sign in to comment.