simplify mapping from normalized device coordinates

This commit is contained in:
2026-02-15 20:53:48 +01:00
parent be7dcf8ae5
commit 450ed7042e
2 changed files with 7 additions and 8 deletions

12
flake.lock generated
View File

@ -103,11 +103,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1770843696,
"narHash": "sha256-LovWTGDwXhkfCOmbgLVA10bvsi/P8eDDpRudgk68HA8=",
"lastModified": 1771025653,
"narHash": "sha256-Y7FxD/qS8VRBQ7lgJIbMX7HU3FQifaMkJzOPz8NFrac=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "2343bbb58f99267223bc2aac4fc9ea301a155a16",
"rev": "7d2ae6d8b8b697b5114a4249d0d958ee5f23d8fe",
"type": "github"
},
"original": {
@ -142,11 +142,11 @@
]
},
"locked": {
"lastModified": 1770865833,
"narHash": "sha256-oiARqnlvaW6pVGheVi4ye6voqCwhg5hCcGish2ZvQzI=",
"lastModified": 1771125043,
"narHash": "sha256-ldf/s49n6rOAxl7pYLJGGS1N/assoHkCOWdEdLyNZkc=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "c8cfbe26238638e2f3a2c0ae7e8d240f5e4ded85",
"rev": "4912f951a26dc8142b176be2c2ad834319dc06e8",
"type": "github"
},
"original": {

View File

@ -202,8 +202,7 @@ auto manual_transform(Edge2Set &result, const Edge3Set &edges,
};
auto map = [&](const Vector2 &a) -> Vector2 {
return Vector2((a.x + 1.0) / 2.0 * WIDTH,
(1.0 - (a.y + 1.0)) / 2.0 * HEIGHT + HEIGHT / 2.0);
return Vector2((1.0 + a.x) / 2.0 * WIDTH, (1.0 - a.y) * HEIGHT / 2.0);
};
#ifdef PARALLEL_TRANSFORM