diff --git a/libs/usd-pointcloud-core/src/PointCloud.cpp b/libs/usd-pointcloud-core/src/PointCloud.cpp index 6a4b319..9f914b4 100644 --- a/libs/usd-pointcloud-core/src/PointCloud.cpp +++ b/libs/usd-pointcloud-core/src/PointCloud.cpp @@ -157,6 +157,18 @@ namespace { constexpr double kPoseTolerance = 1.0e-9; +bool HasSameGeoReference(const usdgeo::GeoReference& first, + const usdgeo::GeoReference& second) { + return first.epsgCode == second.epsgCode && first.wkt == second.wkt && + first.projJson == second.projJson && + first.linearUnit == second.linearUnit && + first.sourceUpAxis == second.sourceUpAxis && + first.stageUpAxis == second.stageUpAxis && + first.localOrigin.x == second.localOrigin.x && + first.localOrigin.y == second.localOrigin.y && + first.localOrigin.z == second.localOrigin.z; +} + bool IsRigidPose(const std::array& pose) { if (!std::all_of(pose.begin(), pose.end(), [](double value) { return std::isfinite(value); }) || @@ -252,7 +264,9 @@ bool PointCloudCollection::IsValid() const noexcept { } std::set ids; for (const auto& scan : scans) { - if (!scan.IsValid() || !ids.insert(scan.id).second || + if (!scan.IsValid() || + !HasSameGeoReference(reference, scan.asset.reference) || + !ids.insert(scan.id).second || !ContainsTransformedBounds(bounds, scan)) { return false; } diff --git a/libs/usd-pointcloud-core/tests/test_point_cloud.cpp b/libs/usd-pointcloud-core/tests/test_point_cloud.cpp index 3beae03..50fec45 100644 --- a/libs/usd-pointcloud-core/tests/test_point_cloud.cpp +++ b/libs/usd-pointcloud-core/tests/test_point_cloud.cpp @@ -99,6 +99,11 @@ void TestMultiScanContract() { collection.bounds.maximum.x = 5.0; Check(collection.IsValid()); + second.asset.reference.epsgCode = 4979; + collection.scans[1] = second; + Check(!collection.IsValid()); + + second.asset.reference = reference; second.id = first.id; collection.scans[1] = second; Check(!collection.IsValid());