 |
|
 |
Apologies for the shouting but this is important.
When answering a question please:
- Read the question carefully
- Understand that English isn't everyone's first language so be lenient of bad spelling and grammar
- If a question is poorly phrased then either ask for clarification, ignore it, or mark it down. Insults are not welcome
- If the question is inappropriate then click the 'vote to remove message' button
Insults, slap-downs and sarcasm aren't welcome. Let's work to help developers, not make them feel stupid.
cheers, Chris Maunder
The Code Project Co-founder Microsoft C++ MVP
|
| Sign In·View Thread·PermaLink | 5.00/5 (2 votes) |
|
|
|
 |
|
 |
For those new to message boards please try to follow a few simple rules when posting your question.- Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
- Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
- Keep the subject line brief, but descriptive. eg "File Serialization problem"
- Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
- Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
- Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
- If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode HTML tags when pasting" checkbox before pasting anything inside the PRE block, and make sure "Ignore HTML tags in this message" check box is unchecked.
- Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
- Please do not post links to your question in one forum from another, unrelated forum (such as the lounge). It will be deleted.
- Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
- If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
- No advertising or soliciting.
- We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
cheers, Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
| Sign In·View Thread·PermaLink | 4.73/5 (13 votes) |
|
|
|
 |
|
 |
Just a brief question. In a little demo I've got going I can have up to 300 objects floating around the screen and checking every object against every other object is painfully slow.
Using a quad tree to split the screen up and group the objects greatly speeds up checking for collisions but unfortunately rebuilding the quad tree every frame eats up quite a lot of the performance that you gain from using it.
Does anybody have any idea's on what I could do, bearing in mind that all 300 objects will constantly be moving and are all fairly close together, so trying to only update objects that have moved would cause the entire tree to be jiggled about a little bit, perhaps costing more time that a full rebuild.
My current favourite word is: Sammidge!-SK Genius Game Programming articles start - here[ ^]-
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
why use a tree that is bound to become invalid all the time?
I would see the screen as a 2D matrix (say N*N) with N around typical screen size divided by typical object size (and not larger than say 10), so each object typically spans two rows and two columns. Each screen cell could be represented by a List containing references to the objects that (partially) lie inside it, and a timestamp.
One time step would: - move some objects, checking them against the 2D matrix cells; resulting in possibly removing them from some lists, and possibly adding them to some lists; store current time in cells objects got added to. - then foreach cell marked with current time, check the listed objects for overlap.
Possible optimization: give each object a list of cells it currently is in; this would speed up the removal step.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
in the name of god hello how can we solve this problem to find the order of it: T(n)=sqrt(n)*(T(sqrt(n))+n order =? valhamdolelah.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
 |
|
 |
Ok then I think: T(n) = (n * C)/(e^2) + (n * ln(ln(n))) / ln(2)
edit: that would be O(n log(log n)) I think
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
 |
|
|
 |
|
|
 |
|
|
 |
|
|
 |
|
|
 |
|
 |
It's ugly, ugly, ugly....
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
| Sign In·View Thread·PermaLink | 5.00/5 (1 vote) |
|
|
|
 |
|
 |
in the name of god thanks you are right i found myself my answer after testing it but if you can please send me a beautiful of it. thanks. valhamdolelah.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi,
Is it possible to use Bug-1 algorithm without knowing the distance to the target ? In every place (a matrix) I just know the way to this (N, NE, E, SE..), but not the distance.
modified on Tuesday, November 3, 2009 5:00 PM
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
If you now the direction from two points and the distance between them, then it's pretty simple trig to work out the distance to the third; Triangulation[^]
Panic, Chaos, Destruction. My work here is done.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
I need to make a divide&conquer algorithm for finding the dominant element in an array (dominant element = element which exists at least n/2 times in an array within the size n) . All you can do between those elements is compare them (no < relation or > relation) . And also I need an algorithm which does it in O(n) (doesn't have to be d&c) Thanks ahead for any help...
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Well, this may not win any awards for style, but have you considered just using a hash table to aggregate the count?
It would be O(n) to hash everything, since I believe hash tables are theoretically in constant time... Then a subsequent O(n) to find the largest value in the hash table.
There's probably a more clever way to do it, but that would get the job done.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
in the name of god hello if i know your question true you can do: 1-for i=0 n B[A[i]]++; for counting the number of repeating of them. and then searching for max with O(n); valhamdolelah.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
That only works if you know the number range... What if the numbers are completely unknown, and can be as high as 2^16... Are you going to have an array that large?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
khomeyni wrote: in the name of god hello
Are you really in the US as your profile says? And if so, do you talk like this on the job?
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
no i cant yet change it i am from Iran i will change it soon and also yes we talk like this on job but not as this intensity 
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |