I am an architecture student trying to solve a spatial problem with C # in Grasshopper for Rhino.
The space I'm trying to create is the exhibition space at the airport. The space will consist of elements of the same length. The idea is to connect them to the hinge and thereby allow them to create spaces of different layouts and sizes depending on how many elements are used.

As you can see from the illustration, I would like the space to end with opening the length of the element from the starting point.
My first attempt was to create equilateral triangles depending on the number of segments (walls). In short, triangles are created from the starting point, and then the sides of the triangle that form the outer border are added to the list of points. This list of points is returned to Grasshopper, which draws lines between points. The small point is that I accidentally created the next triangle either from the AC or BC side of the last triangle.
Here is an example of the created spaces (for 12 - 8 - 14 - 20 elements):

Here is the source code that creates these point lists:
private void RunScript(double radius, int walls, ref object A) { // List<Point3d> pointList = new List<Point3d>(); List<Point3d> lastList = new List<Point3d>(); bool alternate = true; bool swapped = false; Random turn = new Random(); // set up the first part of the triangle Point3d point1 = new Point3d(0, 0, 0); Point3d point2 = new Point3d(0, radius, 0); pointList.Add(point1); pointList.Add(point2); Point3d calcPoint; for(int i = 0; i < walls - 1; i++) // walls - 1, is because I need one less triangle to get to the amount of walls { // use the method to create two similar circles and return the intersection point // in order to create an equilateral triangle calcPoint = FindCircleIntersections(point1.X, point1.Y, point2.X, point2.Y, radius, alternate); // random generator: will decide if the new triangle should be created from side BC or AC bool rotate = turn.Next(2) != 0; Print("\n" + rotate); // set the 2nd and 3rd point as 1st and 2nd - depending on random generator. if(rotate) { point1 = point2; if(swapped == true) swapped = false; else swapped = true; } // if the direction is swapped, the next point created will not be a part of the outer border if(swapped) lastList.Add(calcPoint); else pointList.Add(calcPoint); point2 = calcPoint; // swap direction of intersection if(rotate) { if(alternate) alternate = false; else alternate = true; } } lastList.Reverse(); foreach (Point3d value in lastList) { pointList.Add(value); } A = pointList; } // Find the points where the two circles intersect. private Point3d FindCircleIntersections( double cx0, double cy0, double cx1, double cy1, double rad, bool alternate) { // Find the distance between the centers. double dx = cx0 - cx1; double dy = cy0 - cy1; double dist = Math.Sqrt(dx * dx + dy * dy); // Find a and h. double a = (rad * rad - rad * rad + dist * dist) / (2 * dist); double h = Math.Sqrt(rad * rad - a * a); // Find P2. double cx2 = cx0 + a * (cx1 - cx0) / dist; double cy2 = cy0 + a * (cy1 - cy0) / dist; // Get the points P3. if(alternate) return new Point3d((double) (cx2 + h * (cy1 - cy0) / dist), (double) (cy2 - h * (cx1 - cx0) / dist), 0); else return new Point3d((double) (cx2 - h * (cy1 - cy0) / dist), (double) (cy2 + h * (cx1 - cx0) / dist), 0); }
What I would like to do is change the creation of these figures so that they are not only corridors, but similar to my initial sketches. I would like the algorithm to accept input segments (number and length), and then offer different space layouts that can be created using this number of segments. I think, due to tessellation, space should have been created with triangles, squares or hexagons? What do you think, I should study the algorithm of "maximum area": https://stackoverflow.com/a/277618/
I would really appreciate any help with this algorithm. Greetings, Eirik