/* ** Command & Conquer Renegade(tm) ** Copyright 2025 Electronic Arts Inc. ** ** This program 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. ** ** This program 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 this program. If not, see . */ /*********************************************************************************************** *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S *** *********************************************************************************************** * * * Project Name : WWMath * * * * $Archive:: /Commando/Code/wwmath/catmullromspline.cpp $* * * * Author:: Greg Hjelstrom * * * * $Modtime:: 3/08/00 8:50p $* * * * $Revision:: 6 $* * * *---------------------------------------------------------------------------------------------* * Functions: * * CatmullRomSpline3DClass::Update_Tangents -- computes the tangents at each key * * CatmullRomSpline3DClass::Get_Factory -- returns the factory for CatmullRomSpline3D * * CatmullRomSpline3DClass::Save -- save this curve * * CatmullRomSpline3DClass::Load -- load this curve * * CatmullRomSpline1DClass::Update_Tangents -- Computes the tangents at each key * * CatmullRomSpline1DClass::Get_Factory -- returns the factory for CatmullRomSpline1D * * CatmullRomSpline1DClass::Save -- Save this curve * * CatmullRomSpline1DClass::Load -- Load this curve * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include "catmullromspline.h" #include "persistfactory.h" #include "wwmathids.h" #include "wwhack.h" /* ** Force-Link this module because the linker can't detect that we actually need it... */ DECLARE_FORCE_LINK(catmullromspline); /* ** Save-Load stuff */ SimplePersistFactoryClass _CatmullRomSpline3DFactory; SimplePersistFactoryClass _CatmullRomSpline1DFactory; enum { // ID's used by CatmullRomSpline3D CATMULLROM3D_CHUNK_HERMITE3D = 0x00020727, // ID's used by CatmullRomSpline1D CATMULLROM1D_CHUNK_HERMITE1D = 0x00020729, }; /* ** Catmull-Rom 3D spline implementation */ /*********************************************************************************************** * CatmullRomSpline3DClass::Update_Tangents -- computes the tangents at each key * * * * INPUT: * * * * OUTPUT: * * * * WARNINGS: * * I'm not sure about the tangents for the endpoints of the curve. * * * * HISTORY: * * 3/7/2000 gth : Created. * *=============================================================================================*/ void CatmullRomSpline3DClass::Update_Tangents(void) { if (Keys.Count() < 2) { for (int i=0; i