Older Newer
Wed, 19 Aug 2015 01:39:44 . . . . 72.173.133.4 [example]


Changes by last author:

Added:
= r2y =

== Syntax ==

:int r2y(int d, int m)

== Arguments ==

:d

::An integer value for the 'direction' of a pixel.

:m

::An integer value for the 'magnitude' of a pixel.

== Return ==

:An integer giving the cartesian y coordinate for the pixel whose polar coordinates are [d,m].

== 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 image's center point, and 'm' is the 'magnitude' of the distance from the center. The r2y() function takes a pair of polar coordinates as arguments, and returns the cartesian y coordinate of the corresponding pixel.

== Example ==

<code>

%ffp

ForEveryTile:

{

int centerX = 100; // distances from the top left corner of the image

int centerY = 100;

int radius = 50;

int angle = 360;

int thd; // angle in degrees

int thk; // angle from -511 to 512

for (thk=0; thk<=angle; thk++) {

thd = (-thk * 1024)/360;

if (thd < -511)

thd += 1024;

for (z=0; z<Z; z++)

pset(r2x(thd, radius) + centerX, r2y(thd, radius) + centerY, z, 0);

}

return true;

}

</code>

== Also see ==

:c2d,c2m,r2x

== Comments ==

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