Skip to content

BoundingBoxer always returns an Inifinity to minus Infinity box #624

@AlexGnatko

Description

@AlexGnatko

Describe the bug 📝

Here's what I do:

                const items = await IfcViewer.model.getItemsOfCategories([new RegExp(`^IFCSLAB$`)]);
                const localIds = Object.values(items).flat();

                const boxer = components.get(OBC.BoundingBoxer);

                const effectiveIds = localIds.slice(0, 1);
                console.log("SLAB IDS", localIds, items, effectiveIds);

                const modelIdMap = { [IfcViewer.modelId]: new Set(effectiveIds) };
                boxer.list.clear();
                await boxer.addFromModelIdMap(modelIdMap);
                const bbox = boxer.get();
                this.bbox = bbox;
                console.log("FOUND BBOX", bbox);
                boxer.list.clear();
                console.log("BOX", await IfcViewer.model.getBoxes(effectiveIds));

This code is called in a timeout, so when it's executed, the model is already loaded and is shown on the screen.

However, the "FOUND BOX" console message returns this:

{
  "isBox3": true,
  "max": {
    "x": null, /* Shows as "-Infinity" */
    "y": null, /* Shows as "-Infinity" */
    "z": null /* Shows as "-Infinity" */
  },
  "min": {
    "x": null, /* Shows as "Infinity" */
    "y": null, /* Shows as "Infinity" */
    "z": null /* Shows as "Infinity" */
  }
}

The subsequent "BOX" message is the result of a direct call to getBoxes on that one single slab that's sent to the BoundingBoxer:

[
  {
    "isBox3": true,
    "min": {
      "x": -9.137995601882935,
      "y": 1.7325699970197677,
      "z": -6.1609653794288635
    },
    "max": {
      "x": -6.0984843981170656,
      "y": 1.8825700029802321,
      "z": -4.626434620571136
    }
  }
]

No matter what I do and what object categories I try, I always get the Infinity. Is it really working? Or is it supposed to be like that? I'm using versions 3.1 of everything.

Reproduction ▶️

No response

Steps to reproduce 🔢

Run any example of the BoundingBoxer on an IFC model (loaded with FRAGS.FragmentsModels) and try getting a bounding box, see if it's not Infinity.

System Info 💻

Windows 10, Firefox

Used Package Manager 📦

npm

Error Trace/Logs 📃

No response

Validations ✅

  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Make sure this is a repository issue and not a framework-specific issue. For example, if it's a THREE.js related bug, it should likely be reported to mrdoob/threejs instead.
  • Check that this is a concrete bug. For Q&A join our Community.
  • The provided reproduction is a minimal reproducible example of the bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions