Visitar URL original
Viewpoint / BCFTopics: BCF clipping planes are dropped by create(data) and load(), and clip the wrong half when they are made · Issue #863 · ThatOpen/engine_components · GitHub
Skip to content

Viewpoint / BCFTopics: BCF clipping planes are dropped by create(data) and load(), and clip the wrong half when they are made #863

Open

Description

@BiroBotond0

Describe the bug 📝

A BCF clipping plane never reaches the scene through Viewpoints.create(data) or BCFTopics.load, and when one is made through set(), the opposite half of the model is cut off.

Image

A BCF 3.0 file with one clipping plane (IFC Z = 7.5 m, direction up: the part above is cut off), imported. Left: the building cut through its windows. Right: BCFTopics.load + go(), no clipping plane.

Image

The same plane given to set() on a viewpoint that has a world. Left: the part above the plane is cut off. Right: the part below.

  • Dropped: set() creates clipping planes only when the viewpoint has a world. Viewpoints.create(data) runs set() in the constructor and gives the world only after it, and BCFTopics.load creates its viewpoints with new Viewpoint(components, data) and never gives them a world, even when Viewpoints.world is set. (Viewpoint.go() does nothing, silently, when the viewpoint has no world #842 describes the missing world for go(); the error fix(viewpoints): throw a clear error when go() has no world #843 adds would then fire for every imported viewpoint.)
  • Inverted: the Viewpoint docs say the direction "points in the invisible direction meaning the half-space that is clipped", as BCF does. set() passes it to Clipper.createFromNormalAndCoplanarPoint as the normal, and a Clipper plane keeps the half its normal points to (the Clipper's own create() negates the face normal for that). toJSON() writes the normal back as the direction, so a round trip inside That Open matches, but every plane exchanged with another BCF tool clips the opposite half.
  • Unread: load reads Location.x / Direction.x, but BCF-XML has <Location><X>…, and BCFTopics.xmlParser keeps the tag names, so every coordinate is undefined.
  • Title (same method): set(data) runs this.title = data.title, so a set() without a title clears it, although the docs say the properties not given remain unchanged.

Writing the planes to .bcfv on export is listed in #825.

Expected: create(data) and load give the viewpoint its world before set() (or set() makes the planes once a world is given); the plane's normal is the opposite of the BCF direction (and toJSON() writes the opposite of the normal); load reads Location.X / .Y / .Z and the same for Direction; set() keeps the title when data.title is undefined.

Where in the code

Reproduction ▶️

https://github.com/BiroBotond0/thatopen-bcf-bug-reproduction/tree/main/issue-7

Steps to reproduce 🔢

  1. In the repro: npm install, npm run dev, open issue-7/example.html. Both worlds load buildingSMART's Architectural.ifc and look through its "Perspective camera" test case. buildingSMART has no BCF 2.1 or 3.0 test case with a clipping plane, so the example builds a BCF 3.0 file with one (Download the .bcfzip saves it).
  2. Import the file (BCFTopics.load) imports it on the right with go() (first picture).
  3. set() on a viewpoint with a world gives the same plane to set() (second picture). Its location is moved by the base coordination matrix by hand, see Viewpoint: clipping planes and the position setter ignore the base coordination matrix #862 , so only the direction differs.
  4. The panel's Results (the imported viewpoint, what load reads of the plane, and the title after a set() without one):
BUG imported viewpoint has a world: got false, expected true
BUG imported viewpoint's clipping planes: got 0, expected 1
BUG Location.x, what load() reads: got undefined, expected 6
BUG title after set() without a title: got null, expected "Level 2"

System Info 💻

System:
    OS: Windows 11 10.0.26200
    CPU: (16) x64 Intel(R) Core(TM) i9-10885H CPU @ 2.40GHz
    Memory: 33.34 GB / 63.76 GB
  Binaries:
    Node: 22.22.1 - C:\nvm4w\nodejs\node.EXE
    npm: 11.12.0 - C:\nvm4w\nodejs\npm.CMD
  Browsers:
    Chrome: 156.0.8078.48
    Edge: Chromium (152.0.4191.53)
  npmPackages:
    @thatopen/components: 3.6.0 => 3.6.0
    @thatopen/components-front: 3.6.0 => 3.6.0
    @thatopen/fragments: 3.6.0 => 3.6.0
    @thatopen/ui: 3.4.17 => 3.4.17
    camera-controls: 3.1.2 => 3.1.2
    three: 0.184.0 => 0.184.0
    web-ifc: 0.0.77 => 0.0.77

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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