Points and vectors are the basis of geometry. In this book, we’ll use them as our primitives, the building blocks for the rest of our geometry library. For our geometry library to be usable, it’s crucial that we implement points and vectors using bug-free code. A bug in our code will not only cause errors in the library’s functions but also could propagate to all the other libraries we build on top of it, giving us all sorts of false calculations.

In this chapter, we have two main tasks. First, we need to implement classes to represent both points and vectors. Then, we need to make sure our code is bug-free by unit testing, ...

Get Hardcore Programming for Mechanical Engineers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.