xeolabs / xeogl

A WebGL-based 3D engine for technical visualization. Not actively maintained.
http://xeogl.org
Other
1.14k stars 264 forks source link

Uncaught TypeError: math.AABB3 is not a constructor #304

Closed jrozbicki closed 5 years ago

jrozbicki commented 5 years ago

Describe the bug scene.getAABB(array_of_guids) resulting in error

To Reproduce Steps to reproduce the behavior:

  1. invoke scene.getAABB([guid1, guid2, guid3]) (guids are valid)
  2. see error:
    xeogl.js:27937 Uncaught TypeError: math.AABB3 is not a constructor
    at Scene.getAABB (xeogl.js:27937)
    at n.<anonymous> (index.js:135)
    at n.a.emit (inspire-tree.min.js:16)
    at n.r.emit (inspire-tree.min.js:16)
    at c (inspire-tree.min.js:8)
    at t.value (inspire-tree.min.js:16)
    at i (inspire-tree-dom.min.js:8)
    at t.value (inspire-tree-dom.min.js:8)
    at inspire-tree-dom.min.js:8
    at HTMLDocument.o (inspire-tree-dom.min.js:8)
    getAABB @ xeogl.js:27937
    (anonymous) @ index.js:135
    a.emit @ inspire-tree.min.js:16
    r.emit @ inspire-tree.min.js:16
    c @ inspire-tree.min.js:8
    value @ inspire-tree.min.js:16
    i @ inspire-tree-dom.min.js:8
    value @ inspire-tree-dom.min.js:8
    (anonymous) @ inspire-tree-dom.min.js:8
    o @ inspire-tree-dom.min.js:8

Expected behavior Return Float32Array with x,y,z min and max values.

Additional context Invoking scene.getAABB(guid1) (single guid) works just fine.

Possible fix - PR candidate

xeogl.js 
line 27936

if (valid) {
      // const aabb2 = new math.AABB3();          <- current line causing error
      const aabb2 = math.AABB3();                 // <- working solution
      aabb2[0] = xmin;
      aabb2[1] = ymin;
      aabb2[2] = zmin;
      aabb2[3] = xmax;
      aabb2[4] = ymax;
      aabb2[5] = zmax;
      return aabb2;
}