From 1a38b763a488d11eb93eef0d0695dd52efc87e1b Mon Sep 17 00:00:00 2001 From: Marco Hutter Date: Sat, 16 Nov 2024 15:35:29 +0100 Subject: [PATCH] Specs for stricter array length checks --- .../gpm/covarUpperTriangleInvalidLengthB.json | 261 ++++++++++++++++++ .../anchorPointsDirectInvalidLength.gltf | 22 ++ .../anchorPointsIndirectInvalidLength.gltf | 48 ++++ ...DirectUpperTriangleElementInvalidType.gltf | 35 +++ ...DirectUpperTriangleInconsistentLength.gltf | 34 +++ ...ianceDirectUpperTriangleInvalidLength.gltf | 28 ++ specs/extensions/NgaGpmValidatorSpec.ts | 8 + .../NgaGpmLocalValidationSpec.ts | 40 +++ 8 files changed, 476 insertions(+) create mode 100644 specs/data/extensions/gpm/covarUpperTriangleInvalidLengthB.json create mode 100644 specs/data/gltfExtensions/gpmLocal/anchorPointsDirectInvalidLength.gltf create mode 100644 specs/data/gltfExtensions/gpmLocal/anchorPointsIndirectInvalidLength.gltf create mode 100644 specs/data/gltfExtensions/gpmLocal/covarianceDirectUpperTriangleElementInvalidType.gltf create mode 100644 specs/data/gltfExtensions/gpmLocal/covarianceDirectUpperTriangleInconsistentLength.gltf create mode 100644 specs/data/gltfExtensions/gpmLocal/covarianceDirectUpperTriangleInvalidLength.gltf diff --git a/specs/data/extensions/gpm/covarUpperTriangleInvalidLengthB.json b/specs/data/extensions/gpm/covarUpperTriangleInvalidLengthB.json new file mode 100644 index 00000000..54ea645f --- /dev/null +++ b/specs/data/extensions/gpm/covarUpperTriangleInvalidLengthB.json @@ -0,0 +1,261 @@ +{ + "asset": { + "version": "1.1" + }, + "geometricError": 2, + "root": { + "refine": "REPLACE", + "boundingVolume": { + "box": [ + 0.5, + 0.5, + 0.5, + 0.5, + 0, + 0, + 0, + 0.5, + 0, + 0, + 0, + 0.5 + ] + }, + "geometricError": 1 + }, + "extensionsUsed": [ + "NGA_gpm" + ], + "extensions": { + "NGA_gpm": { + "masterRecord": { + "version": "1.2i", + "implementation": "Example", + "modelCoordSystem": { + "mcsType": "UTM", + "crsHorizontalUtm": { + "id": 32601 + }, + "crsVertical": { + "name": "Example Reference System", + "orgWithId": { + "organization": "EPSG", + "systemId": "Example System ID" + }, + "epoch": 1 + } + }, + "idInformation": { + "datasetId": "exportid", + "referenceDateTime": "2024-04-29T11:21:49" + }, + "datasetExtentInformation": { + "origin": [ + 912996.5952063048, + -5541794.593278977, + 3012483.770173006 + ], + "lsrAxisUnitVectors": [ + [ + -0.0743933049314506, + 0.4697008438610212, + 0.8796855992100931 + ], + [ + 0.9868514414437406, + 0.16160517449656872, + -0.0028284441562802663 + ], + [ + -0.14303538712009903, + 0.8682099573522005, + -0.47513403160149825 + ] + ], + "lsrLengths": [ + 5984.896982990946, + 6337.485178905554, + 99.99999999975178 + ] + }, + "collectionRecordList": [ + { + "collectionId": "collection id", + "platformId": "platform id", + "sensorRecords": [ + { + "sensorId": "sensorid", + "sensorType": "sensortype", + "sensorMode": "sensormode", + "collectionUnitRecords": [ + { + "referenceDateTime": "2024-04-29T11:21:49", + "collectionUnitId": "cuid", + "pointSourceId": 0, + "extentInformation": { + "origin": [ + 912996.5952063048, + -5541794.593278977, + 3012483.770173006 + ], + "lsrAxisUnitVectors": [ + [ + -0.0743933049314506, + 0.4697008438610212, + 0.8796855992100931 + ], + [ + 0.9868514414437406, + 0.16160517449656872, + -0.0028284441562802663 + ], + [ + -0.14303538712009903, + 0.8682099573522005, + -0.47513403160149825 + ] + ], + "lsrLengths": [ + 5984.896982990946, + 6337.485178905554, + 99.99999999975178 + ] + } + } + ] + } + ] + } + ] + }, + "unmodeledErrorRecord": { + "uniqueId": "unmodeled_error", + "corrRotationThetas": [ + 0, + 0, + 0 + ], + "corrParams": [ + { + "A": 1, + "alpha": 0.99, + "beta": 0, + "T": 10000 + }, + { + "A": 1, + "alpha": 0.99, + "beta": 0, + "T": 10000 + }, + { + "A": 1, + "alpha": 0.99, + "beta": 0, + "T": 10000 + } + ], + "posts": [ + { + "position": [ + 12.34, + 23.45, + 34.56 + ], + "covariance": [ + 0.1833647900304413, + -0.093582914309524, + 0.0572007221435672, + -0.18392374133036396, + 0.27486040919852534, + 0.1, + 0.2 + ] + } + ] + }, + "interpolationParams": { + "interpolationMode": "IDW", + "interpNumPosts": 6, + "dampeningParam": 250 + }, + "interTileCorrelationGroups": [ + { + "groupFlags": [ + true, + true, + true + ], + "rotationThetas": [ + 0, + 0, + 0 + ], + "params": [ + { + "A": 1, + "alpha": 0.99, + "beta": 0, + "T": 10000 + }, + { + "A": 1, + "alpha": 0.99, + "beta": 0, + "T": 10000 + }, + { + "A": 1, + "alpha": 0.99, + "beta": 0, + "T": 10000 + } + ] + } + ], + "ppeManifest": [ + { + "source": "SIGZ" + }, + { + "source": "SIGR" + } + ], + "threeDimConformalParams": { + "flags": [ + true, + false, + true, + false, + true, + false, + true + ], + "recentering": [ + 1.2, + 2.3, + 3.4 + ], + "normalizingScaleFactor": 1.2, + "parameters": [ + 0, + 1, + 2, + 3 + ], + "covariance": [ + 0.1, + 0.2, + 0.3, + 0.4, + 0.5, + 0.6, + 0.7, + 0.8, + 0.9, + 1 + ] + } + } + } +} \ No newline at end of file diff --git a/specs/data/gltfExtensions/gpmLocal/anchorPointsDirectInvalidLength.gltf b/specs/data/gltfExtensions/gpmLocal/anchorPointsDirectInvalidLength.gltf new file mode 100644 index 00000000..600cfa8d --- /dev/null +++ b/specs/data/gltfExtensions/gpmLocal/anchorPointsDirectInvalidLength.gltf @@ -0,0 +1,22 @@ +{ + "asset" : { + "version" : "2.0" + }, + "extensionsUsed" : [ + "NGA_gpm_local" + ], + "extensions" : { + "NGA_gpm_local" : { + "storageType" : "Direct", + "anchorPointsDirect" : [], + "covarianceDirectUpperTriangle" : [ + 0.1833647900304413, + -0.093582914309524, + 0.4550734755685732, + 0.0572007221435672, + -0.18392374133036396, + 0.27486040919852534 + ] + } + } +} \ No newline at end of file diff --git a/specs/data/gltfExtensions/gpmLocal/anchorPointsIndirectInvalidLength.gltf b/specs/data/gltfExtensions/gpmLocal/anchorPointsIndirectInvalidLength.gltf new file mode 100644 index 00000000..c5e568c7 --- /dev/null +++ b/specs/data/gltfExtensions/gpmLocal/anchorPointsIndirectInvalidLength.gltf @@ -0,0 +1,48 @@ +{ + "asset" : { + "version" : "2.0" + }, + "extensionsUsed" : [ + "NGA_gpm_local" + ], + "extensions" : { + "NGA_gpm_local" : { + "storageType" : "Indirect", + "anchorPointsIndirect" : [], + "intraTileCorrelationGroups" : [ + { + "groupFlags" : [ + true, + true, + true + ], + "rotationThetas" : [ + 0.1, + 0.2, + 0.3 + ], + "params" : [ + { + "A" : 1.0, + "alpha" : 0.99, + "beta" : 0.0, + "T" : 10000.0 + }, + { + "A" : 1.0, + "alpha" : 0.99, + "beta" : 0.0, + "T" : 10000.0 + }, + { + "A" : 1.0, + "alpha" : 0.99, + "beta" : 0.0, + "T" : 10000.0 + } + ] + } + ] + } + } +} \ No newline at end of file diff --git a/specs/data/gltfExtensions/gpmLocal/covarianceDirectUpperTriangleElementInvalidType.gltf b/specs/data/gltfExtensions/gpmLocal/covarianceDirectUpperTriangleElementInvalidType.gltf new file mode 100644 index 00000000..61f2384c --- /dev/null +++ b/specs/data/gltfExtensions/gpmLocal/covarianceDirectUpperTriangleElementInvalidType.gltf @@ -0,0 +1,35 @@ +{ + "asset" : { + "version" : "2.0" + }, + "extensionsUsed" : [ + "NGA_gpm_local" + ], + "extensions" : { + "NGA_gpm_local" : { + "storageType" : "Direct", + "anchorPointsDirect" : [ + { + "position" : [ + 12.34, + 23.45, + 34.56 + ], + "adjustmentParams" : [ + 0.1, + 0.2, + 0.3 + ] + } + ], + "covarianceDirectUpperTriangle" : [ + 0.1833647900304413, + "NOT_A_NUMBER", + 0.4550734755685732, + 0.0572007221435672, + -0.18392374133036396, + 0.27486040919852534 + ] + } + } +} \ No newline at end of file diff --git a/specs/data/gltfExtensions/gpmLocal/covarianceDirectUpperTriangleInconsistentLength.gltf b/specs/data/gltfExtensions/gpmLocal/covarianceDirectUpperTriangleInconsistentLength.gltf new file mode 100644 index 00000000..b9108167 --- /dev/null +++ b/specs/data/gltfExtensions/gpmLocal/covarianceDirectUpperTriangleInconsistentLength.gltf @@ -0,0 +1,34 @@ +{ + "asset" : { + "version" : "2.0" + }, + "extensionsUsed" : [ + "NGA_gpm_local" + ], + "extensions" : { + "NGA_gpm_local" : { + "storageType" : "Direct", + "anchorPointsDirect" : [ + { + "position" : [ + 12.34, + 23.45, + 34.56 + ], + "adjustmentParams" : [ + 0.1, + 0.2, + 0.3 + ] + } + ], + "covarianceDirectUpperTriangle" : [ + 0.1833647900304413, + 0.4550734755685732, + 0.0572007221435672, + -0.18392374133036396, + 0.27486040919852534 + ] + } + } +} \ No newline at end of file diff --git a/specs/data/gltfExtensions/gpmLocal/covarianceDirectUpperTriangleInvalidLength.gltf b/specs/data/gltfExtensions/gpmLocal/covarianceDirectUpperTriangleInvalidLength.gltf new file mode 100644 index 00000000..b2ca8913 --- /dev/null +++ b/specs/data/gltfExtensions/gpmLocal/covarianceDirectUpperTriangleInvalidLength.gltf @@ -0,0 +1,28 @@ +{ + "asset" : { + "version" : "2.0" + }, + "extensionsUsed" : [ + "NGA_gpm_local" + ], + "extensions" : { + "NGA_gpm_local" : { + "storageType" : "Direct", + "anchorPointsDirect" : [ + { + "position" : [ + 12.34, + 23.45, + 34.56 + ], + "adjustmentParams" : [ + 0.1, + 0.2, + 0.3 + ] + } + ], + "covarianceDirectUpperTriangle" : [] + } + } +} \ No newline at end of file diff --git a/specs/extensions/NgaGpmValidatorSpec.ts b/specs/extensions/NgaGpmValidatorSpec.ts index e416df2d..037c71fe 100644 --- a/specs/extensions/NgaGpmValidatorSpec.ts +++ b/specs/extensions/NgaGpmValidatorSpec.ts @@ -1084,6 +1084,14 @@ describe("Tileset NGA_gpm extension validation", function () { expect(result.get(0).type).toEqual("ARRAY_LENGTH_MISMATCH"); }); + it("detects issues in covarUpperTriangleInvalidLengthB", async function () { + const result = await Validators.validateTilesetFile( + "specs/data/extensions/gpm/covarUpperTriangleInvalidLengthB.json" + ); + expect(result.length).toEqual(1); + expect(result.get(0).type).toEqual("ARRAY_LENGTH_MISMATCH"); + }); + it("detects issues in interpolationParamsDampeningParamInvalidType", async function () { const result = await Validators.validateTilesetFile( "specs/data/extensions/gpm/interpolationParamsDampeningParamInvalidType.json" diff --git a/specs/gltfExtensions/NgaGpmLocalValidationSpec.ts b/specs/gltfExtensions/NgaGpmLocalValidationSpec.ts index 314049f6..ad129216 100644 --- a/specs/gltfExtensions/NgaGpmLocalValidationSpec.ts +++ b/specs/gltfExtensions/NgaGpmLocalValidationSpec.ts @@ -161,6 +161,14 @@ describe("NGA_gpm_local extension validation", function () { expect(result.get(0).type).toEqual("ARRAY_ELEMENT_TYPE_MISMATCH"); }); + it("detects issues in anchorPointsDirectInvalidLength", async function () { + const result = await validateGltf( + "./specs/data/gltfExtensions/gpmLocal/anchorPointsDirectInvalidLength.gltf" + ); + expect(result.length).toEqual(1); + expect(result.get(0).type).toEqual("ARRAY_LENGTH_MISMATCH"); + }); + it("detects issues in anchorPointsDirectInvalidType", async function () { const result = await validateGltf( "./specs/data/gltfExtensions/gpmLocal/anchorPointsDirectInvalidType.gltf" @@ -177,6 +185,14 @@ describe("NGA_gpm_local extension validation", function () { expect(result.get(0).type).toEqual("ARRAY_ELEMENT_TYPE_MISMATCH"); }); + it("detects issues in anchorPointsIndirectInvalidLength", async function () { + const result = await validateGltf( + "./specs/data/gltfExtensions/gpmLocal/anchorPointsIndirectInvalidLength.gltf" + ); + expect(result.length).toEqual(1); + expect(result.get(0).type).toEqual("ARRAY_LENGTH_MISMATCH"); + }); + it("detects issues in anchorPointsIndirectInvalidType", async function () { const result = await validateGltf( "./specs/data/gltfExtensions/gpmLocal/anchorPointsIndirectInvalidType.gltf" @@ -281,6 +297,30 @@ describe("NGA_gpm_local extension validation", function () { expect(result.get(0).type).toEqual("PROPERTY_MISSING"); }); + it("detects issues in covarianceDirectUpperTriangleInconsistentLength", async function () { + const result = await validateGltf( + "./specs/data/gltfExtensions/gpmLocal/covarianceDirectUpperTriangleInconsistentLength.gltf" + ); + expect(result.length).toEqual(1); + expect(result.get(0).type).toEqual("ARRAY_LENGTH_INCONSISTENT"); + }); + + it("detects issues in covarianceDirectUpperTriangleInvalidLength", async function () { + const result = await validateGltf( + "./specs/data/gltfExtensions/gpmLocal/covarianceDirectUpperTriangleInvalidLength.gltf" + ); + expect(result.length).toEqual(1); + expect(result.get(0).type).toEqual("ARRAY_LENGTH_MISMATCH"); + }); + + it("detects issues in covarianceDirectUpperTriangleElementInvalidType", async function () { + const result = await validateGltf( + "./specs/data/gltfExtensions/gpmLocal/covarianceDirectUpperTriangleElementInvalidType.gltf" + ); + expect(result.length).toEqual(1); + expect(result.get(0).type).toEqual("ARRAY_ELEMENT_TYPE_MISMATCH"); + }); + it("detects issues in directAnchorPointsDirectMissing", async function () { const result = await validateGltf( "./specs/data/gltfExtensions/gpmLocal/directAnchorPointsDirectMissing.gltf"