Jump to content

How to Work out TAN for trigonometry


Recommended Posts

Posted

I have searched the forum and tried to figure this out. How do i work out TAN?

Why doesn't AutoLISP even not have this available?

 

I have tried reading various posts on it but can't make any sense of any of it and was surprised to not find one thread on it in the search on this forum

 

All I want to do is work out the opposite side of a triangle.

 

I have the adjacent length and the angle but with all these radians and degrees and other crap I just can't get it to work.

 

When I use a calculator I solve it in a second. But not with AutoLISP.

 

HDhFEIgsB2Q4sTZABRJ6Sp2OHCCKRhYBsB5YmyAAiT8nTsUMEkchCQLYDSxNkAJGn5OnYIYJIZCEg24GlCTKAyFPydOwQQSSyEJDtwNIEGUDkKXk6doggElkIyHZgaYIMIPK0Iwr+H9qNe7mMkiUQAAAAAElFTkSuQmCCattachment.php?attachmentid=56438&cid=1&stc=1

In the image above, I know the angle 25 degrees and the adjacent which is 600mm (not shown) I need to work out the opposite (shown as 279.78mm)

 

I have tried:

(/ (sin 25)(cos 25))

But that works out different than the calculator. I think because of radians. So I convert the radians to degrees and still get the wrong answer.

 

I think LISP should stand for "Lost is Stupid Pythagorean (Theory)"

 

Please help.

Trig.JPG

Posted

I tried to Google your problem, and the first one was this site.

 

I am sure there are many more sources of information.

 

P.S. if you are using whole angles, the hypotenuse length is 662.03

Posted

thanks, yeah i saw that. Just can't get any of the code to work the way i want it to. I know the info is there, I just don't understand why my code doesn't work

Posted

Ok, I think I have it sorted out. I don't understand why this works exactly or even understand the formula but this is how to work out the opposite side of a right angled triangle when you know the adjacent side and angle

 

[color=red]([/color][color=royalblue]setq[/color] AngInDegrees[color=seagreen] 25[/color][color=red])[/color][color=gray]; In this example, I set the angle to 25 degrees (not radians)[/color]
[color=red]([/color][color=royalblue]setq[/color] SIDE [color=seagreen]600[/color][color=red])[/color][color=gray]; In this example I set the opposite side to 600mm)[/color]

[color=red]([/color][color=royalblue]setq[/color] AngInDegrees-90 [color=red]([/color][color=royalblue]-[/color] AngInDegrees [color=seagreen]90[/color][color=red]))[/color][color=gray];I then minus 90 from the the 25 [/color] 
[color=red]([/color][color=royalblue]setq[/color] c [color=red]([/color][color=royalblue]/[/color] SIDE [color=red]([/color][color=royalblue]sin[/color] [color=red]([/color][color=royalblue]*[/color] AngInDegrees-90 [color=red]([/color][color=royalblue]/ pi [/color][color=seagreen]180[/color][color=red])))))[/color][color=gray];Do some formula[/color] 
[color=red]([/color][color=royalblue]setq[/color] b [color=red]([/color][color=royalblue]sqrt [/color][color=red]([/color][color=royalblue]-[/color] [color=red]([/color][color=royalblue]*[/color] c c[color=red])[/color] [color=red]([/color][color=royalblue]*[/color] SIDE SIDE[color=red]))))[/color][color=gray];Do some formula[/color]

What you end up with is a triangle where the opposite side equals 279.78mm. The value of SETQ b = 279.78mm

 

So it works and if you need to work out this type of triangle this formula will work. Just replace the variable names to suit your own needs.

 

I wrote all that out so if someone searches for it i the future it may be helpful....and someone might even find it from a google search

Posted

thanks Lee, you posted as I was writing my last response. i will have to look at that. Than ks everyone.

Posted
I don't understand why this works exactly or even understand the formula but this is how to work out the opposite side of a right angled triangle when you know the adjacent side and angle

[color=red]([/color][color=royalblue]setq[/color] AngInDegrees[color=seagreen] 25[/color][color=red])[/color][color=gray]; In this example, I set the angle to 25 degrees (not radians)[/color]
[color=red]([/color][color=royalblue]setq[/color] SIDE [color=seagreen]600[/color][color=red])[/color][color=gray]; In this example I set the opposite side to 600mm)[/color]

[color=red]([/color][color=royalblue]setq[/color] AngInDegrees-90 [color=red]([/color][color=royalblue]-[/color] AngInDegrees [color=seagreen]90[/color][color=red]))[/color][color=gray];I then minus 90 from the the 25 [/color] 
[color=red]([/color][color=royalblue]setq[/color] c [color=red]([/color][color=royalblue]/[/color] SIDE [color=red]([/color][color=royalblue]sin[/color] [color=red]([/color][color=royalblue]*[/color] AngInDegrees-90 [color=red]([/color][color=royalblue]/ pi [/color][color=seagreen]180[/color][color=red])))))[/color][color=gray];Do some formula[/color] 
[color=red]([/color][color=royalblue]setq[/color] b [color=red]([/color][color=royalblue]sqrt [/color][color=red]([/color][color=royalblue]-[/color] [color=red]([/color][color=royalblue]*[/color] c c[color=red])[/color] [color=red]([/color][color=royalblue]*[/color] SIDE SIDE[color=red]))))[/color][color=gray];Do some formula[/color]

 

Your code is essentially calculating the length of the hypotenuse using the known adjacent side & angle, and then using Pythagoras' Theorem to calculate the remaining unknown side length.

 

You can omit the subtraction of 90 degrees by simply replacing sin with cos.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...