mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-04-20 06:02:05 +02:00
rounded to 5 significant digits.
This commit is contained in:
parent
a9ef8f3479
commit
fcda8232de
@ -21,23 +21,26 @@ module fail(message) {
|
||||
}
|
||||
}
|
||||
|
||||
function shift_to_int(point, digits) =
|
||||
let(
|
||||
pt = point * digits
|
||||
)
|
||||
len(pt) == 2 ?
|
||||
[round(pt[0]), round(pt[1])] :
|
||||
[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 = 1000;
|
||||
n = 100000;
|
||||
|
||||
function truncate_float_point(number) =
|
||||
number >= 0 ? floor(number) : ceil(number);
|
||||
|
||||
function shift_to_int(pt) =
|
||||
len(pt) == 2 ?
|
||||
[truncate_float_point(pt[0]), truncate_float_point(pt[1])] :
|
||||
[truncate_float_point(pt[0]), truncate_float_point(pt[1]), truncate_float_point(pt[2])];
|
||||
|
||||
shifted_expected = shift_to_int(
|
||||
expected * n
|
||||
expected, n
|
||||
);
|
||||
|
||||
shifted_actual = shift_to_int(
|
||||
actual * n
|
||||
actual, n
|
||||
);
|
||||
|
||||
if(shifted_expected != shifted_actual) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user