views:

414

answers:

1

I have a very general question. I wish to determine the boundary points of a number of objects (comprising 30-50 closed polygons (z) each having around 300 points(x,y,z)). I am working with a fixed viewport which is rotated about x,y and z-axes (alpha, beta, gamma) wrt origin of coordinate system for polygons.

As I see it there are two possibilities: perspective projection or raytracing. Perspective projection would seem to requires a large number of matrix operations for each point to determine its position is within or without the viewport. Or given the large number of points would I better to raytrace the viewport pixels to object? i.e. determine whether there is an intersection and then whether intersection occurs within or without object(s). In either case I will write this result as 0 (outside) or 1 (inside) to 200x200 an integer matrix representing the viewport

Thank you in anticipation

+5  A: 

Perspective projection (and then scan-converting the polygons in image coordinates) is going to be a lot faster.

The matrix transform that is required in the case of perspective projection (essentially the world-to-camera matrix) is required in exactly the same way when raytracing. However, with perspective projection, you're only transforming the corner points, whereas with raytracing, you're transforming all the points in the image.

Martin B
Thanks for the quick response: however I still need to determine the subset of "corner points" somehow- presumably the maximum distance perpendicular to "camera lens" axis?
mark g
By "corner points", I means the vertices of the polygon. I am assuming that your polygon is defined by a list of vertices. (If that's not the case, how are your polygons defined?) To perform perspective projection on a polygon, it's enough to project the vertices; this is because a perspective projection always maps a straight line in space to a straight line in the image.
Martin B
sure those (vertices) are the 50*300 (x,y,z) points: I was being a bit slow there! Thanks again!
mark g