Twin points in shape ?

When I create a shape with a sequence (shape.moveTo ..) and this sequence contains a shape.absarc or shape.arc (haven’t tried splines) a twin point is added before the arc into the Shape definition ?

In this sample the twin point is # 2 (into the console).

I don’t know if it’s a bug since it doesn’t seems to alter following process (such as ShapeGeometry), but shape.extractPoints() retrieves these twin points … and if I reuse the result to build something with THREE.ShapeUtils.triangulateShape() I will get the warning ‘Unable to triangulate..’ .. that’s why I have to add this ugly patch :

	var loops = shape.extractPoints ( settings.curveResol );
	for (var l = 1 ; l < loops.shape.length ; l++) {
		if( Math.abs( loops.shape[l].x - loops.shape[l-1].x ) < 1E-10 && Math.abs( loops.shape[l].y - loops.shape[l-1].y ) < 1E-10 ) loops.shape.splice( l , 1 )
	}

Author: Fantashit

1 thought on “Twin points in shape ?

  1. Just a short update: With the new polygon triangulation algorithm (see #12661) the mentioned warning no longer appears. Will be available with R89. I’m still trying to figure out if it’s possible to avoid the duplicated points.

Comments are closed.