Hello, I'm doing an assignment where I need to create a slope/direction field and an intensity map for a given function. I have no problems getting my data, that was quite simple, I have an image that I turn into a matrix and then I use the matrix to do various calculations. What I basically have right now is a results matrix that is split with elements in columns as follows:

So essentially I have a table where you look at your given xy-coordinate and this corresponds to a vector in 3D space, which has a certain intensity value (illumination). The intensity value is for a grayscale image from 0-255, where 255 is the brightest (white) and 0 is the darkest (black). What I'm trying to do now is first take my original image matrix and based on the slope create by the components at (normal i, normal j) I will create a short slope field for that given pixel. Then I want to use the normal i, normal j data to create an intensity map where I will plot (i,j) and then it will be assigned in an intensity.

To give an idea of the intensity map I did a quick search and this is bassically what I want to do: Intensity Map
So my (i,j) will be given a gray value from the illumination source (I can easily do that), I just need help in figuring out how to create these graphs/images.

For the direction field I am essentially looking to create an image like this: Slope Field

I come from a different programming background (MATLAB) so this all boils down to syntax issues and knowledge of C++ functions and libraries (those I do not know so well).

I'll post some sample code of the loop I've used to create my data table. Bear with crazy coding. :D

Slope = Table_Sphere_All[i][3] / Table_Sphere_All[i][3];
// Now using this slope, I make a small line at the point, but I'm
// not sure how I can do this.

// I thought that I could take the value of my pixel and then
// subtract 0.1 (get a point), add 0.1 (get a point) and then
// have a small plot at each point, and you make slopes that
// way. I just need help figuring out how to graph this
Graph 1;
}

Code:

// Intensity Map (I know they can be in the same loop, but separate for this explanation.)

int Intensity1; // Will int truncate the value? I would rather have it round the values to an integer.
int Intensity2;
int Intensity3;

for (int i = 0; i < Count; i++)
{
Table_Sphere_All[i][2]; // normal i
Table_Sphere_All[i][3]; // normal j
// I need to Plot these points and assign a gray value to them.

A slope graph can be accomplished using a Sobel filter on x and y. The normal map can be computed by multiplying the vertex normal by pure white or 255,255,255 (Normalized: 1.0f,1.0f,1.0f). This means that white would indicate a normal of 1.0f,1.0f,1.0f.