c2m

Syntax

int c2m(int x, int y)

Arguments

x
An integer pixel x-coordinate.
y
An integer pixel y-coordinate.

Return

An integer giving the distance from the center of the image to the pixel at coordinates [x,y].

Description

Pixels are usually addressed by their cartesian coordinates [x,y], but FilterMeister also allows the use of polar coordinates, and provides a set of functions for conversion between the two systems. Polar coordinates are expressed as [d,m], where 'd' represents the 'direction' to the pixel from the origin and 'm' is the 'magnitude' of the distance from the origin. The c2m() function returns the polar coordinate magnitude 'm' for the pixel at [x,y], relative to the top left corner of the image.

Example

%ffp

ForEveryTile:
{

for (y=y_start; y<y_end; ++y)
{
	for (x=x_start; x<x_end; ++x)
	{
		for (z=0; z<Z; ++z)
		{
			pset(x, y, z, (256 * (c2m(x-X/2, y-Y/2)))/128);
		}
	}
}

return true;

}

Also see

c2d,r2x,r2y

Comments

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