bTriangle

Syntax

int bTriangle(int x, int y, int centerx, int centery, int radius)

Arguments

x, y
Current x and y coordinates in the image
centerx, centery
Center coordinates of the triangle
radius
Radius of the triangle

Return

If the supplied x and y values lie within the defined triangle a value of 1 will be returned, otherwise 0.

Description

Lets you easily draw a triangle on the image.

Example

%ffp

ctl(0): "X",range=(0,255),val=150
ctl(1): "Y",range=(0,255),val=100	
ctl(2): "Radius",range=(0,128),val=64

ForEveryTile:
{

	int Draw;

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

		Draw= bTriangle (x,y,ctl(0),ctl(1),ctl(2));

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

		if (Draw) pset(x,y,z,255);

	}}}

	return true;
}

Also see

bRect, bRect, bRect2

Comments

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