From c5c22c54228aef4533a45543da7c557e2ffc7edb Mon Sep 17 00:00:00 2001 From: snkmcb Date: Sun, 13 Sep 2026 01:13:07 +0900 Subject: [PATCH 1/2] fix: validate shared georeference for multi-scan collections --- libs/usd-pointcloud-core/src/PointCloud.cpp | 16 +++++++++++++++- .../tests/test_point_cloud.cpp | 5 +++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/libs/usd-pointcloud-core/src/PointCloud.cpp b/libs/usd-pointcloud-core/src/PointCloud.cpp index 6a4b319..620761c 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()); From 2028a45f1a6fd18024e4d6a7b5f436ed5e732957 Mon Sep 17 00:00:00 2001 From: snkmcb Date: Sun, 13 Sep 2026 01:18:56 +0900 Subject: [PATCH 2/2] style: align multi-scan georeference helper --- libs/usd-pointcloud-core/src/PointCloud.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libs/usd-pointcloud-core/src/PointCloud.cpp b/libs/usd-pointcloud-core/src/PointCloud.cpp index 620761c..9f914b4 100644 --- a/libs/usd-pointcloud-core/src/PointCloud.cpp +++ b/libs/usd-pointcloud-core/src/PointCloud.cpp @@ -158,15 +158,15 @@ namespace { constexpr double kPoseTolerance = 1.0e-9; bool HasSameGeoReference(const usdgeo::GeoReference& first, - const usdgeo::GeoReference& second) { + 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; + 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) {