feat: add smart shape recognition for whiteboard#172
Conversation
|
Someone is attempting to deploy a commit to the MINHA's projects Team on Vercel. A member of the Team first needs to authorize it. |
Screen.Recording.2026-06-07.002349.mp4 |
|
Thanks for working on this! I wanted to test the feature locally, but I noticed you accidentally deleted the isHost variable in Whiteboard.jsx. This causes a fatal ReferenceError that crashes the whiteboard entirely (which is why the GitHub CI pipeline is failing). Please restore the isHost logic and fix the errors so I can test out the drawing feature! |
|
Hi @KENZY004, sorry about that! The isHost logic got accidentally removed during the merge conflict resolution. I have restored it now, and the CI pipeline should pass. Let me know how the smart shapes feature feels! |
|
@KENZY004 could you pls review it |
1 similar comment
|
@KENZY004 could you pls review it |
Hi @KENZY004,
I've successfully implemented the Smart Shape Recognition feature for Issue #75. Here's a summary of what's working and what needs further iteration:
Working shapes:
Circle: detected via closed stroke with no sharp corners
Triangle: detected via geometric error calculation and edge point distribution
Rectangle: detected via corner/bounding-box error analysis
Straight Line: detected via point-to-line error calculation
Partially Working (Pentagon, Hexagon, Octagon):
These shapes require 5, 6, and 8 sharp corners respectively to be detected. However, during testing, the corner detection algorithm maxes out at ~4 corners even when drawing these shapes carefully. This is because:
The resampling + smoothing pipeline merges nearby corners.
Freehand drawing naturally rounds out corners, reducing sharpness.
The MIN_GAP constraint prevents detecting corners that are too close together.
Suggested next step:
Implementing a multi-stroke approach where each side is drawn separately, allowing the algorithm to combine individual strokes into a complex polygon.