# Problem with hypotenese Length

1. May 9, 2012

sideB = opposite
sideC = hypotenese

Find Angle

angle = inverse tan = sideA / sideB

Find side

find the X component
sideC = cos( angle ) * sideA

find the Y Component
sideC = sin( angle ) * sideB

So my question is is how or why is my hypotenese line being displayed shorter than

File size:
10.8 KB
Views:
123
2. May 9, 2012

### Staff: Mentor

Your definitions of the angle and the cos() and sin() are wrong.

Try again?

3. May 9, 2012

sideB = opposite
sideC = hypotenese

Find Angle

angle = inverse tan = sideB / sideA

Find side

find the X component
sideC = sideA / cos( angle )

find the Y Component
sideC = sideB / sin( angle )

I think I got the formula wrote the wrong way but now my Image looks like this

File size:
11.6 KB
Views:
110
4. May 9, 2012

### Staff: Mentor

Your equations look correct now. How are you generating the figure?

5. May 9, 2012

Hi,
I don't no what you mean by figure?
but here is what I have done

sideA = x2 - x1 which equals 200pixels
sideB = y2 - y1 which equals -200pixels

angle = inverse tan = sideB / sideA

find the X component
sideC = sideA / cos( angle )
sideC equals 282.84271247461896

find the Y Component
sideC = sideB / sin( angle )
sideC equals 282.842712474619

6. May 9, 2012

### Staff: Mentor

Why is sideB negative in length?

(the figure I refer to is your drawing of the triange)

7. May 9, 2012

hi,
because in Java programming the x coordinates travel across the screen and the y coordinates travel down the screen so when I use the formula y2 - y1 then we are travelling
up the screen which gives us negative 200

File size:
15.5 KB
Views:
109
8. May 9, 2012

### Whovian

There's a little function called Math.abs() ... *wink wink*

9. May 9, 2012