Plane (or box) with complex edge

Hey everyone!

I am trying to draw some sides for a complex terrain mesh to turn it from a plane into a box, essentially.

ex of the closest i’ve come:


I have a MeshLine representing each side (with accurate y data) and I essentially just want to draw a plane down from that line, ending at a constant Y.

// SIDE LINES
      const line = new MeshLine();
      line.setPoints(side);
      const material = new MeshLineMaterial({
        color: 0x00cccc,
        sizeAttenuation: true,
        lineWidth: .05,
      });
      const linemesh = new THREE.Mesh(line, material);
      scene.add(linemesh);

That example above is probably the closest I’ve come, though it’s very far off from looking good. It’s basically just drawing many triangles between the top points and the desired bottom, which ends up looking like this:

I’d be happy to share a fiddle or something if that’s helpful, but my example is fairly complex. The real question is: How do I turn a line into a plane that’s flat on 3 sides but matches the line on the 4th?
I’ve tried just about everything I can think of and would be very grateful for a pointer in the right direction! ty

Just to add: I feel like the answer lies in creating some planegeometries with a really high number of segments to create many vertices, and then somehow modulating those vertices to match the line— but I keep getting stuck before making that work.