Triangle Formulas

john's Avatar

john

12 Mar, 2024 06:14 AM

My triangle node is a hidden gem of the Cartan Node Library.

It's deceptively simple. Just provide three values (2 angles and a side, an angle and 2 sides, or 3 sides) and my node will calculate the only possible triangle with those values. You can show just the triangle, the triangle with labels, or the six values (3 angles and 3 sides).

Triangle is surprisingly useful - not just for drawing triangles but also for figuring out how to draw many other things. The triangle node is a miniature trigonometry teacher. It can help you figure out where to place things and how to size them precisely. If you can supply three values (angles or edge lengths) that you know, it will give you three other values that you need. By setting the show option to "Values" and using a slice node, you can then retrieve whichever value you need.

Sometimes, though, I want to pass my known values as parameters that change over time (as in an animation) and calculate the missing values directly without having to create a proxy triangle and slice values. I just want to know the trigonometric formulas the triangle uses. I could go on the web and search for those formulas (and I have, many times), but they are bit hard to pull up in the form I need and a tad confusing to apply. I have often wished that my triangle node could just tell me what formulas it is using in a particular situation.

Now my wish has been granted!

Version 3.4 of the triangle node now has a new show option: formulas. If you select this option, triangle will draw and label the triangle and then list the formulas it used below the diagram. It shows the three supplied values in color (blue for angles, red for sides), and then reveals the formulas used for the other three values. (See screenshot.)

There are 19 different ways to supply three values including at least one side, so there are 19 combinations of formulas - 57 specific variations in all. Each formula is fairly easy to turn into a Nodebox function. Some formulas do require arcsin or arccos, but both are available in my library (arcsin is hidden inside the library demo for the arccos node).

You can see the power of this new feature by fiddling with the triangle parameters. Scrub any of the supplied values to see both triangle and formulas update. Then change which three values you supply (set unknowns to zero) and see what new formulas appear. You can learn a lot about trigonometry just by playing with this one node.

I also fixed two other minor bugs in the update.

  • Values mode now shows the six values in the same order they are entered (A, B, C, AB, AC, BC).
  • Invalid triangles now show an error message in all view modes (even in values mode)

This new formula option is something I've wanted to do for years, but it was rather hard to do. It's one thing for a node to do complicated things, but quite another for it to explain HOW it did each possible complicated thing. I finally figured out a way to do it.

I realize that I may be the only one to ever use this feature. So this is a gift to myself. But all of you are free to enjoy it as well. I would be tickled to hear any comments.

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_formulas_screenshot.png 502 KB
  • triangle_formula_demo.ndbx.zip 25.6 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

Generic

? 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

16 May, 2024 02:11 AM
16 May, 2024 01:58 AM
14 May, 2024 01:29 AM
13 May, 2024 12:36 AM
12 May, 2024 07:46 PM

 

05 May, 2024 04:38 PM
03 May, 2024 06:50 AM
03 May, 2024 12:30 AM
03 May, 2024 12:09 AM
19 Apr, 2024 04:41 AM
16 Apr, 2024 06:18 PM