i.e.
vx = vy = yz = 0;
for(i=0;i{
vx+=poly.x;
vy+=poly.y;
vz+=poly.z;
}
vx/=poly.num_points;
vy/=poly.num_points;
vz/=poly.num_points;
start.x = vx;
start.y = vy;
start.z = vy;
end.x = vx + poly.normal.x * length;
end.y = vy + poly.normal.y * length;
end.z = vz + poly.normal.z * length;
Then perspective project this line into 2D and plot it.
I understand completely what you said, however, I think I might have been unclear in my original question.
I could find the points along the line normal to the polygon and then prespective project those points from 3D to 2D. This however, would require a divide for each point along the line normal to the polygon. This is the problem I want to avoid. I don't want the extra divides.
The equations I use for perspective projection are x'=(focus*x)/z and y'=(focus*y)/z, where focus is the focal length.
I've contemplated just projecting the normal along with the polygon, but then what do you do when the normal is <1,0,0>. Won't you get a divide-by-zero?
Any help would be greatly appreciated
thanks for the help
It has a start point and an end point, the end point being
start + (length * normal)
If this should result in you getting a point with a z of zero or less then it should be clipped in the same way you clip your poly vertex's.
In fact the view fustrum I used when I wrote my first 3D program clipped everything at about 50cm in front of the camera.
However, from what you've said, you appear to want to find the normals perspective projected values without projecting them.
I can't see how that's possible.