Author Topic: Math question: find height from distance and two angles  (Read 6578 times)

0 Members and 1 Guest are viewing this topic.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Math question: find height from distance and two angles
« on: June 20, 2013, 09:31:21 PM »
I'm totally blanking on how to find the height and I can't find the solution on line. Could someone much smarter than I am please tell me how?

I have two angles: 90°53'36" and 85°26'05", with a distance of 205.12'.

Thanks, guys.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

paulmcz

  • Bull Frog
  • Posts: 202
Re: Math question: find height from distance and two angles
« Reply #1 on: June 20, 2013, 10:33:39 PM »
I am not sure I understand your problem correctly but if that is a triangle with two angles and a side between them, this should work.

Code: [Select]
(defun dtr (x)
(* pi (/ x 180.000)))

(defun tan (xx)
(/ (sin xx)(cos xx)))

(setq a (- pi (dtr 90.8933333333))
      b (dtr 85.434722222)
      d 205.12
      h (/ (* (tan b) d (tan a))(- (tan a)(tan b))))

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Math question: find height from distance and two angles
« Reply #2 on: June 20, 2013, 11:03:33 PM »
Alan, We want pictures ! 

:)
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

diarmuid

  • Bull Frog
  • Posts: 417
Re: Math question: find height from distance and two angles
« Reply #3 on: June 25, 2013, 07:30:03 AM »
Not being crazy but, given the information, could you not just draw the triangle in AutoCAD and then measure from it?
If you want to win something run the 100m, if you want to experience something run a marathon

Rob...

  • King Gator
  • Posts: 3824
  • Take a little time to stop and smell the roses.
Re: Math question: find height from distance and two angles
« Reply #4 on: June 25, 2013, 07:31:46 AM »
That's what I would have done but was thinking the OP wanted the mathematical solution.
CAD Tech

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Math question: find height from distance and two angles
« Reply #5 on: June 25, 2013, 08:15:48 AM »
Yes, I could have just done it in cad, but I couldn't remember the formula and that's what I was looking for.

BTW, thank you, Paul.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Math question: find height from distance and two angles
« Reply #6 on: June 25, 2013, 08:49:46 AM »
Alan,
Do you have Terry's routine?
Code: [Select]
;|
Here is  a TRI  function that  I wrote  last year  for calculating the sides and
angles of right and oblique triangles.  The function is fairly easy to  use.  It
has six arguments:  Side s1, Side  s2, Side s3,  Angle a, Angle  b, and Angle c.
Angles are  in radians.   It returns  a 1  based list  so you  can use the ‘nth’
function to retrieve your results.   To display the text help  information, just
type (tri ? ? ? ? ? ?) on the command line as follows:
Note: This displays better using a courier or mono-spaced font.
Command: (tri ? ? ? ? ? ?)
tri error: (tri nil nil nil nil nil nil)
Only 2 or 3 valid arguments can be passed to tri function.
tri - Calculates the sides and angles of a triangle
Arguments: 6             |\                /\
  s1 = Side s1           |a\              /a \
  s2 = Side s2           |  \            /    \
  s3 = Side s3        s2 |   \ s3    s2 /      \ s3
  a = Angle a radians    |    \        /        \
  b = Angle b radians    |c___b\      /c________b\
  c = Angle c radians      s1              s1
Syntax example: (tri 3 ? ? 0.643501 ? ?);where ? = nil
Returns: (list nil 3.0 4.0 5.0 0.643501 0.927295 1.5708)
Note: For right triangles only supply the argument values for 2 sides,
or 1 side and 1 angle. Use ? or nil for the Angle c argument value.
For oblique triangles only supply argument values for 3 sides,
or 2 sides and 1 angle, or 1 side and 2 angles.
|;

;-------------------------------------------------------------------------------
; tri - Calculates the sides and angles of a triangle
; Arguments: 6             |                 /\
;   s1 = Side s1           |\               /a \
;   s2 = Side s2           |a\             /    \
;   s3 = Side s3        s2 |  \ s3     s2 /      \ s3
;   a = Angle a radians    |   \         /        \
;   b = Angle b radians    |c__b\       /c________b\
;   c = Angle c radians      s1              s1
; Syntax example: (tri 3 ? ? 0.643501 ? ?);where ? = nil
; Returns: (list nil 3.0 4.0 5.0 0.643501 0.927295 1.5708);nth 1 based list
; Note: For right triangles only supply the argument values for 2 sides, or
; 1 side and 1 angle. Use ? or nil for the Angle c argument value. For oblique
; triangles only supply argument values for 3 sides, or 2 sides and 1 angle,
; or 1 side and 2 angles.
; Programming example usages:
; (setq Side2 (nth 2 (tri 3 ? ? 0.643501 ? ?))) = 4.0
; (setq AngleB (nth 5 (tri 3 ? ? 0.643501 ? ?))) = 0.927295
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Math question: find height from distance and two angles
« Reply #7 on: June 25, 2013, 08:52:58 AM »
Alan,
Do you have Terry's routine?
Code: [Select]
;|
Here is  a TRI  function that  I wrote  last year  for calculating the sides and
angles of right and oblique triangles.  The function is fairly easy to  use.  It
has six arguments:  Side s1, Side  s2, Side s3,  Angle a, Angle  b, and Angle c.
Angles are  in radians.   It returns  a 1  based list  so you  can use the ‘nth’
function to retrieve your results.   To display the text help  information, just
type (tri ? ? ? ? ? ?) on the command line as follows:
Note: This displays better using a courier or mono-spaced font.
Command: (tri ? ? ? ? ? ?)
tri error: (tri nil nil nil nil nil nil)
Only 2 or 3 valid arguments can be passed to tri function.
tri - Calculates the sides and angles of a triangle
Arguments: 6             |\                /\
  s1 = Side s1           |a\              /a \
  s2 = Side s2           |  \            /    \
  s3 = Side s3        s2 |   \ s3    s2 /      \ s3
  a = Angle a radians    |    \        /        \
  b = Angle b radians    |c___b\      /c________b\
  c = Angle c radians      s1              s1
Syntax example: (tri 3 ? ? 0.643501 ? ?);where ? = nil
Returns: (list nil 3.0 4.0 5.0 0.643501 0.927295 1.5708)
Note: For right triangles only supply the argument values for 2 sides,
or 1 side and 1 angle. Use ? or nil for the Angle c argument value.
For oblique triangles only supply argument values for 3 sides,
or 2 sides and 1 angle, or 1 side and 2 angles.
|;

;-------------------------------------------------------------------------------
; tri - Calculates the sides and angles of a triangle
; Arguments: 6             |                 /\
;   s1 = Side s1           |\               /a \
;   s2 = Side s2           |a\             /    \
;   s3 = Side s3        s2 |  \ s3     s2 /      \ s3
;   a = Angle a radians    |   \         /        \
;   b = Angle b radians    |c__b\       /c________b\
;   c = Angle c radians      s1              s1
; Syntax example: (tri 3 ? ? 0.643501 ? ?);where ? = nil
; Returns: (list nil 3.0 4.0 5.0 0.643501 0.927295 1.5708);nth 1 based list
; Note: For right triangles only supply the argument values for 2 sides, or
; 1 side and 1 angle. Use ? or nil for the Angle c argument value. For oblique
; triangles only supply argument values for 3 sides, or 2 sides and 1 angle,
; or 1 side and 2 angles.
; Programming example usages:
; (setq Side2 (nth 2 (tri 3 ? ? 0.643501 ? ?))) = 4.0
; (setq AngleB (nth 5 (tri 3 ? ? 0.643501 ? ?))) = 0.927295
I do not, but that looks rather impressive.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

ribarm

  • Gator
  • Posts: 3279
  • Marko Ribar, architect
Re: Math question: find height from distance and two angles
« Reply #8 on: June 25, 2013, 09:24:36 AM »
Alan, in case you didn't google it, here is link :

http://www.theswamp.org/index.php?topic=15698.msg191722#msg191722
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

paulmcz

  • Bull Frog
  • Posts: 202
Re: Math question: find height from distance and two angles
« Reply #9 on: June 25, 2013, 09:36:04 AM »
Yes, I could have just done it in cad, but I couldn't remember the formula and that's what I was looking for.

BTW, thank you, Paul.

You are welcome.
Here is how I came to the formula (attached). No Google.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Math question: find height from distance and two angles
« Reply #10 on: June 25, 2013, 10:15:31 AM »
Thanks for the link, I was missing that.  8)

Alan, in case you didn't google it, here is link :

http://www.theswamp.org/index.php?topic=15698.msg191722#msg191722
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

MeasureUp

  • Bull Frog
  • Posts: 462
Re: Math question: find height from distance and two angles
« Reply #11 on: June 25, 2013, 09:19:39 PM »
I am not sure I understand your problem correctly but if that is a triangle with two angles and a side between them, this should work.

Code: [Select]
(defun dtr (x)
(* pi (/ x 180.000)))

(defun tan (xx)
(/ (sin xx)(cos xx)))

(setq a (- pi (dtr 90.8933333333))
      b (dtr 85.434722222)
      d 205.12
      h (/ (* (tan b) d (tan a))(- (tan a)(tan b))))

Sorry, I think the height in your code should be:
(setq h (/ (* (tan b) d (tan a)) (+ (tan a) (tan b))))

paulmcz

  • Bull Frog
  • Posts: 202
Re: Math question: find height from distance and two angles
« Reply #12 on: June 25, 2013, 09:44:45 PM »
I disagree

MeasureUp

  • Bull Frog
  • Posts: 462
Re: Math question: find height from distance and two angles
« Reply #13 on: June 25, 2013, 10:19:58 PM »
I disagree
Have you tried what Alan given and drawn it in AutoCAD?
Angle 1 = 90.8933333333 deg
Angle 2 = 85.434722222 deg
Distance = 205.12
What would you get for the height?
Would it be the same as what you calculated from your code?
Thanks.

paulmcz

  • Bull Frog
  • Posts: 202
Re: Math question: find height from distance and two angles
« Reply #14 on: June 25, 2013, 10:32:09 PM »
Yes, I did draw it and measured to verify my code result. See the attached drawing in my second post here.

paulmcz

  • Bull Frog
  • Posts: 202
Re: Math question: find height from distance and two angles
« Reply #15 on: June 25, 2013, 10:39:25 PM »
Your correction would work only if both angles were less than 90 deg.

MeasureUp

  • Bull Frog
  • Posts: 462
Re: Math question: find height from distance and two angles
« Reply #16 on: June 25, 2013, 11:10:48 PM »
Your correction would work only if both angles were less than 90 deg.
Not really. It works for angles greater than 90deg as well.

From your code the height = 3192.2655
while the height measured on the drawing = 2149.1800, which is based on these:
Angle a = 90.8933333333 deg
Angle b = 85.434722222 deg
Distance = 205.12

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Math question: find height from distance and two angles
« Reply #17 on: June 26, 2013, 12:33:43 AM »
I think you guys need to go back and define your terms.

The decision to add or subtract the divisor components depends on the way the larger angle is measured.
You are using different criteria.
« Last Edit: June 26, 2013, 12:37:08 AM by Kerry »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Math question: find height from distance and two angles
« Reply #18 on: June 26, 2013, 12:58:53 AM »
For instance :
using the internal angles as per the sketch attached is correct.

Using (- pi (dtr 100)) as Paul has done requires the divisor components be negated (as he has done).

So you are both correct, or both incorrect or whatever
« Last Edit: June 26, 2013, 01:08:45 AM by Kerry »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Math question: find height from distance and two angles
« Reply #19 on: June 26, 2013, 01:14:44 AM »
In answer to a PM.
The app is 'Pencil' ..
http://pencil.evolus.vn/Features.html
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

MeasureUp

  • Bull Frog
  • Posts: 462
Re: Math question: find height from distance and two angles
« Reply #20 on: June 26, 2013, 01:16:29 AM »
Thanks to Kerry's explanations.

OK, lets go back to the starting point.
I don't know if Alan has already looked Paul's drawing.
I know that is not easy when translating the words to the drawing.
Generally speaking, our discussions should be all based on the same coordinate system, which means that all angles measured anticlockwise from X axis.
By looking at your drawing, the angle "A" you described actually differs to what Alan given.
Alan's: 90°53'36"
and yours: 180° - 90°53'36" = 89°06'24"
This explains why you got the height of 3192.2655
In other words, the angle "A" in your code can be simplified to:
(setq a (dtr 90.8933333333))

I attache my version here. Hope I have not misunderstood Alan's issue.
« Last Edit: June 26, 2013, 01:20:09 AM by MeasureUp »

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Math question: find height from distance and two angles
« Reply #21 on: June 26, 2013, 01:21:51 AM »
MeasureUp,
Your triangles are acute ;
Pauls is obtuse


I guess this whole thread is a perfect example of one of my favourite topics .. making sure we are all answering the correct question.

added:
For what it's worth, my assumptions about the problem were the same as Pauls ie the angles given represented the internal triangle angles.

« Last Edit: June 26, 2013, 01:35:10 AM by Kerry »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

MeasureUp

  • Bull Frog
  • Posts: 462
Re: Math question: find height from distance and two angles
« Reply #22 on: June 26, 2013, 01:34:42 AM »
MeasureUp,
Your triangles are acute ;
Pauls is obtuse


I guess this whole thread is a perfect example of one of my favourite topics .. making sure we are all answering the correct question.
Thanks Kerry, again.
We shall now wait and see what Alan will say.  :-D
Of course, Paul can check if I haven't miss any points from you.

paulmcz

  • Bull Frog
  • Posts: 202
Re: Math question: find height from distance and two angles
« Reply #23 on: June 26, 2013, 07:16:02 AM »
As Kerry is saying, your triangle is acute. But, Alan specified one angle acute and the other obtuse.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Math question: find height from distance and two angles
« Reply #24 on: June 26, 2013, 08:49:36 AM »
Strange, I would always assumed we were talking Internal Angles with a triangle.
Other wise the orientation of the triangle comes into play.  :o

I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Rob...

  • King Gator
  • Posts: 3824
  • Take a little time to stop and smell the roses.
Re: Math question: find height from distance and two angles
« Reply #25 on: June 26, 2013, 08:59:22 AM »
Strange, I would always assumed we were talking Internal Angles with a triangle.

<fake southern drawl>That's the way I was learnt to do it.
CAD Tech

MeasureUp

  • Bull Frog
  • Posts: 462
Re: Math question: find height from distance and two angles
« Reply #26 on: June 26, 2013, 08:42:25 PM »
By looking at Paul's drawing again, lets think in this way, we now draw 2 construction lines.
One to the angle of 90.8933333333deg and another to 85.434722222deg.
If the 1st one placed on left while the 2nd on the right, we all know that they never intersect physically.
This is what the info was given by Alan.
It only makes sense if the 1st construction line drawn on the right.
Agree?
If we have a building/civil/survey background, we may better understand the info which Alan's given.
Hope I have explained what I think clearly.