function connectPointsWithLines( points, target = null ) {

	if ( target === null ) {

		target = new Array( points.length ).fill( null ).map( () => new THREE.Line3() );

	}

	return points.map( ( p, i ) => {

		const nextP = points[ ( i + 1 ) % points.length ];
		const line = target[ i ];
		line.start.copy( p );
		line.end.copy( nextP );
		return line;

	} );

}
Given a list of points representing a polygon, produce a list of line segments of that polygon.

@param {Array<THREE.Vector3>} points
@param {Array<THREE.Line3> | null} target Array of the same length as `points` of lines to write to
@returns {Array<THREE.Line3>}