Apr 28, 2008

CG manual

CG stands for Programming Language C for Graphics.
It is quite new technology.

You can download the manual Here:

Apr 23, 2008

Java Refraction method, using quaternion.

This is the refraction method I have made. For somebody who will need this kind of program I'm posting the source code.
import javax.vecmath.*;

public static Vector3f refract( Vector3f rayDir, Vector3f n, float indexRatio ) {
//assert (isNormalized( rayDir ));
//assert (isNormalized( n ));
assert (0 != indexRatio);
// Ni * Sin(I) = Nr * Sin(O); Snell's Law
// sinO = sinI / degree ; where indexRatio = Nr / Ni
// we need to know the angle R; where R = I - O
// rotate rayDir degree by the vector calculated by crossProduct(n,rayDir)
// q = cos(R/2), cross.x * sin(R/2), cross.y * sin(R/2), cross.z * sin(R/2)
// P' = qPq' ; Using Quaternion
final float cosI = n.dot( rayDir );
// assert (cosI <= 0f && cosI >= -1f);
if( cosI >= 1f || cosI <= -1f ) return new Vector3f( rayDir ); // straight final float sinI = (float) Math.sqrt( 1 - cosI * cosI ); final float sinO = sinI / indexRatio; if( sinO > 1f ) return null; // over angle, this should be treat as reflection
final float R = (float) (Math.acos( sinI ) - Math.acos( sinO ));
assert (false == Float.isNaN( R ));

final Vector3f cross = new Vector3f();
cross.cross( rayDir, n );
assert (false == Float.isNaN( cross.x ));
assert (false == Float.isNaN( cross.y ));
assert (false == Float.isNaN( cross.z ));

final Quat4f q = new Quat4f();
final AxisAngle4f axis = new AxisAngle4f( cross.x, cross.y, cross.z, R );
q.set( axis );
final Quat4f q2 = new Quat4f( q );
final Quat4f P = new Quat4f( rayDir.x, rayDir.y, rayDir.z, 0 );
q.mul( P );
q.mul( q2 );
final Vector3f rst = new Vector3f( q.x, q.y, q.z );
//assert (isNormalized( rst ));
return rst;
Hopefully someone who will use this likes to understand how it works, before use it. And anyone might be able to improve the acos and square root parts, because they are expensive calculation.

Ray tracing

I have made ray tracing program, using java.
This is the one of the results: (Click image)
Sooner or later I will upload this program, not only screen shot.

Apr 22, 2008

When did the nationalism come to East Asia.

Most of Korean, Japanese and China have got brain washing about nationalism. It still happen in their elementary schools.

Their basic idea about nationalism is everybody is one family long time ago. So they need to help each other against the other nations. In Korea we have one origin ancestor, Dangun, BC 2333. According to the Dangun legend, every Korean has one lineage. North Korea emphasis on the nationalism more than South Korea, in order to sustain their system. A few years ago, North Korea claimed they have found Dangun's tomb.One thing which is very contradict is that according to the Dangun legend every body are one family. Now Korean has strong idea that every Korean in history had shared the Dangun legend after BC 2333. If it is true, then 500 years ago a Korean slave could insist my ancestor is same with my owner's ancestor. But it is obviously true that the hierarchy system in Korea history based on the different linage idea; A noble's blood is totally different from that of slave. If a slave had insisted it, he might be executed in public. One idea refers everybody is one family, and another idea refers we have different ancestor. How could it happen?

The Dangun legend is a replica of 'TenO' legend in Japan, which means King from Heaven. When the japan was to face to fight against China, they needed more support from their people, about 1900. They have developed their nationalism. According to the idea, their nation is selected by heaven and they need to expand their nation. And some of Korean have learned Nationalism from them when they adopted many western cultures; Most of cases Korea had imported western cultures from Japan indirectly.

Nationalism is newly developed idea even in western. But most of people believe it has inherited from very very old history. However, at most it has only about 400 years history in Europe. And in Japan, Korea, and China it is at most only 100 years.

China blacklists actress Tang Wei

Tang Wei is a actress in the famous movie, Lust and Caution. Last month she was blacklisted by SARFT, which is China's State Administration of Radio and Television. I guess it is a kind of censoring department.


I don't know the exact meaning of 'Blacklisted' in China. I guess she cannot be in any movie in China anymore, according to the whole article; kind of expelling.

The reason why she is banned is "(she is) Beautifing Japaness collaborators." I have strong opinion that the basic idea is exclusive nationalism.

Apr 21, 2008

JUnit Factory

One of the interesting utility about software testing is JUnit factory:


It supposed to automatically generate JUnit test cases.
It sounds great.
And it works in small program.
But once I tried to use in my Graphics Project, it didn't work. The reason was that I have used external library such as SWING and vecmath libraries.
Since it is almost impossible to make a program without using any external library, I concluded JUnit factory is bad.
It is interesting in principal not in practical.

It is still tough challenge to generate test cases automatically.

Apr 12, 2008

North East Asia History Research

Just I came up with a old news related with China government. It was quite seriously dealt in Korea mess media in 2006. The Chinese name is 東北邊疆歷史與現狀系列硏究工程. This is a China government official project.

China government now insists that long time ago North Korea region belonged to China. Briefly saying, it is a kind of distorting history, like Japan distorts their own history about World War Second. Many people proposes different interpretation about it. I summarize them here briefly.

In short-term, the project justifies that China combines many different minority tribes around northern part of North Korea. They want to alleviate high tense among minorities, enforcing nationalism.

In long-term, it is basic work to prepare a certain situation that could happen in North Korea. It is already well-known facts that Japan and China are all highly interested in North Korea for their own benefits. Changing history, China can insist any kind of right of benefit from North Korea.

Although I don't care about this kind of nationalism fighting, most of Korean were very angry about that. And our president had also announced.

About Tibet 2

I have found two good articles.

One of the articles is written by Charlie Hore who is a author of the book, The Road to Tiananmen Square(Amazon).

Another one is about the very first demonstration, 11 March 2008. This article describes what happened there in chronical order. It shows it was a peaceful anniversary march.

I also have found a specific information about the forced contract between China and Tibet in 1951: 'Tibetan Agreement on Measures for the Peaceful Liberation of Tibet, [17-Point Agreement of May 23, 1951]"

Apr 11, 2008

About Tibet.

This is a translation from a Korean web site.

This is an interview with LakBbaChoGo who is a represent of Tibet refugee government.
My interpretation is so much bad. And this may has some wrong interpretation. But I want to post this, because I think this can well summarize what's going on in Tibet now.

Question: What is the reason for this riot?

This is the result of long term period. Of course there is direct reason. It is that the China government used violence for the peaceful march.

Ironically while the China military used violence, HuJinTao used the word, 'Democracy', from 40 to 50 times in his starting speech of the 17th all people representation. However, what happened in Tibet? The government army killed people in peaceful march. And ordinary Tibetan became upset, and they attached shops and cars whose owners are Han as representation for their anger. And the China answered, using more violence.

Then why did Tibetan attack them? The China government devastated Tibetan's human right for 60 years. Their anger has been accumulated by daily humiliation.

It is not true that the China government insists that the exploding from them is because Dali Lama controls them.

Question: Why does the China government keep occupying Tibet?

The China government forced to combine Tibet in 1951. At the time the China government made a contract, saying '17 contracts' with Tibet. Actually it was forced. All of the 17 elements are made by the China government, and they ordered Tibet to just sign it.

In Chinese the name of Tibet is the West Treasure. What the meaning is that Tibet has lots of natural resources. It is about 60 kinds. Water resource is affluent. It is importance place in the meaning of military as well.

The China government now wants to use the water resource in Tibet to solve the water problem in inner continent place. Now a day Oil causes war. Many experts say in future water resource would cause war as well. In this sense Tibet is important strategically. The rivers in Tibet are connected to China, Bumma, Bangladesy, and Russia.

The China government insists they are developing Tibet. Actually they are developing. But does ordinary Tibetan be able to get some benefit from it? The China government develops Tibet only for their own benefit. The recent and new rail road has been developed to deliver their soldiers faster. In addition, it is to carry more resources from Tibet to the other places. The resources in Tibet helps the growing of ShangHai. At the same time the environment in Tibet has been devastated by the new rail road.

Now a day at the Tibet independent region there are more Han people than Tibetan. Of course historically Tibetan had used broader region than now. But it is surprising that there are more Han people even in the independent place. We become minor people even in our nation.

*PS: The first peaceful march is that Tibet monks had a march to commemorate the resistance in 1959. In the march police shoot people. Then people thrown stones. According to the information from Tibetan, police killed at least 80 people.

Apr 9, 2008

Pain is nothing compare to quit.

Pain is nothing compared to what it feels like to quit.
Give everything you got today for tomorrow may never come.

SkyDrive and GDrive

Today I got a email from WindowsLive.com.
It announced that I can use 5G free web drive.
I was quite interested in it. And I tried to use it, without any expectation, because it is unbelievable that someone gives me Free 5GB web storage.
It worked amazingly. In addition, it was so much simple and easy to use.

The service name is SkyDrive.I sometimes think of online CVS server, like sourceforge.org for individual. I want to save my programs I have made not only in my hard-drive, but also online web site. It can serve as a kind of backup and it can make me share my data everywhere. For this purpose I usually send all documents I have wrote to myself, using G-Mail. Now we can just use the Sky-drive.

I found a more interesting information. Google is also preparing a similar service called GDrive. I may be able to share free storage on GMail with GDrive. World is getting convenient.

Apr 7, 2008

Why do we take exam?

Nobody likes exam. Then why do we take exam? Who have developed the exam?

They are Pedagogists, whose major is the Education. They have wanted to check whether or not a student understood well. Their purpose is actually not to reveal the shortcoming of a student, but to fill up a student who haven't understood yet. Exam is a measure stick for education. Why do they measure? Because they want to satisfy their original goal.

First of all, they make a certain amount of contents, and they want to let all of students know all of the contents. It is their original goal. In this sense, theoretical model is everybody gets 100 point, which looks all of them become same. If some of students failed to get 100 point, then it means a instructor need to teach them, to let them know all. Exam is feed back system to educate.

In real educational system, however, a school never feed back for their exam results. It is, simply saying, the process has finished just half of it. If they don't feed back, and don't make up, why do they take exam? Why does a person ask the price of bread, if he wouldn't buy it.

My point is that the purpose for exam in theory is much different from the purpose in real world. A society adopts exam system, in order to make Rank. And limited resource for education belongs to small group of 'High rank' people. Actually it should be opposite, according to the educational theory. Since 'Low rank' means they haven't understood well, and they need more education, the more resource should belong to them.

Why does our society behave in this way, which is much different from theory? At least they should have post process after exam, unless their purpose is making Rank. Why does a society want to give a rank to all of students? Who likes ranking system more? Why do we need rank? Because it is the easiest way to find a 'Better' employee.