1

I am using EdgesGeometry to show the outer edges of the mesh as so : EdgesGeometry( geometry, thresholdAngle ).

This normally works as expected but after a using threeCSG to either 'subtract' or 'union' and then generating the EdgesGeometry on the resulting mesh I get various stray edges appear on coplanar faces, even if I increase the 'thresholdAngle' to say '180 degrees', they remain.

This is what happens - enter image description here

Here's my code: (a & b are the meshes of the box geometry)

a_ = new ThreeBSP( a );
b_ = new ThreeBSP( b );

c_ = a_.subtract(b_);
c = c_.toMesh(mat_cube);

scene.add( c );

edges = new THREE.EdgesGeometry( c.geometry, 5 )
line = new THREE.LineSegments( edges, mat_line )
scene.add( line )

anyone got any ideas? thanks

UPDATE

below is what it looks like with 'WireframeGeometry'... enter image description here

WestLangley
  • 102,557
  • 10
  • 276
  • 276
treeseal7
  • 739
  • 8
  • 22
  • 1
    Not an answer, but if you want to know where those edges come from, you can apply wireframe to your mesh `c` and see its structure. – prisoner849 Aug 31 '17 at 14:27
  • I've added that above. Doesn't really seem to explain why some of these lines are remaining though when using 'EdgesGeometry' – treeseal7 Aug 31 '17 at 14:54
  • I mean to use `.wireframe: true` of the mesh's material to see what happens inside. – prisoner849 Aug 31 '17 at 15:08
  • sure, yeah that shows the same mesh as what shows with 'EdgesGeometry', and there's nothing extra going on behind the visible faces – treeseal7 Aug 31 '17 at 15:14

1 Answers1

2

You are seeing unexpected "edges" when rendering with EdgesGeometry.

The cause is an artifact of the output of threeCSG.

The long edge of the large triangle is coincident with edges of three smaller triangles -- coincident, but not shared.

That means, the long edge is not shared at all. Nor are the three short edges.

Edges that are not shared are rendered by EdgesGeometry.

three.js r.87

WestLangley
  • 102,557
  • 10
  • 276
  • 276
  • thanks for your answer, I think I understand but am still puzzled on how to deal with this, it seems as if it should be fixable or is this just a flaw with the threeCSG system...? – treeseal7 Aug 31 '17 at 15:47
  • 1
    To fix it you would have to replace the big triangle with three smaller triangles that use the vertices on the long edge. Note the same problem is occurring around the rectangular indentation. – WestLangley Aug 31 '17 at 16:06
  • ok.. so firstly I need to come up with a way of identifying those larger faces in the geometry, then i need come up with a way replacing them with the correct faces.. is that right? I'll give it a go i guess... Unless someone has already done something like this? – treeseal7 Aug 31 '17 at 16:17
  • 4
    three.js is a rendering engine, not a modeling tool. Build or edit your model outside of three.js and import it. – WestLangley Aug 31 '17 at 16:22