Enable contrast version

# Tutor profile: Daniel D.

Inactive
Daniel D.
Video Game Developer tutoring gaming languages.
Tutor Satisfaction Guarantee

## Questions

### Subject:Computer Graphics

TutorMe
Question:

How can you tell if a rendered triangle is facing towards the camera, or away from the camera.

Inactive
Daniel D.

If the triangle has a normal, a negative Z value in the normal, means it is facing away. If you only have the vertices of the triangle, then you can compute the normal. If the triangle has vertices A,B,C the normal is the cross product of the two vectors AB and AC.

### Subject:C Programming

TutorMe
Question:

What is the output on a 16 bit compiler? int a = 257; char *CharPtr = (char *)&a;; int *IntPtr = (int *) &b; a*=2; printf("%d %d,*IntPtr,CharPtr[1]); What if a was 258 at the first line instead?

Inactive
Daniel D.

514 2 A times two, is 514, which is pointed to by IntPtr. CharPtr is only looking at one byte of the answer. 514 in Hex is 0x 0202. So one byte of that answer is 02. If a was 258, that is 0x102 times two, which is 0x204 in hex. This means that the low byte is 4, and the high byte is 2. So if its a little endian platform the answer would be 516 4 For a big endian platform, the answer is 516 2

### Subject:Assembly Language

TutorMe
Question:

When trying to optimize your assembly language program to run as fast as possible, what are some limiting factors to consider?

Inactive
Daniel D.

First and foremost is optimizing for best cache utilization. Random memory accesses that cause your cache lines to get evicted, or written back are extremely latent, and can block execution of your thread. Secondly, unpredictable branches (branches that aren't loops), can cause your instruction pipeline to flush, and restart.

## Contact tutor

Send a message explaining your
needs and Daniel will reply soon.
ContactÂ Daniel