Question

float pts[N][4]={{x1,y1,z1,v1},{x2,y2,z2,v2},...,{xN,yN,zN,vN}};
//in viewsight(0,0)-(w,h);
//N==w*h
//if pts[n][3]==0 then pts[n] is invalid

How to evaluate the normal vectors for each valid pts?

The pts is the points in Point-cloud-data, and being seen in a viewsight sized in (w,h);

something like this:

p11,p12,p13...p1w,
p21,p22,p23...p2w,
...
...
ph1,ph2,ph3...phw,

Each point is assosiated by their neighbors, and generate a surface together to us.

The pts are arranged tightly one by one, rows and columns. And the task of us is to find a way to evaluate the normal vector of each point toward our viewsight as more exactly as possible.

I'm trying to do this in real-time indeed for the pts is generated in real-time. For example counting 1024x1024 pts at a time. Is there a resolution someone have publish before?

Was it helpful?

Solution

Typically, the normal for a vertex on a surface is calculated as the mean of the normal vectors of the adjacent polygons. See: http://www.opengl-redbook.com/appendices/AppH.pdf

In this case, for vertex p55 with the following neighbors:

p44 p45 p46
p54 p55 p56
p64 p65 p66

you could find the normals for each of the triangles,

n1 = (p55 - p44) x (p55 - p45)
n2 = (p55 - p45) x (p55 - p46)
...

making sure to preserve the orientation of the vectors so that all of the normals point in the same direction (toward the viewer). From there you just have to normalize all of the vectors and then take their average.

OTHER TIPS

It is impossible to evaluate the normal vector for a point. A point can not have the normal vector. A plane can.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top