Triangle Node

john's Avatar


08 Feb, 2021 04:03 AM

The three most common and elementary shapes are the circle, the square, and the triangle. For circles NodeBox provides the ellipse node, for squares the rect node. You can make only equilateral triangles with the polygon node. What about scalene triangles, right triangles, obtuse and acute triangles? I have often wondered: why doesn't NodeBox provide a general purpose triangle node?

When I finally sat down to make one myself, I learned why. Triangles are tricky. They are subtle and complex, full of weird corner cases. There are 57 different calculations required for a general purpose node, some involving trigonometric nodes NodeBox doesn't supply, like arcsin and arccos. Even just crafting a coherent UI to specify a triangle is challenging. In fact, this is one of the most challenging nodes I've ever made.

But it's also one of the most fun nodes to play with.

My triangle node has seven parameters:

  • Angle A
  • Angle B
  • Angle C
  • Side AB
  • Side AC
  • Side BC
  • A checkbox option to show labels

The triangle you create sits on the X axis with Angle A sitting on the origin; Angle B is to its right and Angle C is on top. (Of course once you make your triangle, you can move it, rotate it and scale it to your heart's content.)

To create a triangle you must supply exactly three of the first six values, one of which must be a side: two angles and a side, one angle and two sides, or just three sides. If you enter more or less than three non-zero values, or forget to include at least one side, the node will display a reminder message. Swipe left on all six fields to reset.

Most combinations of values work fine. But if you provide two angles which sum to 180 degrees or more, or if you enter some other combination of values that cannot be used to create a valid triangle (like a leg longer than its hypotenuse) you will also see a message. There are also some cases in which the specified values could result in two different triangles; in those cases, the node will pick one for you.

When creating your triangle it may be helpful to temporarily turn on the labels to easily see all the sides and angles. The labels are automatically positioned and sized to maximum legibility.

As an added bonus, I have also included two "satellite nodes" which may come in handy:

  • Tri_center provides the true centroid of a triangle. NodeBox's centroid node is based on the rectangular bounds enclosing the triangle, so is often nowhere near the actual center. Tri_center fills that gap.
  • In_circle returns the largest circle that can be inscribed in a given triangle. It also works for regular polygons with more than 3 sides.

To see the triangle, tri_center, and in_circle nodes in action, check out this video. The black dot is the NodeBox centroid, the red dot the true centroid, and the circle is the inscribed circle which changes with its triangle:

Please give this node a try and report back if you have any questions, malfunctions, or rave reviews. It's fun seeing the triangle instantly respond with every turn of any one of the six dials.

Go forth and create!


  1. Support Staff 1 Posted by john on 17 Feb, 2021 09:27 AM

    john's Avatar

    Attached is an updated version of the triangle node with a very minor improvement.

    The original node output a group whether or not labels were enabled. The new version outputs a group if labels are enabled, but a simple path if they are not.

    The demo now also shows the correct centers and incircle whether or not the labels are enabled.

    That's all.

  2. Support Staff 2 Posted by john on 05 Apr, 2021 10:39 AM

    john's Avatar

    Attached is a demo of an additional node useful for triangle jockeys.

    NOTE: See next comment for an update to this node.

    The label_triangle node takes any triangle and adds blue angle labels and red edge length labels. This is handy when you have a triangle and you just want to know its measurements. It saves you the trouble of extracting the points and feeding them into angle or distance nodes.

    The demo shows what it does to a random triangle generated by connecting three points from a scatter node. Change the scatter seed to try other random triangles.

    In addition to posting this demo, I will tuck this node inside the demo for the main triangle node in the next release of my node library.



  3. Support Staff 3 Posted by john on 15 Apr, 2021 06:22 AM

    john's Avatar

    Attached is a slight update to the original version of the label_triangle node.

    This new version is exactly the same, except that the assignment of labels (A, B, and C) now follows the original point order of the triangle, regardless of the current rotation of the triangle.

    This doesn't matter much when labeling a single static triangle. But it is helpful when labeling a rotating triangle (which I actually did for a recent animation).


Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Already uploaded files

  • triangle_node_screenshot.png 364 KB
  • 19.5 KB

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

29 May, 2024 05:47 AM
29 May, 2024 05:15 AM
29 May, 2024 05:12 AM
28 May, 2024 07:37 PM
25 May, 2024 11:52 AM


24 May, 2024 07:39 AM
16 May, 2024 02:11 AM
14 May, 2024 01:29 AM
12 May, 2024 07:46 PM
05 May, 2024 04:38 PM
03 May, 2024 06:50 AM