Joints are hard

Published on 18 September 2025

One of the things that typically takes quite a lot of work in CAD software is drawing joints. Personally, I often don’t bother with the effort: I just draw butt joints everywhere and take notes or make a paper sketch for the actual joints I want to do. But that’s a shame. I’m not making those joints for fun: they can make a big difference in the look of the design. And having an incomplete design can lead to mistakes when building.

What drawing a joint should look like

When you’re designing a piece of furniture, you’re mostly working with rectangular pieces: boards, pieces of sheet material. That’s easy to draw. But adding joints requires small details that align just right. It’s not hard to do, but it takes some time. And if you’re not working parametrically, once you’ve added a joint it often becomes hard or impossible to change the dimensions of your part without redrawing it, joint and all. Who has time for that?

In Maqet, we want to make it easy to add joints to your design. Select two parts, and choose how you want them to be joined. That’s it. As we’ve said before: we don’t want you to have to think about how to do it, you just do it.

Drawing a joint in Maqet

But from a technical standpoint, that’s easier said than done. Since you’re not telling the program how the parts should be joined exactly, it has to figure it out by itself. And if I show you two boards held together in a certain way, it will immediately be obvious to you how they should be joined. But translating that into a program that will always choose the correct joint is not trivial.

Computers are dumb

Let’s talk about a simpler problem to see what we’re up against. Imagine a polygon and a point on a flat surface, like the image below. Does the point lie inside the polygon, or outside? For us humans, answering the question is so easy that it’s almost ridiculous to ask.

Does the point lie inside the polygon or outside?

For a computer, a common way to answer the question is to draw a straight line from the point to infinity (we call this a “ray”), and count how many times the ray crosses the polygon. If the number is odd, the point is inside the polygon, otherwise it’s outside.

The computer algorithm for checking if a point lies inside a polygon

The pseudocode for this algorithm might look like this:

function isPointInsidePolygon(point, polygon):
    ray = getRandomRayFromPoint(point)
    crossings = 0
    for edge in polygon:
        if intersects(ray, edge):
            crossings = crossings + 1
    return isOdd(crossings)

So even for a trivial task like this, the computer has to do quite some work. And we haven’t even talked about (literal) edge cases like when the point lies on the edge of the polygon.

Joints are even harder

Back to our original problem: how do we calculate the joint between two boards?

Let’s answer a different question first. Say you have two boards of 1 by 8 by 20 cm. How many different ways are there to join these boards together with a miter joint at a right angle? I’d say probably 3 that you would actually use. But for the computer, the answer is 54:

There are 54 different ways to joint two rectangular boards together at a right angle

Now most of these joints don’t make any sense of course. Look at this abomination:

A joint that no one would ever build

No one will build that. I know that, and you know that. But the computer doesn’t. So we have to find a way to filter out all the nonsense joints.

Calculating a joint from 2 planes

Calculating the geometry of a joint is actually quite simple once you know its orientation. When jointing two boards like in the image below, you start from the planes that align with the backsides of the boards. For a miter joint, you calculate the angle between these planes (90 degrees in this case), create a new plane at half that angle (45 degrees), and use that to cut the boards. For a rabbet joint, you raise the bottom plane by half the thickness of the bottom board, and use that to cut the right board.

Example of creating a miter and rabbet joint

When the boards are lying flat, like in a picture frame, you can use exactly the same method, but now the planes we need for our calculation are the ones the align with the top side of the top board, and the right side of the right board.

Example of creating a miter and rabbet joint when the boards are lying flat

Finding the correct planes

Disclaimer: this section contains some math. If you’re not interested in the details, you can skip to the next section.

So the challenge is figuring out which planes to use. Each board has 3 planes: top, bottom, left, right, front and back. Which one do we need? If you pick the wrong plane, you may get a joint that is geometrically correct, but doesn’t make sense to build, like our dear friend the abomination above.

We found a procedure that works in all the cases we’ve tested, that goes as follows. Say we have two boards A and B.

  1. Find the area where the two boards overlap (the red area in the image below) and calculate the centerpoint of that area.
  2. For each board, calculate the direction to get from the board’s centerpoint to the overlap’s centerpoint. Call these vAO and vBO.
  3. For board A, consider the 3 planes planeA,x, planeA,y and planeA,z that cross the center of the board. (So instead of considering the top and bottom plane separately, we only consider the plane that lies in the middle between them. Same for the left/right plane, and the front/back plane.)
    1. Each plane gets a priority: the plane that is parallel to the top/bottom of the board gets priorityA,z = 1, the other two get priorityA,x = 2 and priorityA,y = 2. (For beams, like 2x4s, we have two planes with priority 1 and only one plane with priority 2. Other than that the procedure is the same.)
    2. For each plane of board A, calculate the angle between vBO and the plane normal (this is the arrow that is perpendicular to the plane) as a number between 0° and 90°. Call these αA,x, αA,y and αA,z.
    3. Do the same for board B.
  4. Finally, we have 9 pairs of planes: 3 planes for board A times 3 planes for board B. For example, pairx,y contains the planes planeA,x and planeB,y.
    1. Dismiss all the pairs where the two planes are parallel to each other, we can’t create a joint from them.
    2. For each of the remaining pairs, calculate a priority as follows: priorityx,y = max(priorityA,x, priorityB,y). If there are any pairs with priority 1, dismiss all the pairs with priority 2.
    3. For each of the remaining pairs, calculate a score as follows: scorex,y = αA,x * αB,y. The pair with the lowest score is the one we will use to construct the joint.
The overlap between the boards

Wrapping up

It took us quite a while to come up with this procedure. We found a few forum posts about people struggling with the same problem, but haven’t come across any solution that is general enough to be useful for us. We’re pretty sure we’ve found a procedure that works in almost all real-world scenarios. If you find a case where it doesn’t, please let us know! There may also be some cases where there are two or more possible joints. If that is so, we will probably add a way to override the default orientation in the future. But for now we’re really happy that we were able to find a solution that finds the right joint without any help from the user. One step closer to simplifying woodworking design!

Stay updated with our latest blog posts

Joints are hard • Maqet