How to know which faces of a mesh can be seen in a view?(C++)

A file of a model is STL.
I want to get those faces which can be seen in a Top View.
This problem make me feel difficult. :sweat_smile:

@tim, any ideas?

Compute the angle between each face’s normal with the view direction (vector). If the angle is between 0 and 90 degrees, then the face should be visible.

Here is a sample of what I mentioned.

https://github.com/mcneel/Rhino5Samples_CPP/blob/master/SampleCommands/cmdSampleSelectVisibleMeshFaces.cpp

Hi ! dale. I am happy about your help. thanks! :blush:
It will happen this problem.
In addition, why is it slow when those faces which are selected are showed on the view ?
The mesh have a lot of faces. ( 200K~500K polygons)