gengeo2d is a type-generic mini-library for two dimensional geometry. It supports a few, simple drawing primitives (both 'centerline' and 'stroked') and can calculate:
Being type-generic means the user of the library is free to choose the coordinate type and the calc type in which internal calculations are performed. A typical setup is storing coordinates as integer while doing calculations as doubles. But with using 3rd party fixed-point libraries or bignum libraries this also enables gengeo2d to do precise calculations on coordinates larger than what doubles could handle.
gengeo2d is implemented in opc89. This means the source of the library is compiled using opc89 while the distributed library (the material that gets used in projects) is plain C89 code, with zero dependencies (not even opc89).
(The rationale for using opc89 on the source is operator overloading: being able to use the usual operators such as "+" and "*" on opaque, to-be-supplied-by-the-user coordinate types and being able to do vector operations in a readable way. This helps keeping the source of the library clean and easy to follow, while the resulting, distributed C code is plain C89. It is very similar how a parser lib may use yacc instead of manually implementing the parser: if the generated files are distributed, the user of the lib does not need to have yacc installed.)