HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CH_Support.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: Channel Library (C++)
7  *
8  * COMMENTS: Support glue between channel and expression libraries
9  *
10 */
11 
12 #ifndef __CH_Support_h__
13 #define __CH_Support_h__
14 
15 #include "CH_API.h"
16 #include <SYS/SYS_Types.h>
17 
18 //
19 // Some defines for expressions. These defines may be used by anyone
20 // who needs them. They are the lower bits in the EV_Expression
21 // flag and are accessible by the method for getting flags in the
22 // CH_Expression class. Some (CH_SYM...) are flags for the EV_SYMBOL,
23 // which are or'ed into the expression flags and so must use the
24 // same bit-range.
25 //
26 
27 #define CH_EXPRTIME 0x00008000 // Expression uses time
28 #define CH_EXPRCHAN 0x00010000 // Expression uses channel
29 #define CH_EXPRIVALUE 0x00020000 // Expression uses in value
30 #define CH_EXPROVALUE 0x00040000 // Expression uses out value
31 #define CH_EXPRSLOPE 0x00080000 // Expression uses in slope/out slope
32 //#define CH_EXPRPARAM 0x00100000 // Now Unused, free for use
33 #define CH_EXPRACCEL 0x00200000 // Expression uses in accel/out accel
34 #define CH_EXPRKNOTS 0x00400000 // Expression uses spline knots
35 #define CH_EXPRMATCH 0x00800000 // Expression has a match() function
36 //#define CH_SYMHARDWIRED 0x01000000 // Now unused, free for use
37 #define CH_EXPRDATA 0x02000000 // Expression sets a data interest
38 #define CH_EXPRVALUE (CH_EXPRIVALUE | CH_EXPROVALUE)
39 
40 // Flags above 0x00008000 are reserved for the channel library
41 // Flags above 0x02000000 are reserved by the expression library
42 // Applications may use any flags between 0x0001 and 0x4000
43 // for their own custom flags
44 
45 //
46 // It is possible to define constants for the user to use. For each
47 // define, there is a name for the label and a corresponding value.
48 // for example: "XMIN", 0. This would allow the user to type
49 // XMIN instead of having to remember that XMIN is always 0.
50 
52 public:
53  const char *label;
55 };
56 
57 class CH_SegmentValues;
58 class CH_Segment;
59 class CH_Cubic;
60 
62 {
63 public:
64  fpreal x[4];
65  fpreal y[4];
66 
67  CH_Bezier() {}
68 
69  CH_Bezier( CH_SegmentValues const& sv ) { init( sv ); }
70 
71  CH_Bezier( CH_Segment const& seg );
72  CH_Bezier( CH_Segment const& seg, fpreal vscale, fpreal voff );
73 
74  void init( CH_SegmentValues const& sv );
75 
76  void getValues( CH_SegmentValues &v );
77 
78  static void getCubicFromCVs( fpreal x[4], CH_Cubic &c );
79 
80  static void splitInternal( fpreal t, fpreal xin[4],
81  fpreal xout1[4], fpreal xout2[4] );
82 
83  void splitP( fpreal u, CH_Bezier &a, CH_Bezier &b );
84 
85  void split( fpreal t, CH_Bezier &a, CH_Bezier &b );
86 
87  void splitAndFindSlopeLengths( fpreal t,
88  fpreal &left_in, fpreal &left_out,
89  fpreal &right_in, fpreal &right_out );
90 
91  fpreal timeToParametric( fpreal t );
92 
93  fpreal evalP( fpreal u );
94 
95  fpreal eval( fpreal t ); // t is local
96 
97  void display();
98 };
99 
101 {
102 public:
103  fpreal t0, t1;
104  fpreal x0, x1, x2, x3;
105 
106  fpreal timeToParametric( fpreal t ); // t -> u
107 
108  fpreal reverseEvalP( fpreal y ); // y -> u
109 
110  fpreal evalP( fpreal u ) // u -> y
111  {
112  return x0 + u*(x1 + u*(x2 + u*x3));
113  }
114 
115  fpreal eval( fpreal t ); // t -> y
116 
117  fpreal calculateSlopeP( fpreal u );
118 
119  fpreal calculateAccelP( fpreal u );
120 
121  void display();
122 };
123 
124 #endif
CH_Bezier(CH_SegmentValues const &sv)
Definition: CH_Support.h:69
const GLdouble * v
Definition: glcorearb.h:836
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:1221
GLint y
Definition: glcorearb.h:102
const char * label
Definition: CH_Support.h:53
fpreal value
Definition: CH_Support.h:54
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1221
fpreal x3
Definition: CH_Support.h:104
double fpreal
Definition: SYS_Types.h:270
#define CH_API
Definition: CH_API.h:10
GLint GLenum GLint x
Definition: glcorearb.h:408
fpreal t1
Definition: CH_Support.h:103
fpreal evalP(fpreal u)
Definition: CH_Support.h:110