# Function:s2funtc

## s2funtc

Draw a curve defined by parametric equations fx(t), fy(t) and fz(t) with colour control.

## Prototype

```void s2funtc(float(*fx)(float*), float(*fy)(float*), float(*fz)(float*), float(*fc)(float*), int N, float tmin, float tmax); ```

## Description

Like s2funt, but an additional function fc (whose return value is clipped to the range [0,1]) controls the colour of the line, according to the colour index range currently set.

 s2funt Draw a curve defined by parametric equations fx(t), fy(t) and fz(t).

## Code Example

```#include <stdio.h> #include <stdlib.h> #include <math.h> #include "s2plot.h" #define XLIMIT 10.0 #define YLIMIT 10.0 #define ZLIMIT 50.0 #define TWOPI 6.2831853 float fx(float *t) { return XLIMIT * sin(*t); } inline float fy(float *t) { return YLIMIT * *t / TWOPI * cos(*t); } float fz(float *t) { return 20. + (ZLIMIT * *t / TWOPI + 4.*sin(5* *t)*sin(3* *t))*0.5; } float fc(float *t) { return *t / TWOPI / 2.0 + 0.5; } int main(int argc, char *argv[]) { float x1 = -XLIMIT, x2 = XLIMIT; /* x world coord range */ float y1 = -YLIMIT, y2 = YLIMIT; /* y world coord range */ float z1 = -ZLIMIT/4.0, z2 = ZLIMIT; /* z world coord range */ s2opend("/?",argc,argv); /* Open the display */ s2swin(x1,x2,y1,y2,z1,z2); /* Set the window coordinates */ s2box("BCDET",0,0,"BCDET",0,0,"BCDET",0,0); /* Draw coordinate box */ s2sci(S2_PG_YELLOW); s2slw(3); /* Set the line width */ s2icm("rainbow", 3000, 3600); /* Install a colour map */ s2scir(3000, 3600); /* Set the colour range */ s2funtc(&fx, &fy, &fz, &fc, 1000, -TWOPI, TWOPI); /* Draw coloured parametric line */ s2show(1); /* Open the s2plot window */ return 1; } ```

Back to S2PLOT function list.