1

I am working on cubic Béziers, and need to find the points where the tangent to the curve is vertical or horizontal.

So far I've managed to:

  • convert the Bézier to a cubic polynomial
  • find the derivative
  • find the root(s) of the derivative

This should give me the points in x/y space where the cubic Bézier is horizontal.

I am now having trouble:

  • converting the roots back to the 0 >= t <= 1 space
  • figuring how to find the vertical point(s)

Before I resort to approximation (i.e.: walking through the curve and finding the vertical/horizontal spots) I want to ask if there is any analytical method.

I haven't touched calculus seriously since the last century, and this is a hobby project, so have mercy, please.

I am using python/numpy to solve this - any hints in that direction are helpful but not necessary. I think that once figured out the math aspect I can dig up the implementation.

Bernard
  • 175,478
simone
  • 111
  • 1
    You have two derivatives: x'(t)=quadratic expression in t and y'(t)=(another) quadratic expression in t. You look for roots for x'(t)=0 and y'(t)=0, right ? Let us consider for example the case of a horizontal tangent meaning that y'(t)=0 : either it has a positive discriminant $\Delta$ , you have to check that at least one of the two (real) roots $t$ are indeed $0\le t \le 1$. – Jean Marie Jul 22 '21 at 21:49

1 Answers1

1

This should give me the points in x/y space where the cubic Bézier is horizontal.

No, if you solve $y’(t)=0$ it will give you the parameter values ($t$) where the tangent is horizontal.

You must be solving the wrong equation. If you show us what you did, I expect we can spot the problem.

bubba
  • 43,483
  • 3
  • 61
  • 122