# Geometry Nodes - Triangular Roof on Rectangular Baseshape

I'm pretty new to Geometry Nodes and don't quite know, how to solve my problems and I'm afraid it's a bit more complex.

I want to create some simple triangular roofs on rectangular baseshapes. The roofs shall work even if the baseshape is rotated a bit. All the Baseshapes are in one Object so I need only one Geo Node System.

So maybe I can shift the center of each individual Mesh Island to its longest side? I don't know much about adressing individual Edges to make them move. Nor do I know how to shift something in it's Local direction. Do individual Mesh Islands even have Local Direction? I don't know what to google anymore and maybe you can give me some hints?

Briefly summarized:

How am I able to select only the upper vertices and then push them to the side, so my roofs have this triangular shape?

I thought maybe it will work kinda like this:

1. having a plane
2. extruding the plane up
3. merging the upper vertices in the middle
4. shifting the upper edge to the side

• Instead of extruding then shifting, why don't you extrude only the part you want to ? The offset Scale input from the Extrude Mesh node takes a field input Commented May 16, 2023 at 16:35

You haven't said which long side you want extruded.. here's a clunky approach which might do

1. A group which finds the longest edge of any polygonal face,stores the edge-index, and (anticlockwise to normal) ordered positions of the edge's end-points, capturing per-face:

1. We're only in rectangles, so can get away with extruding the whole thing, and collapsing the side raised from the longest edge to 0 down the face normal, towards one of the edge's endpoints..

You might want to specify more tightly, but this might be a start.

• ...interesting aproach! I had to think a little bit about how you nested it. Commented May 16, 2023 at 20:34
• @quellenform I'm sure you can do it in 3 nodes :).. I feel a deletion coming on ... :) Commented May 16, 2023 at 20:35
• @Robin Betts Awesome, that looks great and is very helpful, even if I don´t understand it completely by now^^ For me it´s not important which side, it´s okay when it is as random as now :) Sry, I could`ve added this beforehand but is it possible to detect the vertex count of each mesh island and then only spawn/extrude the roofs on quads? Commented May 17, 2023 at 8:29
• Hi, @Tucker .. I thought you might want to tighten up the spec. :) Sure. Do you mean all quads, or only rectangles? Commented May 17, 2023 at 8:33
• @Robin Betts If you ask me like this, I think only rectangles would be better, cause roofs on extreme trapeze-shaped houses for examples will look weird and they better have flat roofs then. Maybe it´s possible to define a corner degree to which it´s allowed to spawn roofs? Commented May 23, 2023 at 13:03