Sunday, September 28, 2008

School: To do

Summarise MIM till now.

Read all the 3 research papers even if you don't understand at first.



Understand all the maths from CG. Do a write up.


STOP:

Stop watching youtube so much.
Stop sleeping so much.
Stop playing with your hair.
Stop being lazy.

Thursday, September 25, 2008

Representing 3D on 2D

One of the thing I felt most important to CG is the fact that we are trying to represent 3-dimesional objects on 2 dimensions, our computer screen.

Therefore, besides the X and Y axis, the Z axis is utilised for perspective control (orthogonal and modelview, will come back to this in a moment); ex: Z_near, Z_far.

Initially on my GL assignment I made the mistake of drawing my ground plane on X & Y axis, causing all my models to seem like they're stuck on their side to the wall. Wrong! Should draw the ground plane on the X and Z axis!

When drawing & loading model vertices, always remember... counterclockwise to look at the front side. Right hand rule.

CG works by: modelling --> animating --> rendering.

Texture mapping= rendering the surface without requiring additional polygons to represent minute details.

Coordinate system

This I gotta find out more: model space, world space, eye space, normalised projection space, normalised device space, image space.

2D TRANSFORMATION

translation
rotation
scaling
homogeneous coordinates
composite transformation


Rigid Motion (Euclidean Transformation) preserves the distance and angle : Identity, Translation, Rotation. ∴ Shape and orientation does not change!


Linear Transformation: Identity, Rotation, Scaling, Shearing, Reflection.

Affine Transformation: add translation to linear transformations ∴ giving us affine transformation.


3D TRANSFORMATION

homogeneous coordinate
translation, scaling
rotation
composite transformation
change the orthonormal basis

3D Affine Transformation Matrix... absolutely beautiful. Draw it tomorrow.


3D Viewing and Projection


World to Eye Coordinate Transformation
Eye Coordinate System
(related to orthonormal basis)

Grr... Projection Transformation.

2 types of projection: perspective & parallel. The key factor here is COP (Center Of Projection). If projection plane is finite == perspective. Infinite projection plane == parallel.


*****Will come back and finish this. Now I need to sleep. And have mathematical nightmares.
















Oooh... I need to come back to these:
http://www.faqs.org/faqs/graphics/algorithms-faq/
http://kesen.huang.googlepages.com/

Tuesday, September 23, 2008

Maths: Binormial Co-efficient

Binormial co-efficient

(ni) = n! / i!(n-i)!

Binormial theorem

(x + y)n = ∑ni=0 (ni) xi yn-i

in relation to FFD:

conventional polynomial basis: 1 t t2 t3
Bernstein polynomial basis: (1-t)3 3(1-t)2t 3(1-t)t2 t3


1-D example (real line)


given an arbitrary point, v, on a line of P0, P1, P2, P3.

P0=0
P1=1
P2=2
P3=3

v is given as x. t is given as the length of v to P0 divided by P3 to P0.

in general mathematical terms:

v = ∑ 3i=0 P i W i (t)



W = weight = scalar = constant

in this context:

t= ||v P0|| / ||P3 P0|| = x/3

∴ using dot product:

v = 1 • W1(t) + 2 • W2(t) + 3 • W3(t)

(P0 is ignored because P0=0; where the multiplication will results in 0)

= (31)t1 (1-t2) + 2 • (32)t2(1-t) + 3 • (33)t3

= 3t (1-t2) + 6 t2(1-t) + 3 t3

=3t [ (1-t)2 + 2t(1-t) + t2 ]

=3t [ (1-t) + t ] 2 = 3t = x

Monday, September 22, 2008

I've spent 2 hours searching for this post!!!

http://archive.atomicmpc.com.au/forums.asp?s=2&c=10&t=2770&p=0


and this:

http://archive.atomicmpc.com.au/forums.asp?s=2&c=10&t=3197

Read read read!

Free Form Deformation

Read and study:

1. FFD:
Sederberg's paper (1986)
http://www.gamasutra.com/view/feature/3372/realtime_softobject_animation_.php
http://web.cs.wpi.edu/~matt/courses/cs563/talks/freeform/free_form.html
http://www.cs.unc.edu/~hoff/projects/comp239/finalproj/ffd/ffd.html

2. Redbook: chapter 13

3. Polynormial, binormial??? <-- What is this??? FIND OUT!
http://en.wikipedia.org/wiki/Binomial_theorem

NOTE:

Redbook: TOC


OpenGL Matrix
-- http://www.morrowland.com/apron/tutorials/gl/gl_matrix.php

-- http://lists.apple.com/archives/mac-opengl/2000/Dec/msg00036.html

-- http://gpwiki.org/index.php/OpenGL:Tutorials:Theory

-- http://qa.techinterviews.com/q/20060803025430AAvfBIl

-- http://www.sjbaker.org/steve/omniv/matrices_can_be_your_friends.html


That darned euclidean spaces:

http://www.euclideanspace.com/threed/rendering/opengl/index.htm

GL transformation:

http://www.opengl.org/resources/faq/technical/transformations.htm

Linear algebra:

http://groups.csail.mit.edu/graphics/classes/6.837/F04/lectures/linear_algebra.ppt

Some random GL stuff:

http://bcook.cs.georgiasouthern.edu/eclass/cs/lesson8.htm




All these and then some:
vectors, matrices, and then dot product, cross product,
a little trig (sin(), cosine(), tangent()), Polar Coords and Cartesian
Coords. I'm sure I've left something out. It's not too bad. For me,
its been just sheer determination. Oh, and understanding how
OpenGL lays out its matrices.

dot product = scalar product
cross product = vector product



(1) A dot product is an example of an inner product, and is
sometimes called the "standard inner product". If U and V
are n-by-1 vectors, then the dot product is Transpose(U)*V.
If M is a positive definite matrix, then Transpose(U)*M*V is
also an inner product. In index summation notation, if the
components of U are named u_i and the components of V
are named v_j, the dot product is u_i v_i. The repeated
index means sum over it, so
u_i v_i = u_1 v_1 + u_2 v_2 + ... + u_n v_n.
If M has entries M_{ij}, then an inner product is
u_i M^{ij} v_j. The repeated i and repeated j mean sum over
both. If M is the identity matrix, you get the dot product.
For other M, you do not. This concept shows up in conjugate
gradient methods when searching for minimum values of
functions.

(2) A cross product is one example of an outer product, but
the term outer product is quite general in the world of tensors.
The permutation tensor is e_{ijk}, which is 1 if (i,j,k) is an
even permutation of (1,2,3), -1 is an odd permutation of
(1,2,3), and is 0 otherwise (when an index occurs twice). For
example, e_{123} = 1, e_{132} = -1, and e_{112} = 0. The
cross product of U and V is vector W, where n = 3 and
w_i = e_{ijk} u_j v_k
The j is repeated, so you sum over it. The k is repeated, so
you sum over it. The index i is "free" to vary, so the end result
is a singly indexed quantity (a vector).

In 2D, a vector perpendicular to U is vector W,
w_i = e_{ij} u_j
where e_{12} = 1, e_{21} = -1, e_{11} = e_{22} = 0. The
index j is repeated, so you sum over it. The "dot perp" of
U and V is a scalar
d = e_{ij} u_i v_j
Sums occur over i and j.

In 4D, a vector perpendicular to U, V, and R is vector W with
w_i = e_{ijkm} u_j v_k r_m
The rules for e_{ijkm} being 1, -1, or 0 are similar to other
dimensions. Sums occur over j, k, m. Index i is free to vary.

Another outer product of two n-by-1 vectors U and V is
U*Transpose(V), which is an n-by-n matrix. The outer
product using indices is u_i v_j. No index is repeated, so
there are no sums (n choices for i, n choices for j, total
number of choices is n*n). This concept shows up
in projection matrices. If N is a unit-length normal vector
for a plane through the origin, the projection matrix onto the
plane is P = I - N*Transpose(N).

Surround yourself with people who are like this:

Ordering take away

Mum: That family came after us. Have they gotten their dinner yet? *crane her neck to look over* Hmm... apparently not. They are still praying.


New sms tone


*Kraaaang*
He: I think your phone just challenged you to a duel.

Sunday, September 21, 2008

Pssstt... I got A

For my first GL assignment. Which... in retrospect is kinda easy and only a 10% out of the whole CG module.

But I feel great! Except that the codes don't compile on linux, different glut framework apparently.

I asked mum again, "What if I don't make it? What if I get kick out of grad school?"

She looked over at me calmly and said, "Then you should be grateful for whatever you've learned so far. And put them to good use. You already have a first degree. This is just something you're doing out of interest."

But I want to graduate. I want to do this. Even if I don't ever work in the field of CG & VR. I find this very interesting, very challenging. I like knowing that I have something else besides that nasty work place that I am in.

Monday, September 15, 2008

If I pass this sem:

I will....

1. Buy a new camera! Maybe give this one to Iqbal.
2. Get a new tattoo.
3. Clean the study room.
4. Buy Photoshop Academic for Mac.
5. Clean Mac... Re-arrange all the documents from studies.

Ok... Sounds great!!!

And if you nail the job...
DEFINITELY getting the Photoshop for Mac! And the tattoo. And the kettle...

Oh and yoga!

Sunday, September 14, 2008

Setting up a html codebox

Check out all the html markup specs here: http://www.w3.org/MarkUp/html-spec/html-spec_8.html

Friday, September 12, 2008

Wednesday, September 10, 2008

Ma! I've got it!

The common cantonese phrase.

And guess what? I GOT IT! I've managed to make my GL works! Yay!

Today has been a really upsetting day.

1. I was careless enough to delete about... 50 solutions? Crap. Oh well, whatever.

2. He lied to me. I was only testing him, and he lied to me. Great...


BUT my GL code works!
And my perl script is coming along nicely.
Oh and my C++ should be done pretty soon.
So who cares?

PERL Related

sysopen(FILEHANDLE, $name, $flags, $perms) or die "Can't open $name : $!";

find the sysopen param here: http://www.unix.com.ua/orelly/perl/cookbook/ch07_02.htm

CPAN Modules - usage

IO::Socket::INET

Perl resources:

http://www.perlmonks.com/

Read them when you have the time

Tech-ish, maybe. Not sure:

Debug like a ninja

Monday, September 8, 2008

MacOS || XCode || MacFramework.OpenGL || MacFramework.GLUT


http://search.lists.apple.com/


OpenGL Gotchas

Funny nerdy quotes

I'm a programmer. My attitude starts with arrogance, holds steady at condescension, and ends with hostility. Get used to it.

"Self-education is, I firmly believe, the only kind of education there is." - Isacc Asimov

"He was the sort of person who stood on mountaintops during thunderstorms in wet copper armour shouting 'All the Gods are bastards.'" - Terry Pratchett

If you understand what you're doing, you're not learning anything.

Gawking at stupidity.

Reality is what, when you stop believing in it, doesn't go away. Failure is not an option. It is a privilege reserved for those who try.

One thing I've noticed lately is that many engineers in different fields (EE, ME) don't try to simplify and automate things as much as software people do. I'm not sure why that is, or even if it's true in general. After all, the sample size I'm basing this on isn't very big (a couple dozen engineers I've worked with).

It may be cliche, but it seems that people who get good at writing software are motivated by laziness. If everyone was as constructively lazy as a good programmer is, the whole world would be more efficient.

--From here

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. -- Rick Osborne


I try to compress orders at restaurants by giving all necessary information in one packet. This frequently does not work, because the order taker's task buffer is limited to one piece of data at a time.

Fast Food Girl: Can I take you're order?

Me: number 6, BBQ, diet cola, debit.

FFG: What dipping sauce would you like?

Me: BBQ, diet cola, debit.

FFG: What would you like to drink?

Me: Diet Cola, debit.

FFG: Is Pepsi OK?

Me: [ponders Abstract Base Classes and the FFG's lack of Polymorphic Behavior] Sure. I'll pay with my debit card.

FFG: And how will you be paying?

Me: [sighs] debit.

--From here



Personal:
I think I will die of exhaustion like this. I cannnot not sleep for so long!

Sunday, September 7, 2008

Is my life on tv?

I just want to tell you, he died. You know? His friend, taiko? Well he died. Vomitted blood. Died at home.

Oh. I just saw him that weekend. You are not joking right? *I feel stupid saying that because I know mum doesn't joke about things like that but I had to be sure*

I had to deal with his things. He's an orphan. I hired people to deal with everything. He is only my son's friend. Oh... I am so tired. Can I disown my son? I really think I want to do that.

Mmm... That boy... is quite naive. Good boy. For all he is, whatever he was doing, he is really just a naive boy.

The life he was leading... His existence was on loan anyway. I wish I don't have this son. Is it my karma? I hope I get to sleep tonight. I've not slept much.

Mmm... Is the funeral over? How's my brother taking it?

Yes. 7 days ago. I've dealt with it. I arranged everything. Your brother? He's back in malaqa. He just runs away whenever anything happens and leave us to clean up after him. I took care of the boy's house and funeral. And his things.
You come home some time soon, ok? To see me. Life is brittle.

I have a short school vacation soon, I will go home then.

Alright, Tell you more when I see you. I don't trust our conversation over the phone.



I wanted to say something but nothing I can say is of that magnitude. I started a sentence but then I said,"Oh well, it is just work. Not like what you're going through anyway."

My brother once said, "Don't love old people too much, because they die too soon. And then you will be heart-broken." I think, I will like to change that. Don't love anyone too much because they just die.
Reminds me of "A Scanner Darkly"; which I couldn't finish because it is too close to home.

Saturday, September 6, 2008

Computer Graphics: Matrices... and then some

http://www.geocities.com/SiliconValley/2151/matrices.html

Thoughts on AI...
"I = i * o * p * N
where i is input, o is output, p is the ability to plan, and N is multiple ways of doing these things.

In the realm of AI, this means,
input is multiple sensors.
output is the ability to interact with your environment.
p is the ability to see the relationship between the input and the output
N is the ability to see relationships within the relationships."


Oh oH Zeus CMD

C++ Maths definition.

Tuesday, September 2, 2008

C++, GL, GLUT problems & solutions

how to use: glGetError()

AARGH!!! I can't believe I am so stupid! I kept having the window crashing on me. Now I know... I forgot:

glutPostRedisplay();

at the end of keybored function. And I've spent endless nights thinking about where I went wrong!

va_list

I am right now having some problem with va_list. So as I was searching on the compilation error, I chanced upon this thread:

Oh for ........s sake, pay attention!!!!
http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1044651050&id=1043284351

I used foo() because your crummy broken code didn't even have a function prototype in scope to even quote back at you. Just a bunch or random crappy lines of poorly indented code.

Sheesh!!!!!!!
no wait, that's not it
SHEESH!!!!!!!!!!!!!

A bit of advice, do not under any circumstances buy a gun. You're simply not equipped to cope with it's point and click interface. Trying stuff and then asking "what does this do" just isn't going to work.


And I thought I have bad temper. Haha.

Endianness in computer programming... I remember this... Ok! RECAP!


glutMouseFunc - wheel

Ok. Just as I thought. Mouse scroll with GLUT under MacOsX does not work. See here.
So I've decided to fore go the use of wheel and improvise with mouse x,y... Maybe I can use 2 buttons click for scale function.


GLUT README
.

GL_LINES for ground grid: There's no precedence for vertex if you're using GL_LINES. The vector drawn will still look the same either way.

Monday, September 1, 2008

Specific OpenGL sites for...

mouse function:-

rotate: glRotate
translate: glTranslate
zoom:

samples eer... aaah...