I'm working with 2D textures, and I want to draw a simple circle, using this function to know if a pixel is or isn't on the circle and then assigning it a color: 
where (a,b) is the center of the circle.
I don't mind if this is a stupid, inefficient way to achieve the effect, I just want to learn how to manipulate floats to draw that circle. Assuming that all the part in C# is correct, and that the Texture is a square, how can I correct my code?
sampler s0;
int radius;
static const float X_c = radius/2;
static const float Y_c = radius/2;
float4 PixelShaderFunction(float2 coords: TEXCOORD0) : COLOR0
{
float4 color = tex2D(s0, coords);
float2 coords_sec = coords*radius*2; //To map coordinates in [0, radius*2] instead of [0,1]
//The same equation as above, just putting to the left radius
if ( ( (int)pow((coords_sec.x - X_c),2)
+ (int)pow((coords_sec.y - Y_c),2)
- (int)pow(radius,2) ) == 0.0 )
{
color.r = 1; //I want to draw a red circle
}
return color;
}
technique Technique1
{
pass Pass1
{
PixelShader = compile ps_2_0 PixelShaderFunction(); //Dice quale versione del pixelshader compilare
}
}
Ps. It seems that I don't draw nothing. I suspect that the if condition is Always false
Second question: is there a simple guide, blog or book to help me understand these concepts (about 2D)?