|
The above algorithm won't detect the case where the segment is entirely contained in the polygon, without intersecting any edge. Let me know if you need to detect this case too.
|
|
|
|
|
Plz show me if that is the most optimal algorithm ? I really want to know the most optimal algorithm to solve this problem. So, would you mind helping me ?
|
|
|
|
|
If it isn't optimal it's pretty close. The calculation to determine if two segments intersect isn't time consuming. The only case it doesn't handle, as I've mentioned, is when the segment is entirely contained within the polygon.
modified on Friday, October 17, 2008 9:55 AM
|
|
|
|
|
OK. Thanks so much for replying
|
|
|
|
|
Alan,
Does it handle the case where the intersection is at the node between two line segments of the polygon?
Dave.
|
|
|
|
|
It does if your algorithm to detect line-segment intersection will detect a segment intersecting the end point of another segment.
|
|
|
|
|
Alan,
My question was about the suggested algorithm you gave above and whether it returned an intersection for a crossing at a node.
Dave.
|
|
|
|
|
Yes it does; if you follow the link there's a Java applet that lets you draw two line segments and tells you if they intersect. You can draw two segments that intersect at an end, and it does detect the intersection.
|
|
|
|
|
Alan,
Thank you for the answer.
I did start to try the link. First it wanted to install a plugin in FF, OK, I'll go with that. That failed, and the next thing it wanted to do was install a Sun DLL. I decided to quit at that point because the next thing it would want to do would be enable Java Script which I have disabled.
I'm happy that that solution will work if I ever need it.
Dave.
|
|
|
|
|
Depends on your situation. You should probably do a bounding box check first since it's simple, quick and will eliminate a lot of lines.
There's an entire book essentially on this subject:
http://www.amazon.com/Real-Time-Collision-Detection-Interactive-Technology/dp/1558607323/ref=sr_1_1?ie=UTF8&s=books&qid=1227945892&sr=1-1[^]
Some of the things you need to think about:
Are your polygons convex or can they be concave?
Are you testing fixed polygons against a series of lines or does the polygon change with each test?
Are your lines more likely to miss than not?
BSP trees are worth looking into if you really want to squeeze every last drop of performance. They're a bit complex, though and mostly good for lots of lines testing against a single polygon.
|
|
|
|
|
Iam student have aproject about retreiving image
,so Iwant agood algorithm about analysis images to find the signature of it and uses this step to retreive...
plz plz plz help me in a shortest possible time ..
thanks alot..
|
|
|
|
|
luna2010 wrote: plz plz plz help me in a shortest possible time ..
Done.
BTW: Google & CodeProject's article search engine are your best friends (reading the forum guidelines will be a plus).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Sendme ur codez, plz. Urgent!
"If only God would give me some clear sign! Like making a large deposit in my name in a Swiss bank."
|
|
|
|
|
luna2010 wrote: plz plz plz help me in a shortest possible time ..
No. It might be more time efficient for you to google it
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Google is ur best friend. Google it.
|
|
|
|
|
I need to figure out the formula/pattern/algorithm needed to convert the number on the left into a checksum on the right. Here are a few examples
6789542137 ; 53426
7274707623 ; 13890
7608909976 ; 21097
7866018419 ; 46204
8185833863 ; 59982
8052724826 ; 68535
Please help
Thanks
|
|
|
|
|
Please give us some hints, for instance: will this help to understand the origin of the Universe?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Can you supply any more information? A bunch of numbers and their checksum isn't much to go on...
"If only God would give me some clear sign! Like making a large deposit in my name in a Swiss bank."
|
|
|
|
|
unfortunately that is all the information I have. What i am trying to do is find out what formula/algorithm when applied to the 10 digit number will get me the 3-5 digit code. Any help would be great
|
|
|
|
|
hdsouza1 wrote: unfortunately that is all the information I have. What i am trying to do is find out what formula/algorithm when applied to the 10 digit number will get me the 3-5 digit code. Any help would be great
I'm afraid that's near-impossible. It's equivalent to trying to decrypt an encrypted message given no information about the encryption. You have to have some idea how it functions otherwise it could, quite literally, be among hundreds of thousands of possible algorithms. For all I know, these could be nothing but randomly generated numbers...
"If only God would give me some clear sign! Like making a large deposit in my name in a Swiss bank."
|
|
|
|
|
Good luck.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
a * x ^ 6 + b * x ^ 5 + c * x ^4 + d * x ^ 3 + e * x ^ 2 + f * x = y
use you data you can solute a、b、c、d、e、f.
|
|
|
|
|
Hi Shrewdlin, Thanks for your reply. Need a little more help. What is
1) x and y
2) Does x^5 mean x to the power of 5
Thanks
|
|
|
|
|
1) x and y is variable
2) yes, it means x to the power of 5
yan can use your data to make six equation for example:
a * 6789542137 ^ 6 + b * 6789542137 ^ 5 + c * 6789542137 ^ 4 + d * 6789542137 ^3 + d * 6789542137 ^ 2 + f * 6789542137 = 53426 (this is the first one, you can do the other)
six equation to solve six variable can you calculate the a、b、c、d、e、f
then use the known a、b、c、d、e、f to rebuild the equation
the data is very big you can use maple software for you!!!good luck!!
|
|
|
|
|
The problem will arise with the seventh line of the sequence.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|