00001 /* -- 00002 OpenFX version 1.0 - Modelling, Animation and Rendering Package 00003 Copyright (C) 2000 OpenFX Development Team 00004 00005 This program is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU General Public License 00007 as published by the Free Software Foundation; either version 2 00008 of the License, or (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License 00016 along with this program; if not, write to the Free Software 00017 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 00019 You may contact the OpenFX development team via elecronic mail 00020 at core@openfx.org, or visit our website at http://openfx.org for 00021 further information and support details. 00022 -- */ 00023 00024 /* file Splines.c for inclusion in Path and modeller */ 00025 00026 long SplinesP(double k[], double tau){ 00027 return (long)(tau*(tau*(tau*k[3] + k[2]) + k[1]) + k[0]); 00028 } 00029 00030 double SplinesR(double k[], double tau){ 00031 return (double)(tau*(tau*(tau*k[3] + k[2]) + k[1]) + k[0]); 00032 } 00033 00034 void SplinesK(double k[], long vl, long v1, long v2, long vn){ 00035 k[0] = (double)v1; 00036 k[1] = -0.5*(double)vl+0.5*(double)v2; 00037 k[2] = (double)vl-2.5*(double)v1+2.0*(double)v2-0.5*(double)vn; 00038 k[3] = -0.5*(double)vl+1.5*(double)v1-1.5*(double)v2+0.5*(double)vn; 00039 } 00040 00041 void SplinesG(double k[], double xi, double xi1, double xig, double xig1){ 00042 k[0] = xi; 00043 k[1] = xig; 00044 k[2] = -3.0*xi+3.0*xi1-2.0*xig-xig1; 00045 k[3] = 2.0*xi-2.0*xi1+xig+xig1; 00046 }