Write the pairs to json with better precision

This commit is contained in:
Abdelrahman Said 2023-07-02 20:55:08 +01:00
parent 31d02aff8c
commit 09ed32e41a

View File

@ -41,7 +41,9 @@ void write_pairs_to_json(const PairArray &arr, const char *filename) {
for (u64 i = 0; i < arr.count; ++i) { for (u64 i = 0; i < arr.count; ++i) {
PointPair pair = arr.pairs[i]; PointPair pair = arr.pairs[i];
fprintf(fp, "\t\t{\"x0\": %f, \"y0\": %f, \"x1\": %f, \"y1\": %f}%s\n", fprintf(fp,
"\t\t{\"x0\": %.16f, \"y0\": %.16f, \"x1\": %.16f, \"y1\": "
"%.16f}%s\n",
pair.p1.x, pair.p1.y, pair.p2.x, pair.p2.y, pair.p1.x, pair.p1.y, pair.p2.x, pair.p2.y,
i + 1 < arr.count ? "," : ""); i + 1 < arr.count ? "," : "");
} }