![]() |
![]() |
![]() |
cpg-network Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy |
enum CpgMathOperatorType; enum CpgMathFunctionType; CpgMathFunctionType cpg_math_function_lookup (const gchar *name
,gint *arguments
); gdouble cpg_math_constant_lookup (const gchar *name
,gboolean *found
); CpgMathOperatorType cpg_math_operator_lookup (CpgMathOperatorType type
); void cpg_math_function_execute (CpgMathFunctionType type
,gint numargs
,CpgStack *stack
); void cpg_math_operator_execute (CpgMathOperatorType type
,gint numargs
,CpgStack *stack
); gboolean cpg_math_function_is_constant (CpgMathFunctionType type
); gboolean cpg_math_operator_is_constant (CpgMathOperatorType type
); gboolean cpg_math_function_is_variable (CpgMathFunctionType type
); gboolean cpg_math_operator_is_variable (CpgMathOperatorType type
); gboolean cpg_math_function_is_commutative (CpgMathFunctionType type
); gboolean cpg_math_operator_is_commutative (CpgMathOperatorType type
); const gchar * cpg_math_function_lookup_by_id (CpgMathFunctionType type
,gint *arguments
);
typedef enum { CPG_MATH_OPERATOR_TYPE_NONE = 0, CPG_MATH_OPERATOR_TYPE_UNARY_MINUS, CPG_MATH_OPERATOR_TYPE_MINUS, CPG_MATH_OPERATOR_TYPE_PLUS, CPG_MATH_OPERATOR_TYPE_MULTIPLY, CPG_MATH_OPERATOR_TYPE_DIVIDE, CPG_MATH_OPERATOR_TYPE_MODULO, CPG_MATH_OPERATOR_TYPE_POWER, CPG_MATH_OPERATOR_TYPE_GREATER, CPG_MATH_OPERATOR_TYPE_LESS, CPG_MATH_OPERATOR_TYPE_GREATER_OR_EQUAL, CPG_MATH_OPERATOR_TYPE_LESS_OR_EQUAL, CPG_MATH_OPERATOR_TYPE_EQUAL, CPG_MATH_OPERATOR_TYPE_OR, CPG_MATH_OPERATOR_TYPE_AND, CPG_MATH_OPERATOR_TYPE_NEGATE, CPG_MATH_OPERATOR_TYPE_TERNARY, CPG_MATH_OPERATOR_TYPE_NUM } CpgMathOperatorType;
Operator types.
none | |
unary minus | |
minus | |
plus | |
multiply | |
divide | |
modulo | |
power | |
greater | |
less | |
greater or equal | |
less or equal | |
equal | |
or | |
and | |
negate | |
ternary | |
number of operators |
typedef enum { CPG_MATH_FUNCTION_TYPE_NONE = 0, CPG_MATH_FUNCTION_TYPE_SIN, CPG_MATH_FUNCTION_TYPE_COS, CPG_MATH_FUNCTION_TYPE_TAN, CPG_MATH_FUNCTION_TYPE_ASIN, CPG_MATH_FUNCTION_TYPE_ACOS, CPG_MATH_FUNCTION_TYPE_ATAN, CPG_MATH_FUNCTION_TYPE_ATAN2, CPG_MATH_FUNCTION_TYPE_SQRT, CPG_MATH_FUNCTION_TYPE_INVSQRT, CPG_MATH_FUNCTION_TYPE_MIN, CPG_MATH_FUNCTION_TYPE_MAX, CPG_MATH_FUNCTION_TYPE_EXP, CPG_MATH_FUNCTION_TYPE_FLOOR, CPG_MATH_FUNCTION_TYPE_CEIL, CPG_MATH_FUNCTION_TYPE_ROUND, CPG_MATH_FUNCTION_TYPE_ABS, CPG_MATH_FUNCTION_TYPE_POW, CPG_MATH_FUNCTION_TYPE_RAND, CPG_MATH_FUNCTION_TYPE_LN, CPG_MATH_FUNCTION_TYPE_LOG10, CPG_MATH_FUNCTION_TYPE_HYPOT, CPG_MATH_FUNCTION_TYPE_EXP2, CPG_MATH_FUNCTION_TYPE_SINH, CPG_MATH_FUNCTION_TYPE_COSH, CPG_MATH_FUNCTION_TYPE_TANH, CPG_MATH_FUNCTION_TYPE_LERP, CPG_MATH_FUNCTION_TYPE_SQSUM, CPG_MATH_FUNCTION_TYPE_SIGN, CPG_MATH_FUNCTION_TYPE_CSIGN, CPG_MATH_FUNCTION_TYPE_CLIP, CPG_MATH_FUNCTION_TYPE_CYCLE, CPG_MATH_FUNCTION_TYPE_NUM } CpgMathFunctionType;
Function types.
none | |
sine | |
cosine | |
tangent | |
arc sine | |
arc cosine | |
arc tangent | |
arc tangent 2 | |
square root | |
inverse sequare root | |
min | |
max | |
exponential | |
floor | |
ceil | |
round | |
absolute | |
power | |
random | |
natural logarithm | |
base 10 logarithm | |
euclidean distance | |
base-2 exponential | |
hyperbolic sine | |
hyperbolic consine | |
hyperbolic tangent | |
linear interpolation | |
squared sum | |
sign | |
copy sign | |
clip | |
cycle | |
number of function types |
CpgMathFunctionType cpg_math_function_lookup (const gchar *name
,gint *arguments
);
Lookup a math function given the name name
and number of arguments.
|
The function name |
|
The number of arguments. [out] |
Returns : |
A CpgMathFunctionType |
gdouble cpg_math_constant_lookup (const gchar *name
,gboolean *found
);
Get the value of a constant. Valid constants are: pi, PI, e, E, NAN, nan, NaN, Inf, INF, inf.
|
The name of the constant |
|
Return value whether or not the constant could be found |
Returns : |
the value of a constant |
CpgMathOperatorType cpg_math_operator_lookup (CpgMathOperatorType type
);
Lookup the operator type for a certain operator type.
|
A CpgMathOperatorType |
Returns : |
A CpgMathOperatorType |
void cpg_math_function_execute (CpgMathFunctionType type
,gint numargs
,CpgStack *stack
);
Execute a math function on the stack.
|
A CpgMathFunctionType |
|
A CpgStack |
void cpg_math_operator_execute (CpgMathOperatorType type
,gint numargs
,CpgStack *stack
);
Execute an operator on the stack.
|
A CpgMathOperatorType |
|
A CpgStack |
gboolean cpg_math_function_is_constant (CpgMathFunctionType type
);
Get whether a math function is constant (i.e. if it is deterministic). An example of a function that is not constant is 'rand'.
|
A CpgMathFunctionType |
Returns : |
TRUE if the function is constant, FALSE otherwise |
gboolean cpg_math_operator_is_constant (CpgMathOperatorType type
);
Get whether an operator is constant (i.e. if it is deterministic).
|
A CpgMathOperatorType |
Returns : |
TRUE if the operator is constant, FALSE otherwise |
gboolean cpg_math_function_is_variable (CpgMathFunctionType type
);
Get whether the math function accepts a variable number of arguments.
|
A CpgMathFunctionType |
Returns : |
TRUE if the function accepts a variable number of arguments,
FALSE otherwise |
gboolean cpg_math_operator_is_variable (CpgMathOperatorType type
);
Get whether an operator accepts a variable number of arguments.
|
A CpgMathOperatorType |
Returns : |
TRUE if the operator accepts a variable number of arguments,
FALSE otherwise |
gboolean cpg_math_function_is_commutative (CpgMathFunctionType type
);
Get whether an function is commutative.
|
A CpgMathOperatorType |
Returns : |
TRUE if the function is commutative, FALSE otherwise |
gboolean cpg_math_operator_is_commutative (CpgMathOperatorType type
);
Get whether an operator is commutative.
|
A CpgMathOperatorType |
Returns : |
TRUE if the operator is commutative, FALSE otherwise |
const gchar * cpg_math_function_lookup_by_id (CpgMathFunctionType type
,gint *arguments
);
Lookup the name of a function by its id.
|
A CpgMathFunctionType |
|
return value for the number of arguments. [out] |
Returns : |
the name of the function, or NULL if the function could not be
found |