xeokit-sdk icon indicating copy to clipboard operation
xeokit-sdk copied to clipboard

[FEATURE SUGGESTION] Clip distance measurements to near frustum plane

Open g-rodigy opened this issue 2 years ago • 1 comments

Describe the bug When zoom close to the surface, DistanceMeasurement not shown. It is possible to show all time?

Screenshots dist-zoom

Solution

Implement some 3D clipping within each DistanceMeasurement:

  • after transforming the World-space start and end points of a distance measurement to View-space, split the point-to-point line into four disjoint 3D line segments: one for the point-to-point line, and three for the axis-aligned lines
  • clip each of the four line segments separately against the near plane of the view volume
  • set the 2D HTML distance and axis lines to the projected 2D coordinates of their respective clipped line segments
  • skip whichever of these lines are fully in front of the near frustum plane

g-rodigy avatar Jul 29 '23 20:07 g-rodigy

Fast solution, I change near to -0.05, but don't know is fully correct? https://github.com/xeokit/xeokit-sdk/blob/02576b0be6dec9c4d8fc0f45bd408d4ffc05e449/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js#L288

g-rodigy avatar Nov 19 '23 22:11 g-rodigy