Last active
June 10, 2024 15:03
-
-
Save fospathi/971891cb0b8005710d160de0229df0d4 to your computer and use it in GitHub Desktop.
Intersection points of a quadratic Bezier curve and a plane
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
Find the values of the parameter t (in the range 0..1 inclusive) at the intersection points of a quadratic Bezier curve | |
and a plane in three dimensions. | |
Let P₀, P₁, and P₂ be the control points of a quadratic Bezier curve B such that | |
B{t} = (1-t)²P₀ + 2(1-t)(t)P₁ + (t²)P₂ | |
Let A be a unit normal vector to the plane where Q is any position vector on the plane such that | |
A⋅Q = d | |
0 = A⋅Q - d | |
Now, at the intersection points we have B{t} = Q, thus | |
0 = A⋅B{t} - d | |
= A⋅[(1-t)²P₀ + 2(1-t)(t)P₁ + (t²)P₂] - d | |
= t²[A⋅(P₀-2P₁+P₂)] + t[2A⋅(P₁-P₀)] + A⋅(P₀-Q) | |
We now have a quadratic equation in terms of t which can be solved for t. The value(s) of t can be plugged back into | |
B{t} to find the intersection position vector(s). | |
If there are no real solutions for t in the range 0..1 inclusive then either the plane does not intersect the Bezier | |
curve or the plane coincides with the Bezier curve's intrinsic plane meaning there is an infinite number of intersection | |
points. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment