KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
bspline.h File Reference

B-Spline curve support. More...

#include <sys/cdefs.h>
#include <dc/vector.h>

Go to the source code of this file.

Functions

void bspline_coeff (const point_t *pnt)
 Calculate and set b-spline coefficients.
 
void bspline_get_point (float t, point_t *p)
 Generate the next point for the current set of coefficients.
 

Detailed Description

B-Spline curve support.

This module provides utility functions to generate b-spline curves in your program. It is used by passing in a set of control points to bspline_coeff(), and then querying for individual points using bspline_get_point().

Note that this module is NOT thread-safe.

Author
Megan Potter

Function Documentation

◆ bspline_coeff()

void bspline_coeff ( const point_t * pnt)

Calculate and set b-spline coefficients.

This function performs the initial setup work of calculating the coefficients needed to generate a b-spline curve for the specified set of points. The calculation is based on a total of 4 points: one previous point, the current point, and two points that occur after the current point.

The current point should be at pnt[0], the previous at pnt[-1], and the future points should be at pnt[1], and pnt[2]. I repeat: pnt[-1] must be a valid point for this to work properly.

Parameters
pntThe array of points used to calculate the b-spline coefficients.

◆ bspline_get_point()

void bspline_get_point ( float t,
point_t * p )

Generate the next point for the current set of coefficients.

Given a 't' (between 0.0f and 1.0f) this will generate the next point value for the current set of coefficients.

Parameters
tThe "t" value for the b-spline generation function.
pStorage for the generated point.