Friday, April 22, 2011

So what have you learned from 660 Authoring tool?

Hey since it is just my first attempt to a teamwork programming project, also it is my first time to use an outer library. It was really tricky, but I really learned a lot.

Got to know how to compile an outer library using CMake on Windows Platform.

It is really important to read the instructions carefully first, be fully aware about the functions, requirements and limitations of the library to decide whether it is applicable. For example, CGAL requires each computed polygon is counter clockwise, which means some preconditions have to be made.

Compiling and debugging to details of the library can help understand how it works, but it is costly without a full understanding about the instructions.

For this modeling project, the curve editor framework using OpenGL output is really essential. Firstly it help test eligibility and functionality of the library in simple conditions. It also help when a specific and wired bug appears by creating the exact numerical environment.

BE CAREFUL about the whole developing process! Never do tons of coding without any output and debugging  like this time. It is lucky that I kept a relatively clear thought all through the construction of the project, but it is really DANGEROUS! It is very likely that millions of tiny bugs are hidden in the lines, which will take much more time to eliminate than the construction itself!
The right way: a little bit process->output->debug->success->a little more process.
Another right method I think is: construct simple situation->debug->success->add more complex conditions
So keep these micro circulations to build a project is most likely to be robust.

Make good use of Google to help clarify and solve problems with the library. See whether others met with similar tricks. Maybe there is no direct answer, other ppl's experiences can of course provide hints and inspirations for solutions, like the solution of "double" and "float" which took more than three days to figure out.

Got more about how C++ works, and also Maya plugin process, like get a 3D meshed model from a vector<vec3>. But still, my work is mostly concentrated on C++ programming. So I need more practice and understanding about Maya API!

Should be FULLY aware of the importance of Design Document. It should be written specifically and clearly to follow. Should also look back to it often during projection to keep close track of it. It is good to have brilliant ideas, but I guess it is not a good idea to forget about the initial targets.
Ask Dr. Lane about the significance of Design Document and its modification.

To be continued...

Thursday, April 21, 2011

So We Get More!

So we've got further towards our final goal!
We have extended the construction of CSG from 2 silhouettes to 3!
In this step, for each cylinder's facet, we intersect it with the other silhouettes' cross shape polygon, and in doing so create the mesh for the final 3D model.


Come on, take a look at the output!

Cheers!

Saturday, April 16, 2011

Authoring Tool Update: 416

Facet tmpFacet2(Intruder.Vertices);
in vector<Facet> Silhouette::Intersect(Silhouette Intruder)

coz intersection should be between base's facet and intruder's cross shape 

Thursday, April 14, 2011

Authoring Tool Update: 415

plane equation implemented for each facet

carry on man
get some output next

Wednesday, April 13, 2011

Bubble Bomber Update : Version 15

Adding bubble expansion sink term Ea. It should be given by a simple mass balance removing the gas added to the discrete bubble from the dissolved gas in the local SPH particles, but what is MASS BALANCE?!!

Now just calculate it by a distance weight from the surrounding fluid particles to determine gas transfer to bubbles(threshold as 0.01), and increase the bubble  radius by an arbitrary constant of 0.10 * pcurr->gas_concentration * fac.

Parameters:

float mR = 100 * m_Param[SPH_SMOOTHRADIUS];

Vector3DF r ( p->pos.x - pcurr->pos.x, p->pos.y - pcurr->pos.y, p->pos.z - pcurr->pos.z );
double distance = r.Length();
double fac = (mR - distance) / mR;

if (fac < 1.0  && fac > 0.0 && pcurr->gas_concentration >= 0.01) {

//the default contribution is set up as 0.01
pcurr->gas_concentration -= 0.01 * fac;
p->gas_concentration += 0.01 * fac;
p->radius += 0.01 * fac;
//p->gas_concentration

So in this commitment I assumed the non strict law of gas transferring and bubble expansion(radius increases according to the distance weight of surrounding fluid particles and 0.10 * pcurr->gas_concentration * fac).
Should modify them after clarify the laws.

Tuesday, April 12, 2011

Bubble Bomber Update

Added bubble generator to all the boundary detections except for the ceiling
Added the condition p->pos.z <= 0.6 * max.z for each bubble generation except for z direction

Monday, April 11, 2011

Notes for Bubble Generator: Version 9

1. Added gas_concentration to struct Fluid, set up m_Pram [ GAS_CON ] as 0.15, the same in the form, initialize it in the function FluidSystem::AddPoint and AddPointReuse
2. Added an 1D array containing all the grids by the size of 1 in the container in the class FluidSystem, initialize it by the end of FluidSystem::AddVolume.
3. Added an bubble generator to the bottom of the container, controlled by two parameters:  GAS_LOSS(26) and BUB_GAS(27)
4. Resumed the Emit function back to the original status.
5. Changed MAX_PARAM to 30

Things to do:

1. Expanded the bottom to all of the boundaries
2. Implement the formula (8)

Q: Cannot generate bubbles in release mode???

Thursday, April 7, 2011

Bubble Update

added scale to Point struct
added scale to Particle struct

something wired but helpful:
the three structures: Point, Particle and Fluid are independent, but share some basic elements at the head of each. it is kind of like Point is the base class of Particle, and Particle is the base class of Fluid. So each time the elements in Fluid are changed, after the pointer is converted to char* and then to Particle* or Point*, the couterpart will also be updated. I think the shared elements in the three structs must be totally the same, including sequence, so this is kind of dangerous, but the author seemed make use of this property.

anyway, after this, we can draw the bubble particle directly according to its scale, so we can see its expansion vividly. The threshold scale of bubble particle is (0.5, 0.5, 0.5), set up in the emit, search for p->scale.

Also played with buoyancy by impulsing the bubble particles an arbitrary upward force, but remember, z points upward instead of y. Comment it in SPH_ComputeForceGridNC, search for force.z += to avoid it;

MRI update

Implemented all of the variables in global_init in solver.h/cpp

however, the variable po_2 might be modified in the file params.txt, which I don't know what exactly it means.

Also got one parameter in v_init, which is refImage = 10

Wednesday, April 6, 2011

Version Control Using SVN

We can use SVN, which is very widely applied as a version control cooperation software develop platform in industry, to control version.
Several platforms that support SVN:
unfuddle
googlecode

When share with others, sub users may have such problems that “Can’t create directory” . One way to solve it is to change the permissions of the owner.
The owner can change permissions using linux command 770(first seven for owner, 4-read-2-write-1-execute, second seven for other users, the same; zero for outers, non permissions


Before doing modifications, use SVN update
After doing modifications, use commit SVN

Tuesday, April 5, 2011

PartTime Job--MRI Ventilation Tips

main_single:

set_path : find the folder's path which contains the fdf files and the "params.txt"

load_params: get params values from "params.txt"

global_init: get initialized parameters

load_data:

v_init: not very useful, get the reference image as the tenth one

grid data: compute bin,

alpha_0 = 4 without alpha mode as initial setups

vent_abs2: fitting started

plot_results:results plotted

save_results:results saved

Read data to RAM in the function: image_ buffer::map_signal(const int & FrameNum);
Added the parameter of SignalStrength to division class to store signal sum in grids
Added "division * frames[FrameMax]" to image_buffer to store division data for 15 frames

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.