1

How could I got about calculating the surface area of a triangle as it is projected onto the screen. Given projection, view, model matrices and the 3 vertex positions.

1 Answer 1

2
  1. Project the vertices onto the screen with the model-view and projection matrices from your rendering pipeline
  2. Calculate the surface area in 2D with A = sqrt(s*(s-a)*(s-b)*(s-c)) with s = (a+b+c)/2 and a, b, c, the lengths of the three sides of the triangle using some 2D vector math (this is Heron's formula)
2
  • by the way, do be careful to use the right model-view matrix, this one is constantly changing while your rendering your scene due to the rotate/translate calls etc that you make. You need to do your calculation at the point you render the triangle or save the model-view matrix used at that time for reuse when you're calculating this area.
    – wich
    Oct 18, 2012 at 1:59
  • I'm doing this in a shader, so the matrices I'm sending are the ones used for rendering Oct 18, 2012 at 2:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.