How to judge and prevent the intersection of lines

Yeah, my coordinates for the vertices is wrong(https://discourse.threejs.org/t/non-simple-self-intersecting-polygon-troubles/8951), but i did it on purpose, because my idea is when draw lines and happen intersection, how to prevent mouse click this wrong coordinate of vertices(picture 1). Can you give me some Help? Thanks!

This is my code:
{
Plane2Entity.prototype.setGeometry = function (vertices) {

this.entity.clear();
let points = vertices.map(obj => new THREE.Vector2(obj.x, obj.z));
let shape = new THREE.Shape(points);
this._geometry = new THREE.ExtrudeGeometry(shape, { 'depth': 0.1, bevelEnabled: false});
//console.log(this._geometry);
this._geometry.rotateX(Math.PI / 2);
// edge
this._edgeGeo = new THREE.EdgesGeometry(this._geometry);
this._edge = new THREE.LineSegments(this._edgeGeo, this._lineMaterial);
// mesh
this._mesh = new THREE.Mesh(this._geometry, this._meshMaterial);
// points
this._points = new THREE.Points(this._geometry, this._pointMaterial);
this.entity.add(this._edge);
this.entity.add(this._mesh);
this.entity.add(this._points);

}
}