kfcurveutils.h

Go to the documentation of this file.
00001 
00004 #ifndef FBXFILESDK_COMPONENTS_KFCURVE_KFCURVEUTILS_H
00005 #define FBXFILESDK_COMPONENTS_KFCURVE_KFCURVEUTILS_H
00006 
00007 /**************************************************************************************
00008 
00009  Copyright (C) 2001 - 2009 Autodesk, Inc. and/or its licensors.
00010  All Rights Reserved.
00011 
00012  The coded instructions, statements, computer programs, and/or related material 
00013  (collectively the "Data") in these files contain unpublished information 
00014  proprietary to Autodesk, Inc. and/or its licensors, which is protected by 
00015  Canada and United States of America federal copyright law and by international 
00016  treaties. 
00017  
00018  The Data may not be disclosed or distributed to third parties, in whole or in
00019  part, without the prior written consent of Autodesk, Inc. ("Autodesk").
00020 
00021  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
00022  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO
00023  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR ARISING
00024  BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES OF TITLE, 
00025  NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR USE. 
00026  WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT WARRANT THAT THE OPERATION
00027  OF THE DATA WILL BE UNINTERRUPTED OR ERROR FREE. 
00028  
00029  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS
00030  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR EXPENSES
00031  OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE DAMAGES OR OTHER
00032  SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS OF PROFITS, REVENUE
00033  OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR DAMAGES OF ANY KIND),
00034  HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF LIABILITY, WHETHER DERIVED
00035  FROM CONTRACT, TORT (INCLUDING, BUT NOT LIMITED TO, NEGLIGENCE), OR OTHERWISE,
00036  ARISING OUT OF OR RELATING TO THE DATA OR ITS USE OR ANY OTHER PERFORMANCE,
00037  WHETHER OR NOT AUTODESK HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS
00038  OR DAMAGE. 
00039 
00040 **************************************************************************************/
00041 #include <fbxfilesdk/fbxfilesdk_def.h>
00042 
00043 #include <fbxfilesdk/components/kfcurve/kfcurve.h>
00044 #include <fbxfilesdk/components/kbaselib/klib/kerror.h>
00045 
00046 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00047 
00048     class KFCurveNode;
00049 
00064     class KFBX_DLL KFCurveUtils
00065     {
00066 
00067     public:
00068 
00074         static bool CompareCurve(KFCurve* pCurveA, KFCurve* pCurveB);
00075 
00083         static bool GetGlobalInterpolation(kFCurveInterpolation& pGlobalInterpolation, KFCurve& pCurve);
00084 
00092         static bool GetGlobalTangeant(kFCurveTangeantMode& pGlobalTangent, KFCurve& pCurve);
00093 
00095         enum EInterpolationAndTangeant
00096         {
00097             eCONSTANT,
00098             eLINEAR,
00099             eCUBIC_AUTO,
00100             eCUBIC_AUTO_BREAK,
00101             eCUBIC_USER,
00102             eCUBIC_BREAK,
00103             eCUBIC_TCB,
00104             eINTERPOLATION_AND_TANGEANT_COUNT
00105         };
00106 
00112         static bool GetInterpolationAndTangeantCount(KFCurve& pCurve, int pArray[eINTERPOLATION_AND_TANGEANT_COUNT]);
00113 
00121         static KFCurveNode& ConvertCurveInterpolationRecursive
00122         (
00123             kFCurveInterpolation    pTargetGlobalInterpolation,
00124             kFCurveTangeantMode     pTargetGlobalTangent,
00125             KFCurveNode&            pCurveNode
00126         );
00127 
00138         static KFCurve& ConvertCurve
00139         (
00140             KFCurve& pSourceCurve,
00141             KFCurve& pTargetCurve,
00142             kFCurveInterpolation pTargetGlobalInterpolation,
00143             kFCurveTangeantMode pTargetGlobalTangent,
00144             KTime pFramePeriod
00145         );
00146 
00160         static void Resample
00161         (
00162             KFCurve &pSourceCurve,
00163             KFCurve &pTargetCurve,
00164             KTime &pStart,
00165             KTime &pStop,
00166             KTime &pPeriod,
00167             kFCurveInterpolation pInterpolation,
00168             kFCurveTangeantMode pTangentMode,
00169             bool pAddStopKey = false
00170         );
00171 
00184         static void Resample
00185         (
00186             KFCurve &pSourceCurve,
00187             KFCurve &pTargetCurve,
00188             KTime &pStart,
00189             KTime &pStop,
00190             KTime &pPeriod,
00191             bool pAddStopKey = false
00192         );
00193 
00203         static void Resample
00204         (
00205             KFCurve &pCurve,
00206             KTime   pPeriod,
00207             KTime   pStart = KTIME_MINUS_INFINITE,
00208             KTime   pStop = KTIME_INFINITE,
00209             bool    pKeysOnFrame = false
00210         );
00211 
00219         static void Merge(KFCurve &pCurveIn, KFCurve &pCurveMerge, KFCurve &pCurveOut);
00220 
00226         static KTime FindTimeOffsetBefore(KFCurve pCurve, KTime& pTime);
00227 
00233         static KTime FindTimeOffsetAfter(KFCurve pCurve, KTime& pTime);
00234 
00239 
00241         enum EError
00242         {
00243             // Interpolation & tangent methods
00244             eNoKey,
00245             eMultiple,
00246 
00247             // Curve sync methods
00248             eMultipleKeyCount,
00249             eUnsyncedKeys,
00250 
00251             // Filtering methods
00252             eLeftUnchanged,
00253 
00254             eErrorCount
00255         };
00256 
00258         static KError& GetError();
00259 
00261         static EError GetLastErrorID();
00262 
00264         static const char* GetLastErrorString();
00265 
00267 
00269     //
00270     //  WARNING!
00271     //
00272     //  Anything beyond these lines may not be documented accurately and is
00273     //  subject to change without notice.
00274     //
00276 
00277     #ifndef DOXYGEN_SHOULD_SKIP_THIS
00278 
00279     protected:
00280 
00282         KFCurveUtils();
00283 
00284         static KError smError;
00285 
00286     #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00287 
00288     };
00289 
00290 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00291 
00292 #endif // FBXFILESDK_COMPONENTS_KFCURVE_KFCURVEUTILS_H
00293