Removing a line from LineSegments

Hello guys and girls

I created a mesh using CSG which I want to draw lines around. The way I am doing this is creating the EdgesGeometry of the mesh which then I use to make LineSegments.

This works for me most of the time, but in this case there are two (small) lines that I don’t want. This is because the mesh I create should represent a real world object.

This is the line that I want to remove, which is on both sides of the object.

I’m wondering how I can best go about removing them or make sure that they aren’t created.
I was thinking of iterating over the Float32Array and removing them but that does not seem like a clean way to achieve my goal.

Thanks for your time!

It seems this issue was already discussed at github:

AFAIK, the mentioned lines are visible because of the way EdgesGeometry evaluates edges. The OP shared an enhancement of EdgesGeometry in this post that should solve the issue. Can you please give this code a try?

1 Like

This indeed seems to work perfectly for what I need.
The only problem is that this hits the performance quite a bit as there is a delay of 0.5 seconds or so every time this executes…

The hit on performance is because it prints the warning
“THREE.Line3: .closestPointToPoint() target is now required”

So that’s the cause of the slowed performance, not the code itself.

1 Like

At some point, we need to have a go on EdgesGeometry anyway in order to resolve the dependency to THREE.Geometry. When doing this, it might be a good idea to improve the algorithm so it produces the result promoted at github. Considering the user feedback so far, I think it’s more desirable to have a result without unexpected edges than a fast algorithm.

That’s right, I can see that the unexpected edges has a higher priority over the speed of execution.

It’s just that for my use case it would be wonderful if there was no delay because the rest of the operations using three.js are snappy. (I am creating a commercial configurator).

Edit: But as I said in my previous post: the delay is gone after fixing the warning/error. So I’m very happy with your advice!