Thursday, March 24, 2011

Rigid Body Project Notes

1.The volume of a sphere should be 4/3 * pi * radius * radius * radius, not radius square. Changed it in the file sphere.cpp, GetNormalMass

converted it back again. but why is it only two radiuses not three? what is the difference between the real mass and normal mass?

2.???

Vector3 RigidBody::GetPosition()
{
return m_transformation * Vector3::ZERO;
}

3. no need to multiply the inversemass?

void RigidBody::AdvanceVelocity(Vector3 const& F, float dT)
{
if(!HasInfiniteMass())
{
SetVelocity(GetVelocity() + F * dT);
}
}

4.when using an if condition to change a defined variable, be careful not to redefine it, especially when modifying but not writing initially.

5.when the program aborts, it might be the problem that the breakpoint's previous step has a numerical problem like a denominator of zero.

6.be careful about vectors, especially when load a new scene. basically we should clear all the vectors in the old scene to get a fresh one for the new, like the bodies, materials and broadPhaseTest.

7.be careful about the method and algorithm first! like the broad phase test part, the logical things were firstly messed up and caused trivial annoying bugs!(if condition, relationship between intersection list and broad phase test list...)

8.search for "for test" and delete these which are for correction test of specific processes.


Thursday, March 17, 2011

c++ stream file operations TIPS

We can make use of stream to open, edit, and close files very easily. I learned them today and would like to put some tips down for future reminder.

1. Include the iostream and fstream.

2. Use the ofstream to open and write a file:

ofstream outputFile(fileName, std::ios_base::out/std::ios_base::app)

The fileName should be char* type. If it is a string, convert it to char* using fileName.c_str();
std::ios_base::out means to overwrite the whole file from the beginning;
std::ios_base::app means to write from the end of the file, leaving all of the existing data unchanged;
there are still some other modes, see http://www.cplusplus.com/reference/iostream/ofstream/ofstream/;
also there is a third parameter, int_Prot. Not very clear how to use it yet.

after this definition of the temporary variable, we can use outputFile.open(fileName, std::ios_base::out/std::ios_base::ape) to open and add data.

3. Use the ifstream to open and read a file. Be careful about the ios::in | ios::binary if read a binary file. It is very different from the default setups.

4. Dynamic fileName/load multi files
Use the following pattern to create a editable filename

char filename[256]/* = "slice001image015echo001.fdf"*/;
sprintf_s(filename, 256, "Data/slice001image%03decho001.fdf", theFrameNum);

"/" defines the folder path of the file. "%03d" is the number to identify different files, which means 3-digit integer. Using this we can use loops to read different files in sequence at one time.

5. Close Files

Never forget to close a file when finishing the operation before opening it again! Or it will not be read again in the same function layer.

Saturday, March 12, 2011

[FWD from CreativeHeads]7 Ways Time Is Wasted At Work


Although a lot of people spend their week getting excited about the weekend, for people who have mountains of labor it may often seem like the significant week isn’t of sufficient length. Somehow, since the week progresses, we obtain time burgled having a quantity of menial tasks and discover the actual work going for a back seat. That will help you prevent them; listed here are seven of the very common ways time is wasted at work. 
1. One of the greatest drains in your time has to reply to unnecessary calls. From sales calls to non-urgent discussions, it may all distract in the important work you have to execute. Even your more essential calls might not obtain the attention they might require if you are busy with other people.
2. A high level social networking fanatic, be cautious it doesn’t consume an excessive amount of your time and effort. Websites like Twitter and FaceBook have a lot happening that it may be simple to obtain side-tracked.
3. Other websites will also be major time drains. You simply need to click something and three links later you’re still browsing and also have lost half and hour.
4. One of the greatest ways we’re time burgled throughout the week is during our commute. Should you spend an hour or so dealing with work and also the same going home, that’s 10 hours of your energy that may be spent carrying out work. A home based job can be a useful option.
5. Office chatter is yet another time-killer even though get ready to enjoy your casual workplace, it may be stopping you against making significant tasks. Without having your personal office to obtain right down to be employed in, try locking yourself within the boardroom for some hours to interrupt the rear of a large task.
6. One other way we lose time is as simple as arriving late. It could simply be 10 or Quarter-hour; however the knock on result can be an issue, especially once you have spent time checking emails, making your bag and doing colleagues.
7. However, probably the biggest time eating issue is bad planning. By not organized, your priorities is probably not because they should. If you are switching between jobs or otherwise finishing that which you start, you can wind up at the conclusion each week with not many things ticked off your List.

Today I give birth to the Shots

Today, I give birth to the Live's Shots,
chewing oat milk in my mouth,
facing north.