# Triangle Geometry Input Problem

I’m trying to generate the geometry for a specific triangle, and I’m stuck on how to do it. What’s especially frustrating is that it took me less that 5 seconds to do in Fusion 360, but in Grasshopper I’ve been stuck for hours trying to figure out how to set up the cluster to make it happen. I made this to try to explain it:

Points A, B, and Z are all on a line in that order. The length of AB is fixed at 12, and length BZ is an input that will vary from 0 to 1. I am trying to generate a point C such that angle ACB = 60 and segment CZ is perpendicular to AZ, for any given input of BZ within the range. Each value of BZ has only one configuration that satisfies this. (Note at s=0 triangle ABC will be a regular 30-60-90 triangle). Fusion handles this really easily, I can just place an undefined vertex C and once I have set angles ACB and AZC to these values, the geometry is fully defined and I can measure what X is out of this.

In Grasshopper though, I can’t find a way to set it up that doesn’t require X as an input parameter. I’ve tried various setups with the two trigonometry components, but my two defining angle measurements (ACB and AZC) don’t fit into one place that can determine the geometry. I have the lengths of AB and AZ for that trig, but not any of the other side lengths or angles. It’s not really that complicated and I know the math all checks out, I just can’t get Grasshopper incorporate the pieces. Can anyone think of a configuration that will do this? I really appreciate it, I’m totally stuck on this.

Hi @lhummel3,

As I am quite sure your triangle is too undefined to be solved by equations I can’t think of anything else but an iterative approach (similar to what fusion360 does)

Have a look at this file showing you how to solve your problem with kangoroo

triangleGeo.gh (18.2 KB)

Hope to help,
L

Thank you, this is brilliant! I only just started with grasshopper and haven’t used Kangaroo before, I will be studying this closely! Greatly appreciate this!

Setting aside for a moment the non linear nature of this function, I can’t find any value for the ‘Y coord’ for point C that solves this when ‘BZ’ = 1 (i.e. AZ = 13)?

Triangle_Geometry_2019Oct6a.gh (15.0 KB)

P.S. Looking now at @lando.schumpich’s solution, I see that he encountered the same thing.
By the way, an iterative approach isn’t necessary here.

Indeed - there’s a closed form solution here:

angles.gh (10.2 KB)

This makes it clear that in general there are 2 solutions, and as pointed out above, no solution above
AZ = approx 12.93

1 Like

Two solutions!? Wow. So the problem as described by @lhummel3 contains two flaws:

Each value of BZ has only one configuration that satisfies this. [wrong]

and no solution is possible when BZ = 1. [OOPS!!]

Trying to figure out your circle…?

• Its radius is 6.9282032 which is the tangent of 30 degrees times 12.
• Its center point is {6.0, 3.4641016, 0.0}, which is X = 12/2 and Y = radius/2.

That’s a leap of insight I’ll have to ponder a bit…

Its the circumference of the equilateral triangle constructed for AB. Super smart solution there @DanielPiker, Any point C on that circle will be at an angle of 60° to A and B.

Also nice approach from you @Joseph_Oster, would be interesting to see what Fusion360 spits out for the undefined cases.

2 Likes

This is a super useful visualization to understand the problem. I had been thinking about point C as traveling “down” toward z and only considering that first intersection (which is the one I’m looking for), but this shows clearly that there are 2 and that it can be done without the iterative approach. Thank you, seeing there various approaches are so helpful!