Hi People! Welcome to CG Mughal!
graphicmughal.blogspot.com
A brief intro abt me! I am Rathnavel. Grad student in CG at Texas A&M University, College Station, Texas.
Why blogger ? To showcase some of my cool CG programming and some art works in the web!
What it is not ? It is not a tutorial website! Yeah its a disclaimer :P
Enough of my talk here. Let me start this with a cool image that I drew in C++ using OpenGL.
The function for a heart curve is ((x^2 +y^2 - 1)^3 - x^2y^3). I kinda had to tweak a bit this equation to get the above heart shape.
The code snippet for this method is
void func()
{
float radiusX,radiusY,centerX,centerY;
radiusX=220; radiusY=90; centerX=320; centerY=240;
for(int i=0;i<height;i++)
{
for(int j=0;j<width;j++)
{
int x=(i*width+j)*3;
float bigX=((j-centerX)*(j-centerX));
float bigY=((i-centerY)*(i-centerY));
double first = (double)(bigX+bigY-1000);
double second=(double)(bigX*bigY*(i-centerY));
if((first*first*first)-(second*200) < 500)
{
pixmap[x++]=0x00;
pixmap[x++]=0x99;
pixmap[x]=0x00;
}
else
{
pixmap[x++]=0xFF;
pixmap[x++]=0x99;
pixmap[x]=0x00;
}
}
}
}
This has been drawn on 640X480 2d Window.
See you soon in another post!