Degrafa Advanced Cubic Bezier

If you update from SVN, you should notice a new class, com.degrafa.geometry.AdvancedCubicBezier.  Just as the AdvancedQuadraticBezier added automatic three-point interpolation, AdvancedCubicBezier has four-point interpolation with automatic chord-length parameterization.

I had worked out the math some time ago, but never put the bounding-box methods into the Singularity cubic Bezier class.  A bonus for Degrafa users is that I’ve implemented the methods for rectangular bounding of the cubic bezier in AdvancedCubicBezier, as shown in the screen shot below.

Degrafa Advanced Cubic Bezier
Degrafa Advanced Cubic Bezier

A demo for the y-at-x method will follow shortly.  In the mean time, you can check out the demo for the other AdvancedCubicBezier methods.  As an aside, I uncovered an issue with pointAt() for certain cubic beziers, so AdvancedCubicBezier overrides this method and returns the point directly from the polynomial coefficients.

View demo.

View source.


2 thoughts on “Degrafa Advanced Cubic Bezier

    1. JT – in the quad. case, I’ve already mentioned an application where I used a quad. Bezier as a trajectory. I was only given the initial and terminal points of the trajectory and had to compute the middle interpolation point. The bounds are used to check the trajectory to ensure the animated sprite does not move into unwanted areas of the UI (in which case the middle interpolation point is changed).

      It may also be the case that you are using a quad. or cubic to dynamically draw and layout UI elements. The cubic bounding box might be used to ensure that other elements laid out near the cubic Bezier do not overlap.


      – jim

Comments are closed.