mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-06 06:47:46 +02:00
rounded to 5 significant digits.
This commit is contained in:
@@ -21,23 +21,26 @@ module fail(message) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module assertEqualPoint(expected, actual) {
|
function shift_to_int(point, digits) =
|
||||||
n = 1000;
|
let(
|
||||||
|
pt = point * digits
|
||||||
function truncate_float_point(number) =
|
)
|
||||||
number >= 0 ? floor(number) : ceil(number);
|
|
||||||
|
|
||||||
function shift_to_int(pt) =
|
|
||||||
len(pt) == 2 ?
|
len(pt) == 2 ?
|
||||||
[truncate_float_point(pt[0]), truncate_float_point(pt[1])] :
|
[round(pt[0]), round(pt[1])] :
|
||||||
[truncate_float_point(pt[0]), truncate_float_point(pt[1]), truncate_float_point(pt[2])];
|
[round(pt[0]), round(pt[1]), round(pt[2])];
|
||||||
|
|
||||||
|
function all_shift_to_int(points, digits) =
|
||||||
|
[for(pt = points) shift_to_int(pt, digits) / digits];
|
||||||
|
|
||||||
|
module assertEqualPoint(expected, actual) {
|
||||||
|
n = 100000;
|
||||||
|
|
||||||
shifted_expected = shift_to_int(
|
shifted_expected = shift_to_int(
|
||||||
expected * n
|
expected, n
|
||||||
);
|
);
|
||||||
|
|
||||||
shifted_actual = shift_to_int(
|
shifted_actual = shift_to_int(
|
||||||
actual * n
|
actual, n
|
||||||
);
|
);
|
||||||
|
|
||||||
if(shifted_expected != shifted_actual) {
|
if(shifted_expected != shifted_actual) {
|
||||||
|
Reference in New Issue
Block a user