Changeset 206 for trunk/archive/pslib/include/psMath.h
- Timestamp:
- Mar 10, 2004, 12:07:04 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/archive/pslib/include/psMath.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/archive/pslib/include/psMath.h
r204 r206 83 83 84 84 /** for a set of N data types, you need a collection of N^2 - 1 functions **/ 85 86 /*** example 3: embedded data type */ 87 88 psImage A, B, Y; 89 90 B = psBinaryOp (NULL, A, "^", psScalar(2)); 91 Y = psUnaryOp (NULL, B, "log"); 92 93 /** in this method, the data types (psImage, psVector) include embedded information about their data type in 94 * the structure. The constant value is then handled by calling the psScalar function which returns a private 95 * scalar data type which is always freed by the code. This forces the layout of the data structures to be 96 * consistent, with the type information as the first entry. We can then define a data type which is 97 * completely flat and can be used to check on the data type of the data. 98 */ 99 100 typedef struct { 101 psTypeInfo type; 102 union { 103 int i; 104 float f; 105 double d; 106 } 107 } p_psScalar; 108 109 typedef struct { 110 psType type; 111 psDimension dim; 112 } psTypeInfo;
Note:
See TracChangeset
for help on using the changeset viewer.
