Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IEdgeControl

A control point that is attached to an edge between two points. The control point is defined by the indices of the two points and a direction vector.

The control sits at the midpoint of the edge and can only be dragged along the given direction. When dragged, both point1 and point2 are shifted by the same delta (symmetric displacement).

Hierarchy

Index

Properties

direction: vec3

Drag direction in the DT's local space. The direction does not need to be perpendicular to the edge; any direction is permitted. The actual displacement for a given mouse move is determined by the closest-point projection of the mouse ray onto the axis dragStartMidpoint + t * direction.

The direction is updated whenever the edge orientation changes relative to its initial orientation, so that the control's movement remains consistent with the user's drag direction even after rotations.

point1: number

The index of the first point that defines the edge to which this control is attached.

point2: number

The index of the second point that defines the edge to which this control is attached.

position: vec3
type: "edge"

Methods

  • cancel(moveTemporary: MoveTemporaryFn): void
  • Cancel the drag, restoring all affected geometry points to their pre-drag positions.

    Parameters

    • moveTemporary: MoveTemporaryFn

    Returns void

  • end(getPosition: GetPositionFn): void
  • Commit the drag and refresh any derived state from the committed geometry.

    Parameters

    • getPosition: GetPositionFn

    Returns void

  • move(ray: IRay, moveTemporary: MoveTemporaryFn, restrictedPosition?: vec3, applyConstraints?: ApplyConstraintsFn): undefined | vec3
  • Move the control during drag. Returns the updated visual position of the control, or undefined if no movement was possible (e.g. degenerate geometry).

    Parameters

    • ray: IRay
    • moveTemporary: MoveTemporaryFn
    • Optional restrictedPosition: vec3

      Optional pre-computed restriction-constrained position. When provided the control should derive its movement from this world-space point rather than from a raw line-line closest-point computation on the ray.

    • Optional applyConstraints: ApplyConstraintsFn

      Optional constraint evaluator. When provided, edge controls use it to find the tightest valid scalar t before moving both endpoints, guaranteeing they always translate rigidly together.

    Returns undefined | vec3

  • refreshAll(getPosition: GetPositionFn): void
  • Refreshes all derived state from the current geometry (e.g. after undo/redo).

    Parameters

    • getPosition: GetPositionFn

    Returns void

  • refreshForMovedPoint(movedIndex: number, getPosition: GetPositionFn): boolean
  • Called when a single point in the geometry has moved (not during a drag). Returns true if this control was affected and its visual position changed.

    Parameters

    • movedIndex: number
    • getPosition: GetPositionFn

    Returns boolean

  • start(getPosition: GetPositionFn): boolean
  • Begin a drag interaction. Snapshots any required initial state. Returns false if the control cannot be dragged at this time.

    Parameters

    • getPosition: GetPositionFn

    Returns boolean