-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: Draw motion vectors #469
Conversation
|
238398b
to
cca9dba
Compare
export const VECTOR_KEY_MOTION_DELTA = "_motion_"; | ||
|
||
export const getDefaultVectorConfig = (): VectorConfig => ({ | ||
visible: false, | ||
key: VECTOR_KEY_MOTION_DELTA, | ||
timeIntervals: 5, | ||
color: new Color(0x000000), | ||
scaleFactor: 4, | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to constants
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going to leave this for a follow-up PR because otherwise it'll make the code diff messier
// o <- normVectorEnd | ||
// /|\ | ||
// / | \ <- arrow head maintains onscreen pixel length with zoom | ||
// | | ||
// | | ||
// o <- normVectorStart |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is such a great comment!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm, great work!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, I made a couple suggestions just to shorten your functions but you can take it or leave it
Problem
Closes #42, "visualize XY movement delta." This PR gets a functional implementation of vector lines into TFE! They can now be toggled on and off, and parameters like smoothing and scaling can be edited from a new settings area.
There are a number of spin-off issues that I've created that will be follow-ups to this PR.
Solution
This is a big one, but I think it's split into relatively understandable chunks! I'll be sending a meeting invite to whoever's assigned to this PR so I can walk through it.
VectorField
class, which manages a Three.JS line used for rendering the vector arrows.VectorField
calculates the vertices for ALL objects across ALL timepoints into a big buffer, then only renders slices of it based on the current frame.Type of change
Steps to Verify:
Screenshots (optional):
Small-volume.25.mp4
Keyfiles (delete if not relevant):
SUGGESTED REVIEW ORDER:
math_utils.ts
-> Deltas are calculated here!types.ts
-> Vector configurationSharedWorkerPool.ts
+worker.ts
-> Delta calculations can be triggered asynchronously on workers.Viewer
+react_utils.ts
-> Manages synchronizing react state and delta calculationColorizeCanvas
+VectorField
-> actually renders the vectors to the screenVectoFieldSettings
-> new settings area