@@ -64,7 +64,8 @@ OrientedBoundingBox ComputeMinimumOBBJylanki(const core::Tensor& points_,
6464 utility::LogError (" Input point set has less than 4 points." );
6565 return OrientedBoundingBox ();
6666 }
67- PointCloud pcd (points_);
67+ // copy to CPU here
68+ PointCloud pcd (points_.To (core::Device ()));
6869 auto hull_mesh = pcd.ComputeConvexHull (robust);
6970 if (hull_mesh.GetVertexPositions ().NumElements () == 0 ) {
7071 utility::LogError (" Failed to compute convex hull." );
@@ -1239,7 +1240,7 @@ OrientedBoundingBox ComputeMinimumOBBJylanki(const core::Tensor& points_,
12391240 min_obb.R_ .col (2 ) = -min_obb.R_ .col (2 );
12401241 }
12411242 mapOBBToClosestIdentity (min_obb);
1242- return static_cast <OrientedBoundingBox>(min_obb);
1243+ return static_cast <OrientedBoundingBox>(min_obb). To (points_. GetDevice ()) ;
12431244}
12441245
12451246OrientedBoundingBox ComputeMinimumOBBApprox (const core::Tensor& points,
@@ -1254,7 +1255,8 @@ OrientedBoundingBox ComputeMinimumOBBApprox(const core::Tensor& points,
12541255 return OrientedBoundingBox ();
12551256 }
12561257
1257- PointCloud pcd (points);
1258+ // copy to cpu here
1259+ PointCloud pcd (points.To (core::Device ()));
12581260 auto hull_mesh = pcd.ComputeConvexHull (robust);
12591261 if (hull_mesh.GetVertexPositions ().NumElements () == 0 ) {
12601262 utility::LogError (" Failed to compute convex hull." );
@@ -1305,10 +1307,11 @@ OrientedBoundingBox ComputeMinimumOBBApprox(const core::Tensor& points,
13051307 min_box.Rotate (rot, center);
13061308 }
13071309 }
1310+ auto device = points.GetDevice ();
13081311 auto dtype = points.GetDtype ();
1309- return OrientedBoundingBox (min_box.GetCenter ().To (dtype),
1310- min_box.GetRotation ().To (dtype),
1311- min_box.GetExtent ().To (dtype));
1312+ return OrientedBoundingBox (min_box.GetCenter ().To (device, dtype),
1313+ min_box.GetRotation ().To (device, dtype),
1314+ min_box.GetExtent ().To (device, dtype));
13121315}
13131316
13141317} // namespace minimum_obb
0 commit comments