-
Notifications
You must be signed in to change notification settings - Fork 1
draw trajectory box
senso edited this page Jun 22, 2026
·
2 revisions
#example #drawing #mouse #persistence #settings #control #graphics #advanced
Trajectory drawing with bezier curves and chunk persistence.
| Module Name | draw trajectory |
| Type | mtControl |
| Color | clInterfaceDesignModuleColor |
| Version | 2.21 |
| Source | examples/DrawTrajectoryBox/ |
Draw complex trajectories/paths on a canvas by clicking and dragging. Supports smooth quadratic bezier curves, cursor-based interpolation along the path, Lissajous pattern generation, and full chunk-based persistence.
| # | Name | Type | I/O | Details | Callback |
|---|---|---|---|---|---|
| 0 | nbpoints |
ptDataField |
Output (ReadOnly) | Number of trajectory points | None |
| 1 | cursor pos |
ptDataField |
Input (IsStoredInPreset) | Position along path (0–1) | ctImmediate |
| 2 | pos X |
ptDataFader |
Output (ReadOnly) | Interpolated X coordinate | None |
| 3 | pos Y |
ptDataFader |
Output (ReadOnly) | Interpolated Y coordinate | None |
| 4 | reset |
ptButton |
Input | Clear trajectory | ctImmediate |
| 5 | randomize |
ptButton |
Input | Generate Lissajous curve | ctImmediate |
| 6 | coords in |
ptArray |
Input (DontSave) | Import trajectory data | ctImmediate |
| 7 | coords out |
ptArray |
Output (DontSave) | Export trajectory data | ctImmediate |
- Drawing: Mouse down starts recording, mouse move appends points (with minimum pixel distance threshold), mouse up stops
-
Interpolation:
onProcessinterpolates X/Y position based on cursor position between trajectory points -
Rendering:
onPaintdraws either a polyline or smooth quadratic bezier curves (configurable in settings) - Randomize: Generates a Lissajous curve with random parameters
- Persistence: Full chunk system saves/restores all trajectory points
-
Chunk system (
onGetChunkLen,onGetChunk,onSetChunk) for custom data persistence -
Quadratic bezier curves via
sdkDrawPathQuadCurveTo - Lissajous curve generation for randomization
- Cursor interpolation along a path
- Point distance threshold for smooth drawing
- Settings: smooth line toggle, inverse Y axis, color picker
- Coords array I/O for trajectory import/export
onGetModuleInfo · onInitModule · onGetParamInfo · onCallBack · onProcess · onGetChunkLen · onGetChunk · onSetChunk · onRandomize · onCreateSettings · onSettingsHasChanged · onCreateCommands · onPaint · onMouseMove · onMouseDown · onMouseUp
- DrawBox — Simpler mouse drawing
- SimplePad — Draggable pads with chunk persistence
- DataOscilloscope — Path drawing for waveforms