tricos

Syntax

int tricos(int a)

Arguments

a
Normally a value between 0 and 1024, but it can also be higher

Return

A value between -511 and 512 is returned.

Description

tricos works like cos(), but returns a triangular/linear value.

Example

%ffp

ctl(0): checkbox, text="Use tricos() instead of cos()",size=(100,*)

ForEveryTile:
{

	int calc;

	for (y=y_start; y<y_end; y++){
		updateProgress(y,y_end);
	for (x=x_start; x<x_end; x++){ 

		if (ctl(0))
			calc=scl( tricos(x*1024/X) , -511, 512, 0, 255);
		else
			calc=scl( cos(x*1024/X) , -511, 512, 0, 255);	
		
	for (z=0; z<Z; z++){ 
		
		pset(x, y, z, calc  );

	}}}

	return true;
}

Also see

(cos)?,tri

Comments

Everyone can add his comments about his experiences with this function here. Tips for using it are welcome, too.