draw a triangle

Hello...

for a school project, i have to make a program that draws a triangle..
as input you insert the lenght of a,b and c sides..

I don't know how to get the final point C..

I have A(0,0), B(c,0), but can't find out point C.

i'm using SFML to display the triangle..

Any help on how to get the point C?
Last edited on
This may not be the most straight way, but I don't see anything else right now.
First calculate the area of your triangle using http://en.wikipedia.org/wiki/Heron's_formula
Then from area you can calculate height of your triangle h, which is the y coordinate of C.
Then, when you have h, you can find the x coordinate using http://en.wikipedia.org/wiki/Pythagorean_theorem
Ok, thx a lot..

Can you just write me the formula for x? having problems with it :)
p = (a+b+c)/2;
S = sqrt( p * (p-a) * (p-b) * (p-c) );
S = c*h/2, so h = 2*S/c.
that's for the y coordinate right?
Oh. sorry.
when you have y, since point A is at the origin and line AC is named b here,
x*x+y*y = b*b;
, so
x = sqrt( b*b-y*y );
Topic archived. No new replies allowed.