mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-07 20:23:35 +00:00
A projection now counts as invertible when its determinant, or its adjugate's determinant, is more than 1e-15 times the largest of the six products that determinant sums. The adjugate of the adjugate is the map times a number, so the inverse of a projection that inverts also inverts, is stored and reads back. The adjugate's cofactors are formed with exact products, so the inverse of that inverse gives back the original map up to scale, within 1e-6 of each row's largest entry, and a map whose third row is the sum of its first two is still refused. Homography::conjugated and Node::transform_projection judged the affine map by an absolute determinant of 1e-15, so a scale by 1e-8 left type and symbol instances in perspective with their old projection. Both now use Homography::affine_is_invertible, which compares the determinant with the two products it sums at any scale of the map. An affine map whose determinant or inverse is not finite, such as a scale by 1e200 or 1e-200, is inverted through Homography::inverse. When the direct product underflows to a map that is not invertible, as for a projection stored at a subnormal scale, conjugated forms it again with its powers of two kept apart. - crates/geom/src/projective.rs: the_inverse_of_an_invertible_map_is_invertible, conjugating_does_not_depend_on_the_scale_of_the_affine, conjugating_a_map_at_a_tiny_scale_gives_an_invertible_map - crates/doc/src/node/tests.rs: a_projection_follows_the_transform_or_is_removed covers an invertible scale by 1e-8 and a singular map at that size