/**************************************************************************** Copyright (C) 2012 HidraVFX development team This file is part of the HidraVFX project. HidraVFX is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. HidraVFX is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with HidraVFX. If not, see . ****************************************************************************/ #ifndef SPLINE_H_ #define SPLINE_H_ #include "vertex.h" /* typedef double[] trunarray ; typedef array[] of tpoint t3dpointgrid ; */ typedef struct { tpoint point[4]; } tcubicspline; typedef struct { tpoint *points; int length; } tpointarray; typedef tpoint **t3dpointgrid; extern tcubicspline tcubicspline_of_tpoint(tpoint p0,tpoint p1,tpoint p2,tpoint p3); extern tcubicspline tcubicspline_of_double(double p0x,double p0y,double p1x,double p1y,double p2x,double p2y,double p3x,double p3y); extern tpoint bspline_of_tpoint(tpoint p0, tpoint p1,tpoint p2, double u); extern tpoint bspline_of_tcubicspline(tcubicspline *p, double u); extern tpoint catmullrom_of_tcubicspline(tcubicspline p, double u); extern tpoint bezier_of_2tpoints(tpoint p0,tpoint p1, double u); extern tpoint bezier_of_3tpoints(tpoint p0,tpoint p1,tpoint p2,double u); extern tpoint bezier_of_tcubicspline(tcubicspline *p,double u); extern tpoint beziertangent_of_tcubicspline(tcubicspline *bezier, double u); extern tpoint bezierradius_of_tcubicspline(tcubicspline *bezier, double u); extern void decasteljau(tcubicspline *b, tcubicspline *b1, tcubicspline *b2, double u); extern tpoint bezier_of_t3dpointgrid(t3dpointgrid p, double u,double v); extern void assign_bezier(tcubicspline *base, tcubicspline *ne, double l); extern void assign_bezier_2(tcubicspline *base, tcubicspline *ne, double l, double n); extern tcubicspline assignbezier_to_point(tcubicspline *base, tpoint *p, double l, double n); extern void assignbezier_to_t3dpointgrid(t3dpointgrid base, t3dpointgrid ne, double l, int orient); extern tpoint fergusson(tpoint *p0,tpoint *p1,tpoint *p0d,tpoint *p1d,double u); extern double hermite(double x[],double f[],double fd[],double xs); extern double lengthpolyline(tcubicspline *curve); extern tcubicspline beziertohermite(tcubicspline *bezier); extern tcubicspline hermitetobezier(tcubicspline *hermite); extern void rasterizebezier(tcubicspline *bezier, tpointarray *points, int nonuniformspacing); extern void rasterizebezier_of_double(tcubicspline *bezier, tpointarray *points, double uniformspacing); #endif