Saturday, 29 November 2008

Right, let's talk reflection!

Ever shined a torched light or a laser beam towards a mirror? If not, you probably have witnessed reflection by just looking into the mirror. Reflection of light, it's so fascinating and simple. But when it comes to math, it's a different story.

I'm been doing some paperwork on reflection of light, and I think I finally got it. Before I continue, there's gonna be a lot of Math mumbo-jumbo, so, again, if you hate Maths more than you hate the annoying little barking bitc.. dog next door, I suggest you look away. Lol! (No offense to those dog lovers, yeah, it's just a joke)

Here goes:

Let's say we have a beam of light. The beam's direction will be called as vector D. I'm going to be using a lot of vectors here.

There's also a plane of mirror, with a normal vector, N. This normal vector is a unit vector, ie, a 1-unit long vector. The normal vector is a vector that is perpendicular to the mirror.

Now, I shall draw it out. Introducing, MS Paint!!



I know, the normal vector is a little too long. I just drew it long so it's easier to see. But remember, vector N is a unit vector, as shown by the symbol above the letter N in the picture.

Ok, now, let's add more stuff.



On the left of vector N, there's another vector. Well, actually, it's just an inverted vector D, or -D. It's inverted for the calculations later. And there's one more extra vector, vector R, which is the reflection.

One very important thing that applies to all reflection:
The angle of incidence = angle of reflection

Therefore, a = b.

Because of that, the scalar projection of vector -D on vector N = the scalar projection of vector R on vector N.

I have coloured the so-called scalar projections in green.

Still with me so far?

The magnitude (length) of the scalar projections can be obtained through what's called the dot product.

The full stop (period) sign is a little too small for me, so to use as the dot product symbol, I'll utilise the "o" symbol instead.

Now, -D o N = |D| |N| cos a
But since N is a unit vector, thus |N|=1
-D o N = |D| cos a

which gives us the scalar projection of -D on N. According to
"the scalar projection of vector -D on vector N = the scalar projection of vector R on vector N."

we should now have:
-D o N = R o N

but we will use
R o N = -D o N instead. It's just the same, anyway.

Ok, that's 1 equation down, we will need 1 more.

The magnitude of the reflection vector (R) should be the same as the incidence vector (-D), so, here comes the equation (oh boy)

Rx2+Ry2=(-Dx)2+(-Dy)2

now, Rx means the x component of the vector. Ry means the y component. Same goes for the D vector.

Ok, I omitted the square root to make things simpler.
Now, we got 2 equations:

R o N = -D o N

Rx2+Ry2=(-Dx)2+(-Dy)2

Right, let's try with an example:



Right, I have normalized the normal vector, N. Normalizing is basically making a vector exactly 1 unit long. The vector is perpendicular to the mirror, therefore, it is "normal" to the mirror. So, "Normalize" and "Normal vector" are two different things.

Actually, N's direction is supposed to be (1/sqrt(2) , 1/sqrt(2)), but I was lazy to draw the root, so I got the decimal number instead.

So, let's get cracking.

R o N = -D o N

can be rewritten as

RxNx+RyNy = (-D)xNx+(-D)yNy

Substituting values, we get:
Rx(1/sqrt(2)) + Ry(1/sqrt(2)) = (-1)(1/sqrt(2)) + (2)(1/sqrt(2))
(1/sqrt(2)) (Rx+Ry) = (1/sqrt(2))

Dividing both sides by (1/sqrt(2)):
Rx+Ry=1

Dang, there are 2 unknowns!! What to do?? Chill man. That's where the 2nd equation comes in.

Rx2+Ry2=(-Dx)2+(-Dy)2

Plugging in the known values...
Rx2+Ry2=(-1)2 + 22
Rx2+Ry2=5

Ok, now, let's solve for Rx. First, get Ry.
Ry=1-Rx

Dump that into the previous equation:

Rx2+(1-Rx)2=5
Rx2+1-2Rx+Rx2=5

Remember the "completing the squares" thingie? Right, let's apply it here.
Now, make it so that it is in the form x2-2ax+a2, then it'll be easier.

2Rx2-2Rx+1=5
Rx2-Rx+1/2 = 5/2

To complete the square, take away -1/4 from both sides
Rx2-Rx+1/4 = 9/4

(Rx-1/2)2=9/4

Take the square root of both sides
Rx-1/2=3/2
So,
Rx=2

Placing this into Rx+Ry=1, and you'll get Ry=-1.

Therefore, the reflection vector is (2,-1). Makes sense right?

Woohoo!!! That was long! Now, I'm gonna do more research and probably refine these equations. This might not be the best way to calculate reflection, but at least it's something. Haha

Friday, 28 November 2008

The Curve... no, I'm not talking about the bent line

Today, I was supposed to go to the Curve to watch Twilight with Li Ching and gang. But the problem was, my alarm did not go off, and no one woke me up! So, I went there a little late, so I decided not to go watch the movie. I already missed 1 hour of the movie when I reached there. So, I went walking around. I want5ed to go Ikano, but in the end, got lost some where while looking for the bridge. Then, once I reached Ikano, I got lost in there looking for the bridge back to Cineleisure. Whoa!!!

Anyway, it was fun hanging out. =D

Thursday, 27 November 2008

Java... hmmm

Suddenly, I feel the need to learn the Java language. I have no idea why, but then I just want to try it out. Maybe make one Java application for my phone. I tried it once, but it didn't turn out too good. So now, I'm trying again. Since I'm quite okay with the C# programming language that I'm currently using now, it shouldn't be too hard to adapt to Java. Both of them have almost the same syntax. Gosh, now I have to download more stuff...

Wednesday, 26 November 2008

Antibiotics are losing effectiveness

Just now I saw a show in Discovery Science and it was talking about a baby who is suffering from an illness which is drug-resistant.

I continued watching on, and what I learnt was that antibiotics will not be as good as it is now later in the future.

Bacteria are living organisms. They grow, and evolve to adapt the changes in the environment, just like all the other living organisms. Let's say there's this guy, we name him Mr. X.

Mr.X just got infected by bacteria Y. Bacteria Y multiplies in Mr. X's body. White blood cells then wage war against the bacteria. But the bacteria's too powerful, so, Mr. X was very ill and went to the clinic. The doctor prescribed some antibiotics. Antibiotics are like the superweapons in the micro war. And so, bacterias were killed. Few days later, he was back to normal, so he stopped taking the antibiotics. Little did he know, there were still a tiny amount of bacteria Y left in his body, too little to cause any problem. Soon they multiplied and the new generation of Bacteria Y have a little resistance to that antibiotic. It kept multiplying, and Mr. X fell ill again. Unfortunately, the antibiotics have became less effective. So, the doctor prescribed a better antibiotic for the man. It worked, and he stopped taking the last bits of the antibiotics left in the medicine bottole. And, you'll know what happens next.

That's why antibiotics must be finished. And, like any other drugs, antibiotics must never be misused or overused. If antibiotics stopped working, we'll all return to the pre-antibiotics era, when used-to-be-easily-treatable illnesses can't be dealt with. That's not good.

So, respect antibiotics, and they'll respect you back. Oh, wait, that didn't come out right...

Tuesday, 25 November 2008

List of Projects to complete

The following list enumerates, by priority, my plans/projects for my holidays:
  1. Mr Ball 2 (only 2% done so far)
  2. Finish all Red Alert 3 factions' campaigns
  3. Create a map of the school for CS. (Dunno whether it would work)
I won't guarantee I can finish all of them by Chinese New Year '09, if not New Year, especially Mr Ball 2. I have a lot of stuff to do for my game because of all the storyline and special effects. Hmm... map of the school for CS eh? That idea was originally proposed by Seck Wei's brother, Seck Houng. And I kinda liked the idea, so that's why it's currently in my projects list.

The mapping thing is gonna be one heck of a challenge! But, hey, nothing comes without a price, right? I'm gonna have to get the floor plan first, then have to draw out the prototype. I faced a very annoying problem while mapping one strange map for CS (which turned out quite ok, for me, in the end). I didn't really plan on mapping anything, so I just made a map for fun. In the end, it grew into a must-finish type of map, because I just wanna add some more stuff into my map and play it. The only fun part of the mapping process is going in there and experiencing it. The problem was, I got lost during mapping at some point. Haha. But, that's just a minor problem. The bigger problem was that I just dunno how to continue my map. At one point, there were 3 passageways sticking out at the side of the map, opened to the dark void of space. I can't leave it open! It'll cause more problems! So, I kinda got stuck there, wondering how to end the map with 3 unfinished passages.

Hey, nobody wants to walk through a tunnel and fall down to nowhere at the end, no?

There's gonna be a lot of delays because my sister needs the laptop. I've no access to the laptop currently because she's busy with her stuff. Sigh... I need to do my stuff also. If only she knew that. Well, anyway, because of that, my Mr Ball 2 went wayyyyy out of schedule. I'm supposed to finish at least 25% of the game by now.

Oh, I guess things have to wait. I'm having doubts about my Mr Ball project now. To have come this far, I don't wanna redo it again. All the essentials have already been done. I will cry if I fail to finish at least 1 level.

Wheeee!

I've got to say, Red Alert 3's main screen's theme is quite nice! I love it! Here Here:


Soviet March - Red Alert 3

Well, a lot of the comments said the way they sang the song sucks, because the pronunciation of the Russian words are very cacat. Frankly, I don't know how Russian accent sounds like, so I can't agree or disagree with that. Still, the music is good. Haha.

Monday, 24 November 2008

Life in my cousin's house

So, I'm currently in my cousin's house now. Sleeping over as usual. It's fun hanging out with him. And I also get to play the computer the whole day. I still can play computer the whole day in my house too, but that computer is too blah, so anyway, you get the idea.

What more, my sister is hogging the laptop, so I can't really touch it much. Sigh.... how I want another laptop, all to myself. No interference from other people!

Anyway, I'm just gonna go play with my cousin now, since he just came back from tuition and he currently reading what I'm typing. So, this is Bee Lee, signing off!

Friday, 21 November 2008

Red Alert 3 is the best!!

Today, I finally installed Red Alert 3 on the comp. Or rather, the laptop!! The tutorials were a little long but after that, it was cool. Currently playing the Soviets campaign.

There's one slight problem though. Being a Red Alert 2 player, it's hard to adapt to the controls in RA3. In RA3, you tell your units where to go by using the right mouse button, not the left. So, every time I press the left mouse button by accident, it'll usually deselect the units or select some other things. Very annoying. I definitely love the ability to build stuff on water. At least now, I don't have to worry about limited land spaces.

Well, I kinda miss the Red Alert 2 actors. I thought maybe some of them might make a comeback. Sigh... Maybe I'm too used to RA2.

All in all, it is great!

Thursday, 20 November 2008

BLProductions is hiring!

Sorry, that's not true. But even if its true, I don't have enough money to "gaji" my employees. Anyway, I just only came back from playing badminton with Janie, David and Hon Son. It was ...fun, I guess. I was a bit lazy to move. Maybe due to my lack of sleep.

These few days, I've been watching Bill Nye the Science Guy. It's a fun and entertaining way to learn Science. And it was that show which made me love Science so much! Go watch it in youtube, it's cool!

Well, I've nothing much to post now. So, erm, ...

Wednesday, 19 November 2008

Finally, continued Mr Ball 2!

Wow! I'm so proud of myself! I haven't scrap my Mr Ball project yet! Wheeee!

What I did today was animated some spears. It's a very crappy animation, but at least I did something. So, I only made 1 attack so far for the first diamond. Hmm...




Yes, I know, it's lame. But I've got to say, that's actually quite good for a simple game. Hahaha
There aren't any sound effects yet. Same goes for the music. I'm not going to look for the SFX and BGM right now. I need to finish up the game as fast a possible. It'll probably take me another 2 months to really finish everything. Oh, that's very long. None of my projects have actually gone over 1 month (except Mr Ball).

Oh, if you have watched the video, you may have noticed that there are some slow motion effects there. Oh, it's due to my recorder. Dunno why. But it's kinda cool. I might wanna incorporate in some cool and dramatic slow motion effects. But that would mean a lot of problems for my recorder. Well, who cares!

Tuesday, 18 November 2008

Making a layout is harder than I thought

I'm the one in-charge of the senior scouts blog layout. Trying to make a layout for it is not really as easy as I thought it would be. And what more, my sister is using the laptop everyday. What does that have to do with my problem? I have a drawing program over there, namely, Paint.NET. It's a free digital imaging program. I can't use it on my Windows 2000 because it's not compatible.

Usually it'll take me a couple of weeks to whip up an idea. Take my blog as an example. My blog did not start out with the Billy's Rail Transit thingie. It was quite a while before the new naming convention for the links to kick into action. And the tabbed bar? It only started a few weeks ago. I'm trying to say, the way I change the layout of a blog is by "slow evolution". Sorry, I'm not sure what I'm talking about here. Oh gosh, I lost my point.

Anyway, trying to make a new design for a blog in such short period of time is kinda stressful. I always thought it would be fun. Hmm... what should I do????

Monday, 17 November 2008

Nausea, my evil friend!

The whole day today, I had a very bad nausea. Every time I stood up, I had the feeling to vomit. It really annoyed me. So, I said, "Fine fine, you want to vomit, izit?" Then I rushed all the way to the toilet bowl and tried to induce vomiting. It didn't happen. I tried to vomit like a lot of times. All of them failed miserably. Whenever I don't want to vomit, the nausea kicks in. Sheesh.

So, I went to the doctor again. The nurse/receptionist looked at me and said, "tak sihat lagi ke?". I was like smiling there and said, "yeah...". I was grateful there weren't as many people as yesterday, or else I would be sitting and suffering over there. The headache and dizziness. Argh!!! How I hate this!

The doctor said, "don't worry, it'll only last for a day". Then he gave me some pills for my nausea problem. It worked great! I'm not having any urge to vomit now! But the headache is still there. I guess I'm quite tired now.

London Tipton's really great

Yesterday when I watched The Suite Life of Zack and Cody, I saw this scene.



I dunno why but I find it quite amusing, especially the dance! Lol!!

Here's the lyric:
London Tipton's really great,
really great, really great,
London Tipton's really great
and deserves the opposite of hate
which is Love!

Sunday, 16 November 2008

Gosh, I'm so sick!

It all started last night when I felt a little weak. I thought I was just sleepy. Despite that, I slept late. Then later at 3 AM, I woke up and rushed all the way to the toilet because of a minor discomfort in my tummy to erm... dispose all the junk. Well, maybe not all. You do not want to know how unpleasant it was. Eww!! Diarrhea!

Anyway, I have nausea and stomach discomfort all night. Then when I woke up this morning, I defecated again. Same old thing! Diarrhea. I also had a slight fever this morning. So, later in the afternoon, went to see doctor. He said it may be food poisoning. So he gave me some medicine. One of which is charcoal pills (for the gas in my stomach)!!

I felt weird when I knew I had to eat activated charcoal. I just never eaten charcoal before! Anyway, I can't type much now, I'm having a very bad headache and nausea. So, see ya!

Saturday, 15 November 2008

Tata Seck Wei

It was fun having Seck Wei around. Unfortunately, he had to go back to Penang already. I thought of visiting him during my trip to Kedah in December. Well, at least for the moment, I can finally play with him in CS.

So, anyway, I should continue with Mr Ball 2, and not forgetting about the layout for the Scouts Blog. I know I'm not so active in scouts and all, but hey, at least I get to do something good for it.

Yesterday, I went to the Curve with Seck Wei and Li Ren. We met David, Wei Yuen, Li Ching and a new buddy, Yi Jean. It was very nice to meet her. Yeah, we went to watch Madagascar 2 together. I didn't even watch the first one so I thought I might not be able to follow, but I did, and it was amusing. Awh, Alex (Alakay) the Lion was soooo cute when he was small. Those eyes! Those paws! And the penguins, well, they are erm... okay, just go watch it!

Right, so Mr Ball 2. I must create the first level already. It's already out of schedule. I'm supposed to have finished the 2nd level by now. Okay, I'm gonna prepare myself to go to Jun Ray's house to play his PS1. Byes!

Tuesday, 11 November 2008

Computer is dying

My desktop is having problems booting up. I guess the hardware inside my computer is really failing. I'm not sure when it will finally crumble. And today, my BIOS gone haywire at me, but in the end, the RESET button did all the work. Yeah, so it finally booted up. Even so, the computer crashed, as usual. Two nights ago, my desktop had more unusual crashes. I have never seen those messages before in the Blue Screen. Now, that really freaked me out. Even if I could search up Microsoft about the Bug check codes that were displayed, how could it help me? And, sending the bug check information to Microsoft doesn't really do much good also. All it could say is "a driver encountered a problem" or something similar. Yeah, like that's gonna help.

Anyway,

Here are some more maths! Sorry, I'm just lazy to write it out in my Nonsense Book, so I'll just type it out. I found this in my sister's Math book and Wikipedia. It's about the Quadratics formula and how it came to be.

I had used this formula in my post about Circle-Line intersection:


Okay, the question is, how did it turn from this:
ax2+bx+c=0

to that?

Before I get started with the OMG-IT'S-SO-UNBELIEVABLE maths, let's talk about completing the squares.

Huh? What? Completing the squares?

Anyway, completing a square is just a method used to solve quadratic equations. Right, imagine you have an expression, x2 + 2xy. We want to factorise this so that it'll be in the form of (x+y)2. Before we can do that, we have to find out what's missing in x2 + 2xy that doesn't allow it to be factorised into the (x+y)2. Still with me so far?

Let's expand (x+y)2:
x2+2xy+y2

As you can see, the missing term is y2. Just add the y2 into the x2 + 2xy and it will be factorisable into the (x+y)2. Hmm... factorisable, is there such a word?

Let's take an example:
x2+6x

We need to find the "y". We know that
2xy=6x

So,
y=3;

And, y2=9

Therefore, it'll be x2+6x+9. This is then factorised into (x+3)2.

So, did you get it? I hope you did because we are gonna apply that later in the post.

Okay, now we know how to complete a square. Let's go back to the
ax2+bx+c=0

At first glance, this is cannot be factorised, because a,b and c are not known. But, we could apply what we've learnt just now.

First, we need to make the left side of the equation to be in the form of x2+2xy. To do that,

ax2+bx+c=0
ax2+bx=-c

Now divide the whole thing with "a"
x2+ (b/a) x=-c/a

Good. Now, we can say that,
2xy=(b/a) x
So, y=(b/2a)
y2= (b2/4a2)

Add that into the equation. Remember, whatever you do to one side of the equation must be done on the other side as well. That's the basic rule of algebra.
x2 + (b/a) x + (b2/4a2)=-c/a + (b2/4a2)

Factorise the left side of the equation and add up the terms in the second.
And you'll get:

[x+(b/2a)]2=[ (b2-4ac)/4a2 ]

Square root everything

x+(b/2a) =[ sqrt(b2-4ac) ] / 2a

Solve for x

x = [ sqrt(b2-4ac) ] / 2a - (b/2a)
x = [-b ± sqrt(b2-4ac)]/2a

And that's how you get:


Hope you liked it!! I know I did

Here's a better way to see it, courtesy of Wikipedia:


Monday, 10 November 2008

Ice skating again!

Today I had improved!! Well, sort of. I'm happy that I had experienced by first fall! Most of the time I had close calls but today, I had my first real fall while skating. Well, okay, not really. I was holding on to David. Then he stumbled and it caused a chain reaction. He fell, then I fell. Then I hurt my pelvis. Hahaha!!!

So, anyway, Seck Wei is busy playing with Counter Strike now. And I'm currently being very cautious while using the laptop because my sister's documents are open. Well, just don't wanna see her angry face. It's very freaky.

I gtg makan dinner now. Bye

Sunday, 9 November 2008

...

I'm back from Caroline's birthday party! And it was the bomb! Anyway, Seck Wei came down from Penang yesterday and is currently staying over in my house. Gonna have fun with him until next Saturday, on which he will return back to Penang. Yeah, anyway, I've got to be sleeping right now because I have got to wake up early tomorrow. Good night.

Thursday, 6 November 2008

I'm rolling the world!

Sorry, I couldn't think of a relevant title for this post. This post is all about maths. So, if you hate maths, just look somewhere else. I'm not boasting or anything here, just bored only.

(David, you love Quadratics right? Well, here are some Quadratics for you!)

Right, do you remember about my post about ray tracing. Yeah, I tried implementing it, but it was too buggy, so I scrapped the project. The most simplest thing to ray-trace is a sphere. It's very simple to trace a line through a sphere. But, let's represent a sphere with a circle for simplicity okay.

Okay, a circle can be represented by this equation:
1) (x-x0)2+(y-y0)2-r2=0
where x0 and y0 represents the coordinate of the center of the circle in the Cartesian Plane.

I'm won't go through the details on why the circle's equation is like what I've typed above. If you know Pythagoras' theorem and the Cartesian grid, you should probably have a little understanding on how it's defined.

Next, the equation to represent a line. Here, I'll use vectors.
2) P=L+Dt
where
P is the (x,y) coordinate that lies on the line
L represents the line origin point (the line's starting point)
D is the direction of the line. This is a unit vector (a 1-unit long vector)
t is a scalar value. It's sort of like the distance from point P to L0

So, now, how do we check whether a line intersects with a given circle? First, we derive two formulas from equation 2.

3) x=Lx+Dx t
4) y=Ly+Dy t

If the line were to intersect the circle, there will be at least 1 coordinate that will satisfy both the circle equation and the line equation. Equations 3 and 4 are just to find the x and y components of the resulting vector P.

Anyway, let's plug those two babies into the circle equation:
5) (Lx+Dx t - x0)2 + (Ly+Dy t - y0)2 - r2=0

You're gonna hate what's coming up next. Now, you've got to expand it. Remember the (a-b)2 expansion rule? Hopefully you do because it's one very important rule. Well, Same goes for the (a+b)2 and all his cousins. Okay, you know what I mean right?

(a-b)2=a2-2ab+b2

By applying that into equation 5, you'll get a very big mess...
6) ( (Lx+Dx t)2 - 2(Lx+Dx t)(x0) + x02 ) + ( (Ly+Dy t)2 - 2(Ly+Dy t)(y0) + y02 ) - r2 = 0

This is one hard thing to type out in HTML man. Phew... got that down. Now, expand it some more to get an even bigger mess!!!

7) (Lx2 + 2LxDxt+Dx2t2 -2x0Lx - 2x0Dxt+x02) + (Ly2 + 2LyDyt+Dy2t2 - 2y0Ly - 2y0Dyt + y02) - r2 = 0

Starting to hate Maths already? Well, too bad. That's not the end of the horror.

Now, introducing the Quadratic equation:

8) Ax2 + Bx + C = 0
Now, instead of x, we need to find t.
So, equation (8) will be rewritten as

8) At2 + Bt + C = 0

To fill up the quadratic equation, we need the values of A, B and C. Where do we get such values? Do we like wish upon a star for it to come out? Do we dig underground to look for it? Not really. All you need to do is take equation (7) and factorise out t2 and t. After that, the remaining terms will be C.

So, factorising, you'll get:

(Dx2 + Dy2)t2 + (2LxDx + 2LyDy - 2x0Dx - 2y0Dy)t + (Lx2 + Ly2 - 2x0Lx - 2y0Ly + x02 + y02 - r2) = 0

You should now be able to see clearly which is A, B and C.
A = (Dx2 + Dy2) = 1
Mind you, the direction vector is a unit vector. This is just the Pythagoras' way of finding the length of the direction vector. In the end, you'll always get 1 for A (so long as the direction vector is a unit vector. Remember that)

B = (2LxDx + 2LyDy - 2x0Dx - 2y0Dy)
C = (Lx2 + Ly2 - 2x0Lx - 2y0Ly + x02 + y02 - r2)

Introducing, another pain in the ass (sorry David, I know how much you love Quadratics).

Now, that's the wonderful quadratics formula to solve for the value of "t". (Just substitute the "x" in the above equation with t)

Now, plug in the values that we have just obtained for A, B and C into a,b and c in the above equation and solve for t.

Once you have the value(s) of t, plug it into equation (3) and (4) to get the x and y coordinates of the intersection point(s).

One tip, by using the discriminant, b2 - 4ac, you can determine how many intersection points are there.

If...
b2 - 4ac = 0, there's only 1 intersection point
b2 - 4ac > 0, there are 2 intersection points, thus, 2 possible values for t
b2 - 4ac < 0, no intersections.

Here's an example:


Anyway, here's how to do it. Let's try with the red line. The starting point of the line (the origin of the line, L) is (-5,-5). The direction is actually supposed to be 1 over square root of 2 (1/sqrt(2)). 0.707 is just approximation.

The circle's center is at (2,2) and has a radius of 2. So, we got everything we need. Let's crank it up using the formulas above. First, let's get A, B and C!!
A=1 (direction vector is 1 unit long)
B= (2LxDx + 2LyDy - 2x0Dx - 2y0Dy)
So, B=-19.796

C = (Lx2 + Ly2 - 2x0Lx - 2y0Ly + x02 + y02 - r2)
So, C=94.

FYI, my calculations may be wrong. This is really one complicated formula, and because I'm always very careless, mistakes may occur. If you think I may be wrong, just ignore it. This won't appear in your Math syllabus.

Okay, let's find the discriminant:
b2 - 4ac = 15.88
And 15.88 > 0, so there are two intersections, as shown by the image above.

The value of t would be:
t=[19.796+sqrt(15.88)]/2 = 11.89
t=[19.796-sqrt(15.88)]/2 = 7.91

Now, slap the values of t into equation (3) and (4) to get the x,y values of the intersection points and you'll get

(3.4, 3.4)
(0.59, 0.59)

Those are the intersection points of the line and the circle. Remember, that's just an approximation. So, it's not 100% accurate, there's about 1% margin of error.

So, I hope you get it. It's interesting, no? You can try it out with the blue line.

Mr Ball suspended for a few days

I couldn't continue making Mr Ball 2 because my sister keeps taking away the laptop. I'm still stuck at modeling the spear for the Black diamond. I hope I can still catch up when I have the chance. Gah!!!

So, did you like the BGM I embedded into my blog? I love it! Haha. Again, it's the Katamari Damacy theme song.

Me gonna go play Katamari after this!

Wednesday, 5 November 2008

I love Katamari Damacy!!

If you haven't played Katamari Damacy before, I recommend that you try to play it. It's freaking addictive. The aim of the game might sound lame, but it's actually quite fun. What you do is, you control the Prince, the son of the King of the Cosmos. Somehow, the King of the Cosmos destroyed all the stars in the universe, and you are assigned the job to bring back the stars. How are you gonna do that? By using a very sticky ball called the Katamari. You'll go around rolling things up (only those which are smaller than your Katamari). As you roll up more stuff, your Katamari will grow, giving you more varieties of objects to roll up. Eventually, you can even roll up humans! It's quite amusing when they scream right when they get stuck in your Katamari. XD

Oh, it doesn't stop there. There's one level which allows you to roll around the world!! If your Katamari is big enough, you can roll up buildings, clouds, tornadoes, whirlpool, cruise liners, you name it! Ultimately, you can even roll up islands and wipe out the face of the Earth!



After each level, the Katamari will be thrown up and turned into a star or a constellation depending on the level. All the levels have specific goals. The main levels (those that create stars or the Moon) require you to grow your Katamari to the needed size in the given time limit, ranging from a short 5 minutes to a long 25 minutes, to advance. I've got to say, the last level, the one that creates the Moon was 25-minutes of SUPER FUN! Well, when you just only start the level, you can't really roll many stuff. But one your Katamari is as big as a building, whoa!! Watch out! The game has it's own way of measuring the size of the Katamari. The size is stated in metric units, you know, meters, centimeters, yada yada. In the last level, when you start, your Katamari is only 1 meter big. The goal of the level is to grow your Katamari until it is 300 meters! That's very big! Hence, the long duration of play time in that level. The first time I played I couldn't manage it. It was freaking hard. Then the second time, I really improved! I got until 800+ meters! There's practically nothing left on Earth in the end!

You should try to play it! It's very fun.


If you are wondering what BGM is playing in the background, it's the Katamari Damacy theme. It's quite catchy, don't you think?

Saturday, 1 November 2008

Mr Ball 2 story line

Okay, I've made a small draft on the storyline of Mr Ball 2. Most of it is about Mr Ball's past. But anyway, here it is.

Anyway, yeah, I might have spoiled a little in here. So, if you still wanna read it, go ahead. Well, it's just a lame story.

Back from 1U

I'm back from 1U, and I had spent quite a lot of money today. Probably the most I had spent on a given day. Here's a list of things I bought:
  • CD-R x 10 = RM13.00
  • CD sleeves x 100 = RM11.00
  • CD Holder x 1 = RM3.00
  • Red Alert 3 + Bonus CD = RM30.00
  • KFC = RM18.75
  • Butter Croissant (Delifrance) = RM2.40
Total = RM78.15!!

I had mixed feelings about that. First, I was happy that I bought Red Alert 3!! Wheee! But was very hard broken to cough up about 3-4 weeks of allowance!

Going to 1 U

I'm supposed to go 1U to play at the Cyber cafe with my pals. But then many people aren't coming, so it'll be a very boring moment in CC. So I decided to go shopping around with Jun Ray. I wonder what can I buy. Oh yeah, I need CDs!!

Oh, that reminds me, I also wanna buy Red Alert 3!! Wahh!!! Can't wait to continue the story! Sigh... my sister took the laptop, so I can't continue Mr Ball. So far, I can only tell you that the first boss fight involves the Black Diamond, the one that uses spears. You'll probably see him a lot of times.

And finally at the end of the game, you'll fight the Diamond Organisation leader (name reference: Organization 13 from KH2). I'm still in the middle of thinking up a storyline to relate Mr Ball and the diamonds, and why they are trying to eradicate him.