Author Topic: Math question: find height from distance and two angles  (Read 6576 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.