t35-obb-distance.mjs 569 B

12345678
  1. import assert from 'node:assert/strict'
  2. import { Cartesian3, Matrix3, OrientedBoundingBox } from 'cesium'
  3. const box = new OrientedBoundingBox(new Cartesian3(0, 0, 0), Matrix3.fromArray([10, 0, 0, 0, 20, 0, 0, 0, 2]))
  4. assert.equal(Math.sqrt(box.distanceSquaredTo(new Cartesian3(0, 0, 0))), 0)
  5. assert.equal(Math.sqrt(box.distanceSquaredTo(new Cartesian3(30, 0, 0))), 20)
  6. assert.equal(Math.sqrt(box.distanceSquaredTo(new Cartesian3(0, 30, 0))), 10)
  7. assert.equal(Math.sqrt(box.distanceSquaredTo(new Cartesian3(0, 0, 7))), 5)
  8. console.log('T35 OBB distance: 4 cases passed')