00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __CH_Support_h__
00021 #define __CH_Support_h__
00022
00023 #include "CH_API.h"
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #define CH_EXPRTIME 0x00008000 // Expression uses time
00034 #define CH_EXPRCHAN 0x00010000 // Expression uses channel
00035 #define CH_EXPRIVALUE 0x00020000 // Expression uses in value
00036 #define CH_EXPROVALUE 0x00040000 // Expression uses out value
00037 #define CH_EXPRSLOPE 0x00080000 // Expression uses in slope/out slope
00038
00039 #define CH_EXPRACCEL 0x00200000 // Expression uses in accel/out accel
00040 #define CH_EXPRKNOTS 0x00400000 // Expression uses spline knots
00041 #define CH_EXPRMATCH 0x00800000 // Expression has a match() function
00042 #define CH_SYMHARDWIRED 0x01000000 // Variable contains local var ptr
00043 #define CH_EXPRDATA 0x02000000 // Expression sets a data interest
00044 #define CH_EXPRVALUE (CH_EXPRIVALUE | CH_EXPROVALUE)
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057 class CH_API CH_ExprDefine {
00058 public:
00059 const char *label;
00060 float value;
00061 };
00062
00063 class CH_SegmentValues;
00064 class CH_Segment;
00065 class CH_Cubic;
00066
00067 class CH_API CH_Bezier
00068 {
00069 public:
00070 float x[4];
00071 float y[4];
00072
00073 CH_Bezier() {}
00074
00075 CH_Bezier( CH_SegmentValues const& sv ) { init( sv ); }
00076
00077 CH_Bezier( CH_Segment const& seg );
00078
00079 void init( CH_SegmentValues const& sv );
00080
00081 void getValues( CH_SegmentValues &v );
00082
00083 static void getCubicFromCVs( float x[4], CH_Cubic &c );
00084
00085 static void splitInternal( float t, float xin[4],
00086 float xout1[4], float xout2[4] );
00087
00088 void splitP( float u, CH_Bezier &a, CH_Bezier &b );
00089
00090 void split( float t, CH_Bezier &a, CH_Bezier &b );
00091
00092 void splitAndFindSlopeLengths( float t,
00093 float &left_in, float &left_out,
00094 float &right_in, float &right_out );
00095
00096 float timeToParametric( float t );
00097
00098 float evalP( float u );
00099
00100 float eval( float t );
00101
00102 void display();
00103 };
00104
00105 class CH_API CH_Cubic
00106 {
00107 public:
00108 float t0, t1;
00109 float x0, x1, x2, x3;
00110
00111 float timeToParametric( float t );
00112
00113 float reverseEvalP( float y );
00114
00115 float evalP( float u )
00116 {
00117 return x0 + u*(x1 + u*(x2 + u*x3));
00118 }
00119
00120 float eval( float t );
00121
00122 float calculateSlopeP( float u );
00123
00124 float calculateAccelP( float u );
00125
00126 void display();
00127 };
00128
00129 #endif