-
Notifications
You must be signed in to change notification settings - Fork 280
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
feat: add library support for 3D ellipses #1711
Draft
keenancrane
wants to merge
6
commits into
main
Choose a base branch
from
ellipse-3d
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
± Registry diff
📊 PerformanceKeyNote that each bar component rounds up to the nearest 100ms, so each full bar is an overestimate by up to 400ms.
If a row has only one bar instead of four, that means it's not a trio and the bar just shows the total time spent for that example, again rounded up to the nearest 100ms. Data
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This (draft) PR provides functionality for drawing 3D ellipses using a single 2D
Ellipse
shape. The 2D ellipse is an exact, rather than approximate, representation of the 3D ellipse under perspective projection.Changes already made:
projectEllipse
toFunctions.ts
projectEllipse
in Style, via a function of the same namerotation
field to theEllipse
shape, which is needed to draw projected ellipsesStill in progress:
rotation
is set to a nonzero angle)projectEllipse
by properly handling the case whereQB
is close to zero.projectEllipse
to use a model, projection, and view matrix, so that 3D ellipses can be drawn in the same context as other 3D shapes (lines, polygons, etc.).projectEllipse
to return a final argument indicating whether the project ellipse is front- or back-facing relative to the oriented plane of projection.projectSphere
that draws the silhouette of a 3D sphere as an ellipse, under perspective projection.Future Work
In general, it is possible to obtain an exact or near-exact vectorization of two classes of 3D objects:
Quadric surfaces include ellipsoids, paraboloids, and hyperboloids (with spheres, cylinders, and cones as important special cases). Under perspective projection, all of these curves become (pieces of) ellipses, parabolas, or hyperbolas in the plane. SVG can exactly represent parabolas (via quadratic Bézier curves) and ellipses; hyperbolas are well-approximated by two Bézier curves and two lines.
A rough "pipeline" that handles this more general class resembles the one used in this PR:
Each of these steps is conceptually not a big deal, but takes some elbow grease to actually develop the specific formulas (especially for clipping). This is a much larger project than can be addressed in the current PR, and is left to future work.