flounder

Members
  • Content count

    292
  • Joined

  • Last visited

Community Reputation

100 Neutral

About flounder

  • Rank
    Member
  1. random vs fixed sleep interval

    Quote:Original post by coder0xff However, I think there may be a better solution for you. Rather than sleeping, you can set the processes priority to a lower level so that it will run full crank 100% when you aren't using the computer, but the moment you do something, it gets off loaded so the CPU can focus on other tasks. This is a feature that has been in windows for a long time. Find the process in task manager, right click it, and set the priority to idle. I'm trying to keep the cpu from running full throttle even when I'm not using the computer. I've had to get a part of this computer replaced once before because of heating issues, so I'm trying to avoid it altogether. Quote:Original post by Antheus Instead of worrying about this, make sure to implement periodic snapshots. The chance of something going wrong is rather high for uninterrupted computation over a time span of a week. Running CPU at 100% for such long time is essentially burn-in test which exposes many subtle instabilities. So every 10 minutes or so dump entire state which can be used to resume computation from that point. This is by far the most important part for this type of stuff. Quote:such a long time, sleeping it at such a constant interval might wear out certain parts of the cpu more than others Unless the CPU can balance workload across cores, there's nothing you can do. It's already set up to dump what I've processed every hour or so since I figured I might need to start/stop sometime in the future. The processing is being done on one core. I'll just stick with the fixed interval then.
  2. I need to process a bunch of data, and it will take about a week of constant cpu time to process it all. The computer I'm going to be doing this on is somewhat old so I want to avoid taxing it too much, and I want to be able to use it during that time. After some testing I've decided I want to sleep the main processing loop for 10ms every 500 loops. My question is: would it be better for the computer if I don't sleep it at exactly every 500 loops and instead sleep it randomly between 400-600 loops (or some interval like that)? The reasoning for this is that since the computer will be processing the data for such a long time, sleeping it at such a constant interval might wear out certain parts of the cpu more than others. I don't know enough about how a computer works to know if this is absurd or not, so that's why I'm asking.
  3. compiling .cpp as .mm

    Thanks, that got everything working.
  4. compiling .cpp as .mm

    I have a small portion of c++ code that needs to compile as obj-c++ on a mac. Rather than keeping a copy of the file with a .mm extension, I'm trying to get gcc to compile the .cpp file as obj-c++, but it doesn't seem to want to. Are there any parameters I can pass that will get gcc to work nicely? This is a simpler file I've been trying to get to compile: //main.cpp #import <stdio.h> #import <Foundation/NSObject.h> @interface hello:NSObject { } @end int main(int argc,char** argv) { printf("done\n"); getchar(); return 0; } And the makefile main: main.cpp g++ -lobjc -o main main.cpp
  5. Random Numbers and Humans

    An idea: try thinking of a movie or a story, then think of a short, 1 sentence summary of it. For each word in the summary, if there's an odd number of letters you get a 1 and if it's even you get a 0. Remembering the summary as you try to count letters might be a bit hard and time consuming though. Also, I don't know if there's a significant bias for words used in a sentence.
  6. Average length of a line in a box

    The 8 they have should be good enough for me, since this prng test wouldn't be testing a very high number of dimensions anyway. Thanks for the links!
  7. I'm trying to come up with a statistical test for judging the quality of a prng. It involves randomly plotting 2 n-dimensional points in a n-dimensional box with sides of length 1, and finding the average distance between two points. I know the average squared distance should be dimensions/6, but I'm looking to find the unsquared distance. For 1 dimension I've calculated the average distance to be 1/3, but for dimensions 2 and higher I haven't been able to integrate the equations. For 2 dimensions the data looks like the average distance should be pi/6. Does anyone know how I could calculate these values?
  8. Optimized Collision Detection & Physics

    If you're doing a distance check in NarrowPhaseCollision, you don't need to do it in BroadPhaseCollision. Your issue with resolving one collision and creating another in the process doesn't have any fast solution that I know of, but you can make it look better by performing your collision phase multiple times.
  9. Optimized Collision Detection & Physics

    It matters a lot if you sweep through cells or particles, the entire point of having cells is to avoid checking collisions between particles that will never collide. Typically a spatial indexing grid goes like this: You have a grid of cells. Each cell has a list of the objects overlapping it Go through each cell, check for collisions between each object listed in the cell. You shouldn't need to be building a list at collision time.
  10. Optimized Collision Detection & Physics

    I probably didn't explain it correctly, can you post the modified code?
  11. Optimized Collision Detection & Physics

    You shouldn't be getting quadratic time with a spatial index grid, but it's hard to tell that with just the code posted. As for speeding it up, you can rearrange the math to remove some redundant operations. nX=d_x/R nY=d_y/R So you can remove the atan2, sin, and cos. You don't need to calculate optimisedP unless the particles are colliding. You multiply optimisedP by 2.0 and then multiply it by 0.5 when its added to the particle velocities, so you can remove both of those. It's possible to avoid a square root by checking if (R<totalRadius*totalRadius), and then writing R=sqrt(R) if that's true. EDIT: I can't see why your particles are shooting off at high velocities, might be something in AddTotalForces.
  12. Rigid body dynamics intro

    I would start with implementing circle-circle collision detection and response, and then using that as a base for more complicated dynamics. Searching for pool/billiard physics should turn up a bunch of easy to read code.
  13. What does it mean to be a nerd?

    Quote:Dmytry We could very well be de-evolving at the moment (but it wont last for long to have actual effect). De-evolving from what? If you mean from our cave man like ancestry, then I'd agree, but according to a scientific american article I read a while ago we are evolving on a genetic level faster than ever before (I can't remember exactly what they said is evolving). I suspect one area we are evolving in is our behavior in society, considering a lot of people now are living in places that have tens of thousands of people rather than a community of 100 or so.
  14. image shape analysis

    This post sounds like it deals with what you're looking for. polygon decomposition seemed to turn up some articles on google. I don't know if any of them can be tuned for more or less polygons. You say you want as small of a list as possible, wouldn't one bounding hull be the smallest? [Edited by - flounder on October 28, 2008 6:47:19 PM]
  15. image shape analysis

    Sounds like you want to compute a convex hull. Just treat every non-transparent pixel as a possible vertex of the hull.