Hello all,
I am quite new to developing my own Grasshopper components. I have done a few so far in Visual Studio an C#, but nothing really fancy. Right now I’d like to write a component that calculates the aspect ratio of a triangle. The triangle is given as a Polyline. Thus, I put it into the component as a “Curve” Parameter, since it looks the best fitting data type to me.
However, I really don’t have a clue how I could acces the curve itself or its properties, and do things with it. I mean, every curve has to be some how defined. Some deep down in the underwood of my computer, there must be formula, or a collection of corner points or something similar. And I don’t know how to get - in this case - the corner points.
That’s basicly my problem. And I have a feeling, that there is some basic knowledge I miss, or something that I am understanding quite wrong.
This is my code so far:
I know, it is still almost empty, but what the component shall do is quite easy:
- Check if the polyline is a triangle (Is it closed? Are all segments lines? Has it 4 Points?)
- Check if triangle is not degenerated (calculate, sort and compare side lengths)
- Calculate the aspect ratio and return it.
Can somebody please help me? I already spent hours in googling but I couldn’t find anything. How do I get the points of the polyline?
Cheers, Henry