Author Topic: I needs a help (simple math)  (Read 1146 times)

0 Members and 1 Guest are viewing this topic.

Offline iDante

  • Veteran
  • *****
  • Posts: 1967
I needs a help (simple math)
« on: July 27, 2008, 02:04:41 am »
Well, here's a simple math problem for you peoples. In relation to the coordinates of the verticies of each of these triangles, how do you find the coordinate of the green dot that is not on the triangle?

Offline Pie

  • Flagrunner
  • ****
  • Posts: 761
Re: I needs a help (simple math)
« Reply #1 on: July 27, 2008, 02:27:48 am »
hypotenuse?

But you'd need the mesurements? What exactly do you want to know? the distance between the dots? What?
Lol, internets.

Offline marine b. harm

  • Major(1)
  • Posts: 4
  • ~niggas aint nothing but hos w/ tricks~
Re: I needs a help (simple math)
« Reply #2 on: July 27, 2008, 02:30:32 am »
rotate them until the blue lines are at the same angle, cut+paste them next to each other, compare

hope this helps

tonight i'm gonna have myself a real good time
i feel alive

Offline The Geologist

  • Inactive Staff
  • Flagrunner
  • *****
  • Posts: 909
Re: I needs a help (simple math)
« Reply #3 on: July 27, 2008, 02:52:51 am »
That diagram is really confusing...I see gray lines all over the place in the left side.  What information on lengths and angles do you have?
With all its sham, drudgery, and broken dreams it is
still a beautiful world.  Strive to be happy.

Offline iDante

  • Veteran
  • *****
  • Posts: 1967
Re: I needs a help (simple math)
« Reply #4 on: July 27, 2008, 03:15:16 am »
I have the verticies of the triangle (red) and therefore ONE of the green points.
I have the DISTANCE between the green points.
They are all on a coordinate plane (might have been good to say).
I need a way to compute the green point that is on the triangle's extended side made up of the 2 verticies that aren't the green one. If you draw a perpendicular line through said extended line it goes through both green dots.

Edit: Here's a simplified picture.
« Last Edit: July 27, 2008, 03:22:39 am by iDante »

Offline marine b. harm

  • Major(1)
  • Posts: 4
  • ~niggas aint nothing but hos w/ tricks~
Re: I needs a help (simple math)
« Reply #5 on: July 27, 2008, 03:25:46 am »
draw a line from p to l that is at a 90 degree angle to l it's not super hard

tonight i'm gonna have myself a real good time
i feel alive

Offline iDante

  • Veteran
  • *****
  • Posts: 1967
Re: I needs a help (simple math)
« Reply #6 on: July 27, 2008, 03:37:59 am »
draw a line from p to l that is at a 90 degree angle to l it's not super hard
well obviously. The thing is, I need to be able to compute (with a program) the point where it actually goes through the line.

Offline Pie

  • Flagrunner
  • ****
  • Posts: 761
Re: I needs a help (simple math)
« Reply #7 on: July 27, 2008, 04:19:31 am »
draw a line from p to l that is at a 90 degree angle to l it's not super hard
well obviously. The thing is, I need to be able to compute (with a program) the point where it actually goes through the line.
I have no idea sorry, this isn't what I thought it was, i'm sure it's simple if you understand it, but i don't because i've never been taught it.

Lol, internets.

Offline Serial K!ller

  • Camper
  • ***
  • Posts: 408
    • Soldat Mods Archive
Re: I needs a help (simple math)
« Reply #8 on: July 27, 2008, 07:03:35 am »
I remember this from a test I made years ago

Edit: Here's a simplified picture.


assume that ax + b = y is the function of your unknown line where a and b are unknown

Calculating a (a.k.a. the direction coefficient)

First you calculate the direction coefficient of the given line (∆Y/∆X), then use the inverse tangent on this to calculate the angle (note +/-90° line has an +/-infinitive direction coefficient (division by 0) so you'll need an exception here), then add 90° then you have the angle of the line you are looking for.
- one exception to calculate this is when the direction coefficient of the given line is 0 the the function of the line you want is X = Xpoint (90° line, +/-infinitive direction coefficient )

Then take the tangents of this (NOTE: tangents only works from -90 <-> 90 ° so if it is out of this range add/subtract 180° (coefficient stays the same) and then you have the direction coefficient (a) of the line you are looking for.

Function of line
ax + b = y <-- now that a is know you can fill in the coordinates of the given point P to calculate b and get the function of the line you want

Calculating common point

ax + b = y of the calculated line then
cx + d = y is the function of the given line
(exception: when a line is a 90° line then the above functions aren't valid, it/they should be X = constant and needs other formula to solve (convert to x = ... functions))

then the common x point is:
ax + b = cx + d
ax-cx=d-b
(a-c)x=d-b
x = (d-b)/(a-c)

y can be calculated by filling calculated x in either one of the functions



I hope I didn't make a mistake been a while since I done any math
« Last Edit: July 27, 2008, 07:09:08 am by Serial K!ller »

Offline Mrorange

  • Major(1)
  • Posts: 21
  • wat
    • wat
Re: I needs a help (simple math)
« Reply #9 on: July 27, 2008, 01:15:23 pm »
draw a line from p to l that is at a 90 degree angle to l it's not super hard

Ya u rite!!!!!!!!  :) ;D ;) 8) [pigtail] [pigtail]

If you want to find the point on the line that is closest to P you want  to find a vector through point P and line I that is orthogonal to line I.  Two vectors are orthogonal if their dot product is equal to zero.  You already have one of these vectors, which you can find from the equation of line I. 

So, If your equation for line I was (x,y)=(a,b)s + (c,d) the direction vector would be v1 = (a,b).  Take an unknown point on line I, (as + c, bs + d), subtract it from point P which we could call (Px, Py), and the result you get v2 = (as + c - Px, bs + d - Py) would be the othogonal vector through point P and line I.  Take the dot product of these two vectors v1·v2 = 0 and solve for s.  Plug s back into the equation of the line and you get your answer.

all these unknown constants i use make it look vry long but actually e-z 2-3 step calculation w/ numbers!!!

I also draw graph to help u  8) 8) 8) and i bad at explain ??? ??? ??? ??? ??? ???



orangej

Offline ChaosKiiD

  • Major(1)
  • Posts: 14
  • ya
Re: I needs a help (simple math)
« Reply #10 on: July 27, 2008, 01:53:11 pm »
Ur very smart :) :D :D :P

Offline iDante

  • Veteran
  • *****
  • Posts: 1967
Re: I needs a help (simple math)
« Reply #11 on: July 29, 2008, 05:59:43 am »
Both Serial Killer and Mrorange... THANK YOU!
I used Serial Killer's method because my 3 years of high school math have failed to teach me anything about the dot product.
BTW Serial Killer, instead of doing tan(arctan(slope)+90) its much easier to just do -1/slope.

Here's an image of why I needed this, I'm making a program that inputs a map file and outputs an overview of it. This is a test map. In order to calculate where to fade to/from it needs to know those points (red).
Edit: PS: this is the actual program output as of this post.
« Last Edit: July 29, 2008, 06:02:01 am by iDante »

Offline The Philanthropist

  • Camper
  • ***
  • Posts: 284
  • .:|TGIF|:. Philly
Re: I needs a help (simple math)
« Reply #12 on: July 29, 2008, 09:11:14 am »
y = mx + b might be a bit easier than the standard form Killer was using.