xeokit / xeokit-sdk

Open source JavaScript SDK for viewing high-detail, full-precision 3D BIM and AEC models in the Web browser.
https://xeokit.io
Other
728 stars 288 forks source link

Section planes are not parallel to the clicked surface #523

Closed Amoki closed 1 year ago

Amoki commented 3 years ago
var pickResult = viewer.scene.pick({
  canvasPos: coords,
  pickSurface: true  // <<------ This causes picking to find the intersection point on the entity
});
if (pickResult) {
  const sectionPlane = sectionPlanes.createSectionPlane({
    pos: pickResult.worldPos,
    dir: math.mulVec3Scalar(pickResult.worldNormal, -1)
  });
}

If the picked surface is not axis-aligned, the section place is not parallel to the surface.

Capture d’écran de 2021-01-07 17-44-52

On ortho from above, it's easier to see: Capture d’écran de 2021-01-08 12-52-52

To Reproduce It also appears on xeokit's example https://xeokit.github.io/xeokit-sdk/examples/#gizmos_SectionPlanesPlugin_createWithMouse Capture d’écran de 2021-01-07 17-45-54

It was hard to find a non-axis-aligned surface on this model. The section is on the railing.

The problem is the same withe xkt v6 and xkt v3

Expected behavior The section to be strictly parallel to the picked surface

Kurtil commented 1 year ago

@xeolabs, the 32 bits normal encoding merged PR fixed this issue.