programming
-
Converting My Codebase to C++20 Modules. Part 1
Today’s post is about C++20 modules and my own journey of converting an existing codebase into modules. After years of waiting, I can finally say the attempt was successful. Back in 2022, trying to use modules in Visual Studio always ended in ICEs. But after three years, the MSVC team has fixed most of the Continue reading
-
How to Check If Two Triangles Intersect: Geometric Algorithms Explained
I’ve looked at a lot of triangle-triangle intersection code across different projects. And every time, one thing stood out: there’s no single implementation that covers all the edge cases. That’s not surprising. The requirements vary wildly depending on the use case – fast-and-loose for games, watertight for CAD, approximated for physics engines. But in this Continue reading
-
C++23 mdspan

Today’s post is dedicated to a new feature introduced in C++23 called std::mdspan. There are already a few articles online about it, but it caught my personal attention for three reasons: What is std::mdspan? As you probably know, C++20 introduced std::span, which provides a view over a contiguous array. For example, if you have a Continue reading
-
Is the Point Inside the Triangle?
Today we’re tackling something that seems simple: how do you tell if a point is inside a triangle? I’ve got five things I want to do here: Make it a storyThis post will be long, with some detours and extra thoughts. But I think that’s the best way to get tricky stuff. A story keeps Continue reading
-
Mesh Stitching: Techniques for Repairing Gaps and Cracks in 3D Models
Today, I’d like to dedicate a post to the topic of mesh stitching.Stitching meshes is usually necessary when they contain gaps, cracks, or thin, narrow holes that can be stitched together instead of being filled. Such cracks might appear due to incorrect data conversion or as a result of geometric algorithms – for example, merging Continue reading
-
How to Implement Undo/Redo for a Half-Edge Data Structure?
Recently, I had to review code for undo/redo functionality for a half-edge data structure. This made me reflect on how different programmers approach problem-solving, considering the trade-offs between the development costs and the efficiency of the resulting solution. I would like to discuss all the possible approaches and how they ultimately impact the final solution, Continue reading
-
Exploring Mixins
A mixin is a class designed to inject specific functionality into other classes through inheritance, allowing developers to add behaviors without relying on deep or rigid inheritance hierarchies. Unlike traditional base classes, mixins are often small, focused, and flexible, providing methods or properties that can be combined to enhance functionality across diverse classes. In C++, Continue reading
-
Mesh Clipping Operations with OpenMesh Library
In this post, I will discuss the process of clipping operations on meshes using the OpenMesh library. For the purpose of this demonstration, we’ll utilize the OpenMesh library to represent our mesh. For those unfamiliar, OpenMesh provides extensive tools for manipulating polygonal meshes. We will be working with a triangulated mesh version for simplicity. Refer Continue reading
-
Half-Edge Data Structure. Part 1

In this post I’ll describe my favorite mesh data structure called half-edge data structure. It’s used primarily in Mesh/CAD applications and helps to make various advanced operations on the mesh such as subdivision or simplification. Let’s start with the vertex and index buffer described in the previous post. The simplest way to display a model Continue reading
-
Techniques for Showing and Hiding Triangles in 3D Meshes
In this post, I want to discuss how to hide and show triangles in a 3D meshes. This serves as a precursor to my next post, which will delve into my favorite sophisticated data structure: the half-edge data structure. I want to mention that I will be using some “abstract rendering API” for this post, Continue reading
-
Understanding NaNs in C++ and their properties
NaN, or “Not a Number,” represents values that cannot be expressed within the realm of real numbers. Its peculiar nature makes handling NaN values in programming, particularly in C++, a topic of interest for many developers. This article delves into what NaN numbers are, how they can arise, their properties, and how to deal with Continue reading