Function to perform a third-order polynomial.
Two cams can be set, and through an appropriate par parameter it is possible to switch between cams.
Syntax |
real mv_cam (real xCurr, i32 nSegm1, stru_matcam stru1 [, real par=0] [, i32 nSegm2=0] [, stru_matcam stru2=NULL] ) |
||||||||
---|---|---|---|---|---|---|---|---|---|
xCurr |
Current master value (abscissa) |
||||||||
nPoints1 |
Number of points of which the first polynomial cam is composed. Must match the length of the array of stru1 |
||||||||
stru1 |
Array of structures of type stru_matcam containing the values of the first cam. NOTE: Must be initialized as an array. |
||||||||
par |
Mixer parameter that allows switching between the two cams. (optional, default 0)
|
||||||||
nPoints2 |
Number of points of which the second polynomial cam is composed. (optional, default 0) Must match the length of the array of stru2 |
||||||||
stru2 |
Array of structures of type stru_matcam containing the values of the second cam. (optional, default NULL) NOTE: Must be initialized as an array. |
||||||||
Result |
Updated result value, corresponding to the y-coordinates of the cam. The result is calculated as: dx1 = xCurr - xInitial1 dx2 = xCurr - xInitial2 result = (((a1*dx1^3) + (b1*dx1^2) + (c1*dx1) + d1) * (1-par)) + (((a2*dx2^3) + (b2*dx2^2) + (c2*dx2) + d2) * par) |
||||||||
Validity |
Rule |
||||||||
Note |
Parameters a, b, c, d must be given as input to the function |
Example of use:
For a concrete example see in the RDE environment: Workspace -> Specials -> Examples Library. |