Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 21 Jul 2010
Offline Last Active Dec 03 2012 10:00 AM

Posts I've Made

In Topic: Fast Searching/Modifying data from Binary Files

30 November 2012 - 07:59 AM

Thanks haegarr,

that sound's like a great solution to my problem. Do you know of any tutorials/examples of how to do this?

In Topic: Fast Searching/Modifying data from Binary Files

30 November 2012 - 06:14 AM

Apologies for the lack of detail.

For something as tiny as 10000 (int, string, int) I see no problem with keeping the data in memory.

I am creating a list for a GUI and considering the the amount of data in the list could be exponential, even larger than 10,000 - though it's unlikely it is certainly possible. On top of this I am
my list can handle a varied amount of columns.

All of the data will actually be strings, even in the example in my first post.

I have not used the file libraries much, but the code I wrote is this to create the file:

std::ofstream file;
file.open("data.bin", std::ios::in | std::ios::out | std::ios::binary | std::ios::app);
std::string str = "0,Hello World,0";
std::string::size_type sz = str.size();
    if (file)
	   for(int i = 0; i < 10000; i++)
   file.write(str.c_str(), strlen(str.c_str()));
   file << std::endl;

If this is incorrect please let me know.

Note: I actually won't be creating the binary file myself, only receiving the file and reading the data in FetchData method.

The main problem presented is my list works perfectly fine up until I require the 4000th row then It becomes noticeably slower, this is because I am iterating through the file until
I reach the index required.

In Topic: Rotating Time Animation

28 November 2011 - 02:24 PM

Here's how I would do it:

// StartTime is the time you started 
// ROTATION_TIME is the time you want it to rotate from 0 to 90.0f
delta = CurrentTime - StartTime;
RotationDegrees = 90.0f * (delta/ROTATION_TIME);

Basically, as time passes, delta will get closer and closer to ROTATION_TIME, which means (delta/ROTATION_TIME) will get closer and closer to 1. So, when it's 1, it will have rotated 90 degrees. You stop when (CurrentTime - StartTime) == ROTATION_TIME

Thank you, would start time be the animTimeDelta then?

Would this also work when the rotation is relative?

In Topic: Calculating Centre of changing shape

09 November 2011 - 02:06 PM

Thank you for all the replies, I have solved it myself fortunately using the law of sines, right triangle and a ormula I developed,

Oh and what I meant by a new polygon being added up, was that I would start off with 3 polygons for the triangle (no top face or bottom face). And then add another polygon to the scene to turn it into a
square and so on, until there 360 polygons.

In Topic: Calculating Centre of changing shape

08 November 2011 - 01:21 PM

Are the edges described in some order (i.e. clockwise)? Are the polygons convexes? In what coordinate system should the centre be described? Do you know something else?

Sorry if i wasn't descriptive. I start off with a 3d triangle in 3d space (x,y,z).
The polygons are convexes.

The things i would know = Centre point of the 3d triangle. The dimensions of each polygon. All the polygons will be the same height and width.
A new polygon (4 vertices) will be added up until there are 360 sides.