0
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?

user1468756
  • 331
  • 2
  • 8
  • what do you mean by pts? – Ivaylo Strandjev Jun 26 '12 at 06:44
  • The pts is the points in Point-cloud-data, and being seen in a viewsight sized in (w,h); – user1468756 Jun 26 '12 at 08:43
  • Let me see if I understand your question: You want to to find the normal at a point given the planes made with its neighbors. In other words, for p55 you have 8 incident planes, (p55,p44,p45), (p55,p45,p46), (p55,p46,p56), ..., (p55,p54,p44), minus any planes containing invalid points. Is this correct? – beaker Jun 26 '12 at 17:40
  • Yes, you're right. That is one of the method what I'm thinking about. Could you do me a favor? I try to find the methods to evaluate the normal vector of each point toward the viewsight as exactly as possible. – user1468756 Jun 26 '12 at 23:09

2 Answers2

1

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.

beaker
  • 16,331
  • 3
  • 32
  • 49
  • Thanks. Is taking average means:(n1+n2+...+nN)/N? to the points p55? By the way, if there are thousands of pts, how to speed up? – user1468756 Jun 27 '12 at 22:01
  • The way I understood the question it was just taking the average of the normals for the 8 adjacent triangles. Is this incorrect? – beaker Jun 27 '12 at 22:18
  • Some points are invalid(cannot be seen in the view). For example, p44 p66,p56 are invalid, and there are only p45 p46 p54 p64 p65 around p55 – user1468756 Jun 28 '12 at 08:25
  • Unless you're trying to do this in real-time, I don't see that speed is going to be a problem. – beaker Jun 28 '12 at 15:38
  • To answer your other question, yes, you want (n1+n2+...+nN)/N. Depending on how much information you have about the surface, you might want to take the weighted mean, for instance to favor those polygons that face the viewer or make smaller angles with their neighbors. – beaker Jun 28 '12 at 17:07
  • 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? – user1468756 Jun 29 '12 at 00:09
  • One million points, in real-time, with the highest accuracy. That's a bit different from your original question. Unless you know something about the surface (ideally its function) and can find the gradient (so a continuous function) or you're only changing a few of the points at a time I'm pretty much out of ideas. The only thing I can suggest that *might* work is `isonormals` in Matlab: http://www.mathworks.com/help/techdoc/ref/isonormals.html but I've never used it and have no idea how it will behave on a million points. – beaker Jun 29 '12 at 15:36
  • Ok, it seem to be a bit difficult and it's worth to drill on, I will try. Thanks a lot! – user1468756 Jun 29 '12 at 23:57
0

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

Igor Chubin
  • 61,765
  • 13
  • 122
  • 144
  • It is not a point, but the points in Point-cloud-data, and being seen in a viewsight sized in (w,h). I found some articles discuss about how to evaluate them, but hard to understand. – user1468756 Jun 26 '12 at 08:46
  • Surely I know that. It is the point to the question. The pts are arranged tightly one by one, rows and columns. And the task of us is to found a way to evaluate the normal vector of each point toward our viewsight as more exactly as possible. – user1468756 Jun 26 '12 at 12:14