Imagination Technologies Interview Question
Graphics ProgrammersCountry: India
Interview Type: Written Test
Lets Presume these functions are given to you
1. GetPointFromPoints
2. getlen
3. Draw.
Then, the Basic code would be like the following.
void DrawTriangle(point A, point B, point C){
int len =getlen(A,B);
if(len<=MIN_LEN){
return;
}
point D=GetPointFromPoints(A,B,len/2);
point E=GetPointFromPoints(A,C,len/2);
point F=GetPointFromPoints(C,B,len/2);
Draw(D,E); Draw(E,F); Draw(F,D);
DrawTriangle(A, D,E);
DrawTriangle(B, D,F);
DrawTriangle(C, E,F);
}
- Event horizon August 19, 2012