Introduction
See draft PR #13531 which introduces a basic client-side snapping API based on EXT_mesh_primitive_edge_visibility (KhronosGroup/glTF#2479).
See this documentation for all the snap modes in MicroStation.
In this issue we enumerate some of these modes and offer thoughts on ways to implement them client-side.
Nearest
Nearest: Tentative point snaps to point on the element nearest to the pointer.
The above draft PR in CesiumJS enables Nearest mode.
Keypoint
Keypoint: Tentative point snaps to the nearest of the Element keypoints on the element. This is the most generally useful of the snap modes.
To achieve this, could we utilize BENTLEY_materials_line_style (CesiumGS/glTF#89) which encodes a cumulative distance value?
From that spec:
BENTLEY_materials_line_style:CUMULATIVE_DISTANCE
This attribute provides a per-vertex cumulative distance from the start of the line string, expressed in model/world units. Implementations use this distance to align the dash pattern consistently along the full line string.
By having this property available, when we snap to an edge, we could have a sense how far we are from the origin of the edge's line string. Then, could we do some math to figure out if one of the keypoints is within view and able to be snapped to? Tricky thing to figure out is the aperture of the snap. The keypoints to snap to could be rather far from the cursor. Needs more brainstorming.
Midpoint
Midpoint: Tentative point snaps to midpoint of the segment of the element closest to the pointer.
This seems trickier because, even with BENTLEY_materials_line_style:CUMULATIVE_DISTANCE we do not have reliable information on how far along a segment a particular pixel is when we do our sample. Cumulative distance is for the entire line string, not a segment. It's possible we could consider encoding segment information.
Origin
Origin: Tentative point snaps to origin of a cell or text, centroid of a B-spline, the first data point in a dimension element, or the first vertex of a line, multi-line, line string, or shape.
This seems like basically a slightly tweaked implementation of Keypoint, described above. Same concerns and caveats hold.
Bisector
Bisector: Tentative point snaps to midpoint of an entire line string, multi-line, or complex chain, rather than to the midpoint of the closest segment. It also snaps to the midpoint of a line or arc.
Like Origin this seems like a slightly tweaked implementation of Keypoint. Same concerns and caveats hold.
AI acknowledgment
Introduction
See draft PR #13531 which introduces a basic client-side snapping API based on
EXT_mesh_primitive_edge_visibility(KhronosGroup/glTF#2479).See this documentation for all the snap modes in MicroStation.
In this issue we enumerate some of these modes and offer thoughts on ways to implement them client-side.
Nearest
Nearest: Tentative point snaps to point on the element nearest to the pointer.The above draft PR in CesiumJS enables
Nearestmode.Keypoint
Keypoint: Tentative point snaps to the nearest of the Element keypoints on the element. This is the most generally useful of the snap modes.To achieve this, could we utilize
BENTLEY_materials_line_style(CesiumGS/glTF#89) which encodes a cumulative distance value?From that spec:
By having this property available, when we snap to an edge, we could have a sense how far we are from the origin of the edge's line string. Then, could we do some math to figure out if one of the keypoints is within view and able to be snapped to? Tricky thing to figure out is the aperture of the snap. The keypoints to snap to could be rather far from the cursor. Needs more brainstorming.
Midpoint
Midpoint: Tentative point snaps to midpoint of the segment of the element closest to the pointer.This seems trickier because, even with
BENTLEY_materials_line_style:CUMULATIVE_DISTANCEwe do not have reliable information on how far along a segment a particular pixel is when we do our sample. Cumulative distance is for the entire line string, not a segment. It's possible we could consider encoding segment information.Origin
Origin: Tentative point snaps to origin of a cell or text, centroid of a B-spline, the first data point in a dimension element, or the first vertex of a line, multi-line, line string, or shape.This seems like basically a slightly tweaked implementation of
Keypoint, described above. Same concerns and caveats hold.Bisector
Bisector: Tentative point snaps to midpoint of an entire line string, multi-line, or complex chain, rather than to the midpoint of the closest segment. It also snaps to the midpoint of a line or arc.Like
Originthis seems like a slightly tweaked implementation ofKeypoint. Same concerns and caveats hold.AI acknowledgment