Geometry Bugs and Geometry Types
Geometry Bugs and Geometry Types
A special kind of bug exists in code that has to deal with geometric concepts like positions, directions, coordinate systems, and all that. Long ago, in an OOPSLA 2020 paper, we defined geometry bugs and designed a type system to catch them. This post demonstrates the idea through some buggy GLSL sh...
Key excerpt:
At OOPSLA 2020, Prof. Dietrich Geisler published a paper about geometry bugs and a type system that can catch them. The idea hasn't exactly taken over the world, and I wish it would. The paper's core insight is that, to do a good job with this kind of type system, you need your types to encode three pieces of information:
- the reference frame (like model, world, or view space)
- the coordinate scheme (like Cartesian, homogeneous, or polar coordinates)
- the geometric object (like positions and directions)
In Dietrich's language, these types are spelled
scheme<frame>.object
. Dietrich implemented these types in a language called Gator with help from Irene Yoon, Aditi Kabra, Horace He, and Yinnon Sanders. With a few helper functions, you can get Gator to help you catch all the geometric pitfalls we saw in this post.