setFromObject method
Implementation
ConvexHull setFromObject(Object3D object) {
List<Vector3> points = [];
object.updateMatrixWorld(true);
object.traverse((node) {
Vector3 point;
final geometry = node.geometry;
if (geometry != null) {
// if (geometry.isGeometry) {
// final vertices = geometry.vertices;
// for (final i = 0, l = vertices.length; i < l; i++) {
// point = vertices[i].clone();
// point.applyMatrix4(node.matrixWorld);
// points.add(point);
// }
// } else
final attribute = geometry.attributes['position'];
if (attribute != null) {
for (int i = 0, l = attribute.count; i < l; i++) {
point = Vector3();
point.fromBuffer(attribute, i).applyMatrix4(node.matrixWorld);
points.add(point);
}
}
}
});
return setFromPoints(points);
}