Problem with hypotenese Length

  • Thread starter Thread starter Pin Head
  • Start date Start date
  • Tags Tags
    Length
AI Thread Summary
The discussion revolves around calculating the hypotenuse length in a right triangle using trigonometric functions. The initial confusion stemmed from incorrect definitions of the sides and angles, which were later corrected to use the proper relationships. The participant calculated the angle using the inverse tangent function and derived the hypotenuse using cosine and sine functions. A key point raised was the negative value of sideB due to the coordinate system in Java, where y-coordinates increase downwards. The use of the absolute function was suggested to address the negative length issue, but it did not change the final results.
Pin Head
Messages
23
Reaction score
0
sideA = adjacent
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
 

Attachments

  • Untitled.jpg
    Untitled.jpg
    10.8 KB · Views: 458
Mathematics news on Phys.org
Pin Head said:
sideA = adjacent
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

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

Try again?
 
sideA = adjacent
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
 

Attachments

  • Untitled1.jpg
    Untitled1.jpg
    11.6 KB · Views: 423
Pin Head said:
sideA = adjacent
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

Your equations look correct now. How are you generating the figure?
 
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

angle is -0.7853981633974483 in radians

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

find the Y Component
sideC = sideB / sin( angle )
sideC equals 282.842712474619
 
Pin Head said:
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

angle is -0.7853981633974483 in radians

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

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

Why is sideB negative in length?

(the figure I refer to is your drawing of the triange)
 
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
 

Attachments

  • Untitled2.jpg
    Untitled2.jpg
    15.5 KB · Views: 422
There's a little function called Math.abs() ... *wink wink*
 
Hi,
I used Math.abs( y2 - y1 ) which gives me 200 instead of -200 but I still get the same
results anyway
 
Back
Top