Home
Categories
Coilguns
AVR Projects
Gumstix Projects
PIC Projects
Tutorials
The Forum
Contact Me

If you like this
site please

page counter

OLED 3-D Triangle

6/18/08
Coming Soon!
}else//if the top point and the middle point are vertical
if (Poly_2D[poly_num][topt][0]==Poly_2D[poly_num][side][0]){
slopetb=Poly_2D[poly_num][topt][1]-Poly_2D[poly_num][bott][1];
slopetb/=Poly_2D[poly_num][topt][0]-Poly_2D[poly_num][bott][0];
yinttb=Poly_2D[poly_num][topt][1]-(slopetb*Poly_2D[poly_num][topt][0]);

for (ypt=Poly_2D[poly_num][topt][1];
ypt>=Poly_2D[poly_num][side][1];
ypt--)
{
horz_lines[line_ct][0]=(ypt-yinttb)/slopetb;
horz_lines[line_ct][1]=Poly_2D[poly_num][side][0];
horz_lines[line_ct][2]=ypt;
line_ct++;
}
slopes1=Poly_2D[poly_num][side][1]-Poly_2D[poly_num][bott][1];
slopes1/=Poly_2D[poly_num][side][0]-Poly_2D[poly_num][bott][0];

yints1=Poly_2D[poly_num][side][1]-(slopes1*Poly_2D[poly_num][side][0]);
//use a constant x value
for (ypt=Poly_2D[poly_num][side][1];
ypt>=Poly_2D[poly_num][bott][1];
ypt--)
{
horz_lines[line_ct][0]=(ypt-yinttb)/slopetb;
horz_lines[line_ct][1]=(ypt-yints1)/slopes1;
horz_lines[line_ct][2]=ypt;
line_ct++;
}//second fill is normal