With Geometry Nodes, it is generally difficult to create faces from points or edges exactly at the positions where you would like them to be.
Trim Curve is not always helpful or the best way in this case, as you can only ever trim with a factor or the length - but this requires you to know the length in relation to the corner point, which can be impractical.
I would therefore suggest two other solutions...
In this example, you are obviously using a simple mesh without faces as a starting point - although in my solution it doesn't matter whether faces are present or not, only a closed spline is required.
So let's assume a simple mesh:
Both solutions are based on the fact that I create additional points or subdivisions along the edges, which allows me to remove the excess edges and thus only obtain the corner points with two adjacent segments each, which I then move/edit further.
The aim of both solutions is therefore to create a mesh that looks something like this and has the advantage that it only needs to be extruded upwards:
In this solution, I first convert the mesh into a closed curve and capture three important pieces of information for the next steps for each curve point:
- The index of the preceding point
- The index of the adjacent point
- The index of the point
So that I can keep this in a compact data package, I simply use/misuse the Vector type for this, which allows me to capture three float values in one attribute at the same time.
Then I use the node
Fillet Curve with a count of 2, which divides the corner points into a total of three points and shifts them slightly. This is basically like dividing a curve, but the previously recorded values are not interpolated, but copied from the respective corner point, which is the decisive point here (!).
With the help of these values, it is then possible for me to move the original corner points back to their original position and to move the newly created points so that they are moved from the original corner points along the original edges at a certain distance.
The calculation here is simply based on using the vector between the end points and the original corner points, normalizing it, scaling it with an arbitrary value and finally using it as the new position.
In this variant, which basically works very similarly, I use the node
Subdivide Mesh instead of
Fillet Curve. Here, however, previously recorded values would be interpolated for newly created points, which is why a different approach must be taken.
In the first step, I subdivide the mesh and then delete the two newly created edges in between. This gives me the basic shape.
Then I just have to move the end points of this mesh to the correct positions. To do this, I basically use the same vector calculation as in the other example
PS: In addition, the normals of the faces must be corrected here, as they point in any direction in this variant.
In both cases, the end result is exactly what you (I assume) originally wanted to create with your loose edges, but a little more flexible in handling:
By the way: If you don't want the distance to the corner points to be uniform, simply deactivate the vector math node
Normalize, which shifts the points depending on the edge length.