[Flashcoders] Math help
So if I have to line segments: A: 0-799 B: 66.92 - 124.40 Given a point on B (80.6 for example) how can I find the equivalent point on A? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Math help
I assume you mean those numbers represent X values, and I assume by equivalent you mean the same percentage along the line (since those lines are of two different lengths). Then all you have to do is some simple proportional math. Get the length of each line by subtracting the start point from the end point (i.e. for line b, 124.4 - 66.92). Divide the point you have on B (80.6) from the length of B to get the percentage that point is along line B. Use that number as a proportion to figure the same point on line A. To do that, multiply that proportion number you got from line B by the length of line A. That will give you equivalent proportion on line A. Add that proportion number to the start point of line A (in this case, the start point of A is 0, so doesn't matter) to get the actual point on line A. Jason Merrill Instructional Technology Architect Bank of America Global Learning Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (Note: these resources are only available for Bank of America associates) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Lehr, Theodore Sent: Friday, September 10, 2010 7:24 AM To: Flash Coders List Subject: [Flashcoders] Math help So if I have to line segments: A: 0-799 B: 66.92 - 124.40 Given a point on B (80.6 for example) how can I find the equivalent point on A? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Math help
length of B: 124.40 - 66.90 = 57.5 length traversed along B: 80.6 - 66.92 = 13.68 proportion of B traversed: 13.68/57.5 = 0.237913043 length of A = 799 - 0 = 799 proportion of A traversed: 0.237913043 length traversed along A: 0.237913043 * 799 = 190.0925217 If your screen width is 800 pixels ( 0 to 799), you want pixel 0 +190.0925217 pixel steps, so that's pixel 190. In some cases you might want to round it up with int(0 +190.0925217 + 0.5) - still 190. John On 10/09/2010 12:24, Lehr, Theodore wrote: So if I have to line segments: A: 0-799 B: 66.92 - 124.40 Given a point on B (80.6 for example) how can I find the equivalent point on A? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Math help
Correction: In some cases you might want to round it up with int(0 +190.0925217 + 0.5) - 191 John On 10/09/2010 13:21, John McCormack wrote: length of B: 124.40 - 66.90 = 57.5 length traversed along B: 80.6 - 66.92 = 13.68 proportion of B traversed: 13.68/57.5 = 0.237913043 length of A = 799 - 0 = 799 proportion of A traversed: 0.237913043 length traversed along A: 0.237913043 * 799 = 190.0925217 If your screen width is 800 pixels ( 0 to 799), you want pixel 0 +190.0925217 pixel steps, so that's pixel 190. In some cases you might want to round it up with int(0 +190.0925217 + 0.5) - still 190. John On 10/09/2010 12:24, Lehr, Theodore wrote: So if I have to line segments: A: 0-799 B: 66.92 - 124.40 Given a point on B (80.6 for example) how can I find the equivalent point on A? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Math help
Further correction: In some cases you might want to round it up with int(0 +190.0925217 + 0.5) = int (190.5925217) = 190 Phew! J On 10/09/2010 13:21, John McCormack wrote: length of B: 124.40 - 66.90 = 57.5 length traversed along B: 80.6 - 66.92 = 13.68 proportion of B traversed: 13.68/57.5 = 0.237913043 length of A = 799 - 0 = 799 proportion of A traversed: 0.237913043 length traversed along A: 0.237913043 * 799 = 190.0925217 If your screen width is 800 pixels ( 0 to 799), you want pixel 0 +190.0925217 pixel steps, so that's pixel 190. In some cases you might want to round it up with int(0 +190.0925217 + 0.5) - still 190. John On 10/09/2010 12:24, Lehr, Theodore wrote: So if I have to line segments: A: 0-799 B: 66.92 - 124.40 Given a point on B (80.6 for example) how can I find the equivalent point on A? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Math help
Hhmmm I do not think this is working - here is my issue - maybe someone has an idea. I have a mc that is basically a map of the US. I am getting the long and lat of a location I want to be able to put a point on the map based on that long and lat - my thought was that I could find an equivalent x,y coord based on the long and lat but it does not seem to be translating well... any thoughts? From: flashcoders-boun...@chattyfig.figleaf.com [flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Merrill, Jason [jason.merr...@bankofamerica.com] Sent: Friday, September 10, 2010 7:58 AM To: Flash Coders List Subject: RE: [Flashcoders] Math help I assume you mean those numbers represent X values, and I assume by equivalent you mean the same percentage along the line (since those lines are of two different lengths). Then all you have to do is some simple proportional math. Get the length of each line by subtracting the start point from the end point (i.e. for line b, 124.4 - 66.92). Divide the point you have on B (80.6) from the length of B to get the percentage that point is along line B. Use that number as a proportion to figure the same point on line A. To do that, multiply that proportion number you got from line B by the length of line A. That will give you equivalent proportion on line A. Add that proportion number to the start point of line A (in this case, the start point of A is 0, so doesn't matter) to get the actual point on line A. Jason Merrill Instructional Technology Architect Bank of America Global Learning Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (Note: these resources are only available for Bank of America associates) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Lehr, Theodore Sent: Friday, September 10, 2010 7:24 AM To: Flash Coders List Subject: [Flashcoders] Math help So if I have to line segments: A: 0-799 B: 66.92 - 124.40 Given a point on B (80.6 for example) how can I find the equivalent point on A? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Math help
What you need is something called Translation. I am leaving the office so I can't work out the problem for you, but basically pick a point on the map and call it 0,0 and then the lat and long of that same point will represent 0,0 and all you have to do is subtract or add the lat and long of the point on the map from the coordinates of what you are calling 0,0. -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Lehr, Theodore Sent: Friday, September 10, 2010 10:37 AM To: Flash Coders List Subject: RE: [Flashcoders] Math help Hhmmm I do not think this is working - here is my issue - maybe someone has an idea. I have a mc that is basically a map of the US. I am getting the long and lat of a location I want to be able to put a point on the map based on that long and lat - my thought was that I could find an equivalent x,y coord based on the long and lat but it does not seem to be translating well... any thoughts? From: flashcoders-boun...@chattyfig.figleaf.com [flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Merrill, Jason [jason.merr...@bankofamerica.com] Sent: Friday, September 10, 2010 7:58 AM To: Flash Coders List Subject: RE: [Flashcoders] Math help I assume you mean those numbers represent X values, and I assume by equivalent you mean the same percentage along the line (since those lines are of two different lengths). Then all you have to do is some simple proportional math. Get the length of each line by subtracting the start point from the end point (i.e. for line b, 124.4 - 66.92). Divide the point you have on B (80.6) from the length of B to get the percentage that point is along line B. Use that number as a proportion to figure the same point on line A. To do that, multiply that proportion number you got from line B by the length of line A. That will give you equivalent proportion on line A. Add that proportion number to the start point of line A (in this case, the start point of A is 0, so doesn't matter) to get the actual point on line A. Jason Merrill Instructional Technology Architect Bank of America Global Learning Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (Note: these resources are only available for Bank of America associates) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Lehr, Theodore Sent: Friday, September 10, 2010 7:24 AM To: Flash Coders List Subject: [Flashcoders] Math help So if I have to line segments: A: 0-799 B: 66.92 - 124.40 Given a point on B (80.6 for example) how can I find the equivalent point on A? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Math help
Lattitude and longitude are lines projected onto a sphere (the earth), so therefore curve and won't translate to a 2D map, which could have any variety of projection type. So just using those values won't give you X and Y on any map, unless your map is not something as large as the U.S. A smaller map, where the projection lines do not curve, would probably be OK. But for a U.S. map, no. You'll need to figure out your own coordinates for cities or whatever for that, or find something third party that can help with that. Is something like the YahooMap API for Flash a possibility? Jason Merrill Instructional Technology Architect Bank of America Global Learning Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (Note: these resources are only available for Bank of America associates) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Lehr, Theodore Sent: Friday, September 10, 2010 11:37 AM To: Flash Coders List Subject: RE: [Flashcoders] Math help Hhmmm I do not think this is working - here is my issue - maybe someone has an idea. I have a mc that is basically a map of the US. I am getting the long and lat of a location I want to be able to put a point on the map based on that long and lat - my thought was that I could find an equivalent x,y coord based on the long and lat but it does not seem to be translating well... any thoughts? From: flashcoders-boun...@chattyfig.figleaf.com [flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Merrill, Jason [jason.merr...@bankofamerica.com] Sent: Friday, September 10, 2010 7:58 AM To: Flash Coders List Subject: RE: [Flashcoders] Math help I assume you mean those numbers represent X values, and I assume by equivalent you mean the same percentage along the line (since those lines are of two different lengths). Then all you have to do is some simple proportional math. Get the length of each line by subtracting the start point from the end point (i.e. for line b, 124.4 - 66.92). Divide the point you have on B (80.6) from the length of B to get the percentage that point is along line B. Use that number as a proportion to figure the same point on line A. To do that, multiply that proportion number you got from line B by the length of line A. That will give you equivalent proportion on line A. Add that proportion number to the start point of line A (in this case, the start point of A is 0, so doesn't matter) to get the actual point on line A. Jason Merrill Instructional Technology Architect Bank of America Global Learning Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (Note: these resources are only available for Bank of America associates) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Lehr, Theodore Sent: Friday, September 10, 2010 7:24 AM To: Flash Coders List Subject: [Flashcoders] Math help So if I have to line segments: A: 0-799 B: 66.92 - 124.40 Given a point on B (80.6 for example) how can I find the equivalent point on A? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Math help
Hhmmm that makes sense... that explains why it is not translating... unfortunately - I can not have something that needs go hit the internet - working on a closed network... the YahooMap API seems like it would not work on a network like that... unless I am totally misunderstanding it From: flashcoders-boun...@chattyfig.figleaf.com [flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Merrill, Jason [jason.merr...@bankofamerica.com] Sent: Friday, September 10, 2010 12:08 PM To: Flash Coders List Subject: RE: [Flashcoders] Math help Lattitude and longitude are lines projected onto a sphere (the earth), so therefore curve and won't translate to a 2D map, which could have any variety of projection type. So just using those values won't give you X and Y on any map, unless your map is not something as large as the U.S. A smaller map, where the projection lines do not curve, would probably be OK. But for a U.S. map, no. You'll need to figure out your own coordinates for cities or whatever for that, or find something third party that can help with that. Is something like the YahooMap API for Flash a possibility? Jason Merrill Instructional Technology Architect Bank of America Global Learning Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (Note: these resources are only available for Bank of America associates) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Lehr, Theodore Sent: Friday, September 10, 2010 11:37 AM To: Flash Coders List Subject: RE: [Flashcoders] Math help Hhmmm I do not think this is working - here is my issue - maybe someone has an idea. I have a mc that is basically a map of the US. I am getting the long and lat of a location I want to be able to put a point on the map based on that long and lat - my thought was that I could find an equivalent x,y coord based on the long and lat but it does not seem to be translating well... any thoughts? From: flashcoders-boun...@chattyfig.figleaf.com [flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Merrill, Jason [jason.merr...@bankofamerica.com] Sent: Friday, September 10, 2010 7:58 AM To: Flash Coders List Subject: RE: [Flashcoders] Math help I assume you mean those numbers represent X values, and I assume by equivalent you mean the same percentage along the line (since those lines are of two different lengths). Then all you have to do is some simple proportional math. Get the length of each line by subtracting the start point from the end point (i.e. for line b, 124.4 - 66.92). Divide the point you have on B (80.6) from the length of B to get the percentage that point is along line B. Use that number as a proportion to figure the same point on line A. To do that, multiply that proportion number you got from line B by the length of line A. That will give you equivalent proportion on line A. Add that proportion number to the start point of line A (in this case, the start point of A is 0, so doesn't matter) to get the actual point on line A. Jason Merrill Instructional Technology Architect Bank of America Global Learning Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (Note: these resources are only available for Bank of America associates) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Lehr, Theodore Sent: Friday, September 10, 2010 7:24 AM To: Flash Coders List Subject: [Flashcoders] Math help So if I have to line segments: A: 0-799 B: 66.92 - 124.40 Given a point on B (80.6 for example) how can I find the equivalent point on A? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Math help
Right - YahooMaps would require access to Yahoo. Jason Merrill Instructional Technology Architect Bank of America Global Learning Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (Note: these resources are only available for Bank of America associates) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Lehr, Theodore Sent: Friday, September 10, 2010 12:13 PM To: Flash Coders List Subject: RE: [Flashcoders] Math help Hhmmm that makes sense... that explains why it is not translating... unfortunately - I can not have something that needs go hit the internet - working on a closed network... the YahooMap API seems like it would not work on a network like that... unless I am totally misunderstanding it From: flashcoders-boun...@chattyfig.figleaf.com [flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Merrill, Jason [jason.merr...@bankofamerica.com] Sent: Friday, September 10, 2010 12:08 PM To: Flash Coders List Subject: RE: [Flashcoders] Math help Lattitude and longitude are lines projected onto a sphere (the earth), so therefore curve and won't translate to a 2D map, which could have any variety of projection type. So just using those values won't give you X and Y on any map, unless your map is not something as large as the U.S. A smaller map, where the projection lines do not curve, would probably be OK. But for a U.S. map, no. You'll need to figure out your own coordinates for cities or whatever for that, or find something third party that can help with that. Is something like the YahooMap API for Flash a possibility? Jason Merrill Instructional Technology Architect Bank of America Global Learning Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (Note: these resources are only available for Bank of America associates) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Lehr, Theodore Sent: Friday, September 10, 2010 11:37 AM To: Flash Coders List Subject: RE: [Flashcoders] Math help Hhmmm I do not think this is working - here is my issue - maybe someone has an idea. I have a mc that is basically a map of the US. I am getting the long and lat of a location I want to be able to put a point on the map based on that long and lat - my thought was that I could find an equivalent x,y coord based on the long and lat but it does not seem to be translating well... any thoughts? From: flashcoders-boun...@chattyfig.figleaf.com [flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Merrill, Jason [jason.merr...@bankofamerica.com] Sent: Friday, September 10, 2010 7:58 AM To: Flash Coders List Subject: RE: [Flashcoders] Math help I assume you mean those numbers represent X values, and I assume by equivalent you mean the same percentage along the line (since those lines are of two different lengths). Then all you have to do is some simple proportional math. Get the length of each line by subtracting the start point from the end point (i.e. for line b, 124.4 - 66.92). Divide the point you have on B (80.6) from the length of B to get the percentage that point is along line B. Use that number as a proportion to figure the same point on line A. To do that, multiply that proportion number you got from line B by the length of line A. That will give you equivalent proportion on line A. Add that proportion number to the start point of line A (in this case, the start point of A is 0, so doesn't matter) to get the actual point on line A. Jason Merrill Instructional Technology Architect Bank of America Global Learning Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (Note: these resources are only available for Bank of America associates) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Lehr, Theodore Sent: Friday, September 10, 2010 7:24 AM To: Flash Coders List Subject: [Flashcoders] Math help So if I have to line segments: A: 0-799 B: 66.92 - 124.40 Given a point on B (80.6 for example) how can I find the equivalent point on A? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders