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
Add CatmullRomCurve and CatmullRomSpline #47547
Conversation
4289ee9
to
b33cd01
Compare
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.
I did not review the math behind this :)
} | ||
|
||
@override | ||
String toString() => '$runtimeType'; |
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.
runtimeType.toString is very slow.
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.
Yeah, but I'm not sure what else I would want to print here, and overriding it in each class to a string literal is error prone. It's generally only ever used in debug mode.
Isn't it just as slow to not override toString
and have it print "Instance of MyType"?
8ff4b86
to
9d9b573
Compare
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, but maybe @HansMuller could also take a look since he seems to be more of a domain expert :)
ec35d06
to
298d78d
Compare
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
298d78d
to
8e0ea4b
Compare
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.
Also, note that I added the example that we talked about with the flying "B".
This adds CatmullRomCurve animation curve, and a CatmullRomSpline, which is what it uses to do interpolation. This allows us to create animation curves which can smoothly interpolate the values given to the curve. Since I've introduced a 2D spline curve, I also created a Curve2D base class for such parametric curves.
Description
This adds
CatmullRomCurve
animation curve, and aCatmullRomSpline
, which is what it uses to do interpolation.This allows us to create animation curves which can smoothly interpolate the values given to the curve.
Here's an example program that uses these curves, and lets you edit them to see their properties. (this is not a permanent location for this program, and eventually the goal is for it to be available in the API docs).
Since I've introduced a 2D spline curve, I also created a
Curve2D
base class for such parametric curves.Tests
Breaking Change