Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function createEdges(geometry: THREE.Geometry, material: THREE.Material, maxAngle?: number) {
const obj = new THREE.Object3D();
if (!maxAngle) return obj;
const edges = new THREE.EdgesGeometry(geometry, maxAngle);
const edgeData = edges.attributes.position.array as number[];
const points = chunk(chunk(edgeData, 3).map(p => new THREE.Vector3(...p)), 2);
for (const edge of points) {
const curve = new THREE.LineCurve3(edge[0], edge[1]);
const geometry = new THREE.TubeGeometry(curve, 1, LINE_RADIUS, LINE_SEGMENTS);
obj.add(new THREE.Mesh(geometry, material));
}
return obj;
}