Better edges of walls

I just made project in which a user uses a 2d cad to make lines and then the cad generates a json like this:

{
  "lines": [
    {
      "p1": {
        "x": -399.71,
        "y": 204.6
      },
      "p2": {
        "x": 401.29,
        "y": 204.6
      },
      "thickness": 12,
      "wallHeight": 260,
      "selected": false
    },
    {
      "p1": {
        "x": 401.29,
        "y": 204.6
      },
      "p2": {
        "x": 401.29,
        "y": -301.4
      },
      "thickness": 12,
      "wallHeight": 260,
      "selected": false
    },
    {
      "p1": {
        "x": 401.29,
        "y": -301.4
      },
      "p2": {
        "x": 3.2900000000000205,
        "y": -301.4
      },
      "thickness": 12,
      "wallHeight": 260,
      "selected": false
    },
    {
      "p1": {
        "x": 3.2900000000000205,
        "y": -301.4
      },
      "p2": {
        "x": 3.2900000000000205,
        "y": 1.6000000000000227
      },
      "thickness": 12,
      "wallHeight": 260,
      "selected": false
    },
    {
      "p1": {
        "x": 3.2900000000000205,
        "y": 1.6000000000000227
      },
      "p2": {
        "x": -400.71,
        "y": 1.6000000000000227
      },
      "thickness": 12,
      "wallHeight": 260,
      "selected": false
    },
    {
      "p1": {
        "x": -400.71,
        "y": 1.6000000000000227
      },
      "p2": {
        "x": -399.71,
        "y": 204.6
      },
      "thickness": 12,
      "wallHeight": 260,
      "selected": false
    }
  ],
  "furnitures": [],
  "openings": [],
  "wardrobe": [],
  "metadata": {
    "createdAt": "2024-11-07T11:28:26.099Z",
    "updatedAt": "",
    "user": "test",
    "name": "JSON Example",
    "description": "AAAAAAAAAAAAAAAAAAAAAA"
  },
  "floor": true,
  "ceiling": true
}

I am converting this json into a mesh by making each line using THREE.Shape and then extruding the Shape eventually ending up having a wall. Thanks to @mjurczyk for the idea.

Each wall is connected to each other wall with square edges but if I increase the thickness it ends up like this:

Is there a better solution of making the edges smoother or something else?

Thanks for everyone in advance.

related : Wall building in a level-editor

3 Likes

Can you guide me how to make a miter join using Shapes, I was able to make it for walls that are going to be in a either square or rectangle, but that is not working for walls that are out of shapes like those.

Although its a really bad logic but yeah.

Thanks in advance if you can help