Area of triangle in a different coordinate system.

127 Views Asked by At

This is for an android application but I think it is too mathematical to put on normal SO.

I have a coordinate system where the origin is (0, 0), and the x and y axis go from -1 to 1. This coordinate system represents my screen.

I have 3 vertices in the system that represent a triangle and I would like to calculate the area of the triangle.

I first calculate the length of every line and then I use Heron's formula to calculate the area.

The problem is, the area I get is for the coordinate system -1 to 1 in the x and y, with a 0 ,0 origin. However, I would like the area of the triangle in terms of my actual screen dimensions. What is the most efficient way I can convert the area?

I was thinking I might be able to do something with the aspect ratio of my screen but I just don't know.

enter image description here

1

There are 1 best solutions below

6
On BEST ANSWER

You want the area scaled up to your screens size.
Here are the constants used

$A$: the area of the triangle in the coordinate system
$w_s$: the width of the screen
$w_c$: the width of the coordinate system
$h_s$: the height of the screen
$h_c$: the height of the coordinate system

Then this is the area of the triangle scaled to your screen $$A\times\frac{w_s}{w_c}\times\frac{h_s}{h_c}$$