Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Math (geometry) question
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Off the Wall
View previous topic :: View next topic  
Author Message
TlighT
n00b
n00b


Joined: 15 Dec 2003
Posts: 32

PostPosted: Mon Aug 30, 2004 4:14 pm    Post subject: Math (geometry) question Reply with quote

I need this for a piece of software I'm developing, please help me find the solution:
[img:41bb8b98ab]http://home.wanadoo.nl/j.van.hengstum/oplossing.gif[/img:41bb8b98ab]

The known variables are w, h, r and angle alfa. I need the length of line piece OQ.

edit:
images don't work? The url is http://home.wanadoo.nl/j.van.hengstum/oplossing.gif


Last edited by TlighT on Mon Aug 30, 2004 5:24 pm; edited 1 time in total
Back to top
View user's profile Send private message
nsadhal
n00b
n00b


Joined: 12 Jul 2002
Posts: 34
Location: Berkeley, CA

PostPosted: Mon Aug 30, 2004 5:04 pm    Post subject: Reply with quote

I think it's just solving two simultaneous equations:

I didn't really want to simplify it... because it doesn't look like would be much cleaner

d = length of OQ
beta = angle between x axis and segment r (unknown for now)

d*cos(alpha) - w = r*cos(beta)
d*sin(alpha) - h = r*sin(beta)

arccos((d*cos(alpha) - w) / r) = beta

d = (r*sin( arccos( (d*cos(alpha) - w)/r) ) + h) / sin(alpha)

I may have made tyops in the solution, so check it... or just use a symbolic solver (e.g. TI-89) to solve those two equations above. I think that's it.
_________________
It makes me so mad I wanna grab my sawed off, and get some bodies hauled.
Back to top
View user's profile Send private message
paranode
l33t
l33t


Joined: 06 Mar 2003
Posts: 679
Location: Texas

PostPosted: Mon Aug 30, 2004 5:05 pm    Post subject: Reply with quote

So if I'm not mistaken, you'd find the diagonal of the box with Pythagorean theorem then use law of cosines perhaps to get the other side of the triangle you form with r, the diagonal, and OQ.
_________________
Meh.
Back to top
View user's profile Send private message
krolden
Apprentice
Apprentice


Joined: 28 May 2004
Posts: 293
Location: Belgium

PostPosted: Mon Aug 30, 2004 5:17 pm    Post subject: Reply with quote

How about this:

First use Pythagoras to get the diagonal of the box.

OQ = r + unknown part pQ

Consider the triangle Qpx where x is the left beneath corner of the box.
The corner of p is 90°
Corner of x is 45° (diagonal)

Hence the corner of Q is 180° - 90° - 45° = 45°
cos 45° * diagonal = pQ

=> QP = r + pQ
Back to top
View user's profile Send private message
lisa
Retired Dev
Retired Dev


Joined: 01 Jun 2003
Posts: 273
Location: York, UK again! Horray!

PostPosted: Mon Aug 30, 2004 6:44 pm    Post subject: Reply with quote

OQ = r + n + e

r = Radius (given)
n = Sin^-1[h/α]
e = Cos^-1[d/α]
d = w - Cos^-1[Sin^-1[h/α]/α]/2

Thus:

OQ = r + Sin^-1[h/α] + Cos^-1[[w - Cos^-1[Sin^-1[h/α]/α]/2]/α]

I'll put a graphic up in a little bit to show my work.

http://www.thedoh.com/~lisa/tmp/geometry/index_gr_1.gif
http://www.thedoh.com/~lisa/tmp/geometry/index_gr_2.gif
http://www.thedoh.com/~lisa/tmp/geometry/oplossing.png

To explain work:

1. Line segment OQ intersects the rectangle thus giving us a similar angle setup.
2. Part of line segment OQ is the same as r since they're the radius of the same quarter-circle.
3. The first step is to find the length of the hypotenuse of the triangle created by the intersection of line segment OQ into the square (which I have marked n)

n = ArcSin[h/α] -- basic trigonometry

4. Next we have to find the length of the missing piece (which I have marked e). We do this by creating a right-angle triangle by dropping a line segment to the point where line segment OQ intersects the quarter-circle.

5. Now we have to find out the length of the adjacent side (which I have marked d) of the triangle we just created. This is a three step process:

5a. We need to find the length of the side that's outside of the first right triangle (we found its hypotenuse in step 3). I've marked this mystery side b and since we know that a rectangle's permiter can be written: p=2w+2h we can say that the total length of our mystery side is: w = b + (adjacent side to the triangle from step 3).

5b. The adjacent side to the triangle from step 3 can be found in two ways, I'll do it this way:k = ArcCos[n/α]. Substituting what we have for n, k = ArcCos[ArcSin[h/α]/α].

5c. Now we can find the length of b:
b = w - k.
Substituting for k, b = w - ArcCos[ArcSin[h/α]/α]

6. d is half the length of b, so, d = [w - ArcCos[ArcSin[h/α]/α]]/2

7. The hypotenuse, e, of that triangle is: ArcCos[[[w - ArcCos[ArcSin[h/α]/α]]/2]/α]

OQ = r + n = ArcSin[h/α] + ArcCos[[[w - ArcCos[ArcSin[h/α]/α]]/2]/α]

Not pretty.
_________________
Distcc guide
Visit my website
I maintain Distcc, Ccache, Memcached, and some others (i think)
Back to top
View user's profile Send private message
gralves
Guru
Guru


Joined: 20 May 2003
Posts: 389
Location: Sao Paulo, Brazil

PostPosted: Mon Aug 30, 2004 7:45 pm    Post subject: Reply with quote

Thanks for the problem, it's been a while since I had an geometry problem to work on.

(d*sin(a), d*cos(a)) = (w,h) + (r*sin(B) , r*cos(B))

where d = lenght of OQ, B = angle between r and the horizontal axis.

isolating B (by dividing the x by the y part of the vector equation above):

tg (a) = (w + r * sin (B))/( h + r * cos (B))

K1 = asin ((w - tg(a)*h) / ( r * sqrt (1 + tg(a)*tg(a))))
K2 = arctg ( -cotg(a))
B = K1 - K2

then:

d = (w + r sin (B)) / sin (A)

or

d = (h + r cos (B)) / cos (A)

In python:

Code:

import math

def boxed(r,w,h,a):
   """ Enter a in radians"""

   tga = math.tan(a)
   K1 = math.asin( (w - tga*h) / (r * math.sqrt(1 + (tga ** 2))) )
   K2 = math.atan( - 1 / tga )
   d = (h + r*math.cos(K1-K2)) / math.cos (a);
   return d
Back to top
View user's profile Send private message
TlighT
n00b
n00b


Joined: 15 Dec 2003
Posts: 32

PostPosted: Mon Aug 30, 2004 9:29 pm    Post subject: Reply with quote

Thanks for the answers. One way, I'm glad to see the solution is not that straightforward (as to not totally insult my math skills). I'm going to look at the solutions tomorrow, since they are already warping my fragile little mind at this late hour.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Off the Wall All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum