Skip navigation

Monthly Archives: January 2008

this is cool

I thought the movie was fantastic.

I think the critics overreacted (with positive enthsiasm), however.

The short of it is I was thoroughly entertained. Daniel Day-Lewis is fantastic. Maybe I’ll write more later, maybe not.

thought this was cool.

all about the triangle

mathematical fallacies

this superstition index is fun to read.

Ryan Porter is a gossip column writer for msn.

However, I was wondering, who is Ryan Porter??? I did a Google image search and came up with this image of some college kid named Ryan Porter standing next to a fantastic looking girl named Kelly MacDonald.

Ryan Porter’s writing is quite good, but I wonder who is really is.

ha ha ha. this is kind of amusing.

check out google trends for the words “i wish”

Google wish graph

it seems there’s a spike in “wishing” through google near christmas time. i remember when it was candles on a cake, an eyelash you stick down your shirt, a dandelion you blow the little white things off of, a pond into which you throw a penny. crossing your fingers. a wishbone.

here

Look at this moronic quotation from Salas, Hille and Etgen’s “Calculus: One and Several variables”:

Choose any point P, P != O, in the plane. Let l1 be the line through P parallel to the y-axis and l2 the line through P parallel to the x-axis. Let a be the coordinate of the point of intersection of l1 and the x-axis, and let b be the coordinate of the point of intersection of l2 and the y-axis. Then P is identified with the ordered pair of real numbers (a, b).

I mean, come on. All they’re describing there is how you find a point by an ordered pair in the cartesian plane.

This is some of the worst writing I have ever seen. It is written like a C program where variable declarations are all at the top of the program. “Let l1 be, a be, let b be”… really. People don’t read like computers.

There is a much more human way of writing this, and they haven’t got it.

The strange thing is in their introduction to the text, they promise:

“The mathematical statements are careful and precise; the basic concepts and important points are not obscured by excess verbiage”

To be fair, there are quite a few places where I’ve said to myself “Yes, well done there. That is well stated.” But at other times . . . . they’re not writing for people. They’re writing for themselves and defining things with a degree of rigor that just makes the writing harder to read while imparting no additional understanding to the reader.

here’s a proof

and another

dr math’s

and a funny quote
‘The tools of a mathematician are pencil, paper and waste paper basket. The waste paper basket distinguishes him from a philosopher’

*Expanding list

  1. If a and b have the same sign, then a*b >= 0
  2. In general, A – B ≤ | A – B |
  3. | A – B | ≤ | A | – | B |. This is called the triangle inequality.
  4. | | A | – | B | | ≤ | A – B |. This is an extension of the triangle inequality.
  5. The quotient a / b will end up being a terminating decimal number only if b can be written as the product of 2′s and 5′s when broken down into its prime factors. Stated another way, if you can write b = 2x5y, x ≥ 0, y ≥ 0, then the quotient a / b will be a terminating decimal value when it is calculated (e.g. 3 / 8 = 3 / 23 = 0.375)
  6. Two lines the Cartesian plane are perpendicular if m1m2 = -1
  7. The angle between 2 lines on the cartesian plane is given by:

    tan( a ) = | (m2 – m1) / (1 + m1m2) |

    Notice that if the lines are perpendicular, then the RHS becomes infinity.

  8. The sum of angles in any polygon is (V-2)*180, where V is the number of vertices in the shape. See (V-2) triangles to make any shape
  9. If you’re not sure how to solve a complex problem, try using the principle of superposition ;)
  10. Interesting, but not very useful fact when it comes to programming with math:
    max( a, b ) = 1/2( a + b + | a – b | )

    min( a, b ) = 1/2( a + b – | a – b | )

here’s a link to a cool astronomy blog

some pervert __released on the internet__ was was presumably a very private affair.

OH WE KNOW SOMETHING NEW NOW! Meg had SEX with a regular man. BIG FRICKIN DEAL. people are so stupid. honestly. all the people who criticize her or even made a big deal about this tape should have to take a vow of celebacy.

if you can’t keep it then keep your mouth shut, fucktards.

When is a rational number going to have a repeating decimal?

It turns out there’s a really easy way to find out.

For example, given:

 3
---
250

I can tell you from now (without touching a calculator) that will have a TERMINATING DECIMAL.

Given

8
-
9

I can tell you from now (without touching a calculator) that will have a REPEATING DECIMAL.

How do I know?

All you have to do is factor the denominator into its prime factors.

 3         3           3
--- = ----------- = --------
250   (2)(5)(5)(5)  (2)(53)

If the denominator of any fraction has the form 2x5y with x, y positive integers, then that fraction represents a terminating decimal value. Otherwise, the fraction represents a repeating decimal value.

Said another way, if you can break down the denominator to being just a bunch of 2′s times a bunch of 5′s, then the fraction represents a repeating decimal.

More examples:

 3          3
--- = -------------
900   (22) (32) (52)

       1
= --------------
  (22) (3) (52)

I say the above example will have a repeating decimal because the denominator cannot be totally written as the product of 2′s and 5′s.

Checking with Mr. Calculator, I’m right. 3 / 900 = 0.0033333333 (repeating forever).

Now let us try another example:

 9          9
--- = -------------
900   (22) (32) (52)

      1
= ---------
  (22) (52)

So I say this WILL BE a terminating decimal, because the denominator just becomes 2 x 2 x 5 x 5, which is purely the product of 2′s and 5′s.

Indeed, 1/100 = 0.01.

And that’s the way it is.

I just heard about this really cool looking “mario fusion” fangame that some dude is making.

I’ve got to check that out when its released!

Lyra u SUCK

“After a brief encounter and months of daily talking, I took the plunge and went to visit him.”

THAT SUCKS.

RIGHT AWAY I could tell that wouldn’t work out. YOU ARE the lady, no? You should not have extended yourself that far to go see that man. He should have come to see you. That’s the way it goes.

Jeez. The things good women do for stupid men.

In order to be able factor easily you first have to totally memorize your 12 times tables.

If you didn’t totally memorize your 12 times tables, then factoring will be really hard for you.

Factoring will be even easier the more times tables you memorize. So you might want to memorize your 16 times tables or even 20 times tables.

Anyway, here’s an example of how you factor.

Say you have something like:

9x2 + 12x + 4

How do you factor that?

  1. First thing you do, is you write on your paper 9 x 4=36.

    In case you didn’t know, the reason we’re doing that is 9 is the number in front of the x2 part, and 4 is the number with no ‘x’ after it. So that is the first number you write down.

  2. The next thing you do is you write down 12. Why is it 12? Because 12 is the number beside the plain ‘x’ (the ‘x’ ALONE, NOT the x2 part).

Ok, so now on your paper you should have this:

STEP 1: 9 x 4 = 36

STEP 2: 12

So here’s what you have to do now. You have to find 2 numbers that MULTILPLY to equal 36, and at the same time, those 2 numbers should ALSO add up to 12.

Hmm. That can be hard to figure out . . . UNLESS YOU KNOW YOUR TIMES TABLES REALLY WELL!! Then its easy. You would know that 6 x 6 = 36. And lo and behold, 6 + 6 = 12. So The numbers are just 6 and 6.

Then, you write:

9x2 + 6x + 6x + 4
= 3x( 3x + 2 ) + 2( 3x + 2 )
= (3x + 2) (3x + 2)
= (3x + 2)2

Numbers have names.

In this post, I’m going to talk about these names:

  • INTEGER
  • REAL NUMBER
  • RATIONAL NUMBER
  • IRRATIONAL NUMBER

First, you must know what an INTEGER is, and what a REAL NUMBER is, and the difference between INTEGERS and REAL NUMBERS.

An INTEGER is just a name for ANY WHOLE number. Examples of INTEGERS are:

  • 5
  • -100
  • 20

A REAL NUMBER is just a name for ANY decimal valued number. Examples of REAL NUMBERS are:

  • 5.3
  • -100.402
  • 20

The only difference between REAL NUMBERS and INTEGERS is that REAL NUMBERS are allowed to have something after the decimal point.

INTEGERS are NEVER allowed anything after the decimal point. INTEGERS aren’t allowed to have a decimal point in them at all.

Notice in the last example for a REAL NUMBER, I put plain old 20. 20 is BOTH an INTEGER AND a REAL NUMBER AT THE SAME TIME!!! That’s an important point to understand, and we’ll talk about it again in a second.

First, try these exercises:

Question: Is 1.24 a REAL NUMBER or an INTEGER?
Answer: 1.24 is a REAL NUMBER. 1.24 is NOT an INTEGER because it has a decimal part.

Question: Is 5.929848995681948 a REAL NUMBER or an INTEGER?
Answer: 5.929848995681948 is a REAL NUMBER. 5.929848995681948 is NOT an INTEGER because it has a (huge) decimal part.

Question: Is 5000 a REAL NUMBER or an INTEGER?
Answer: 5000 is an INTEGER. 5000 is ALSO a REAL NUMBER. 5000 is BOTH an INTEGER AND a REAL NUMBER AT THE SAME TIME!!!

To understand this idea that a number can be BOTH a REAL NUMBER and an INTEGER at the same time, just think about the different nicknames you might have for one of your friends. I have a friend named Bob. Bob is really fat. So I have 2 names for Bob:

  • Bob
  • Fatso

In the same way, I have TWO NAMES for the number 5000:

  • INTEGER
  • REAL NUMBER

Getting to RATIONAL NUMBERS

Now here is the deal with RATIONAL NUMBERS.

A RATIONAL number is any REAL number that can be found by dividing two INTEGERS together.

For example, try this on your calculator:

1
-
10

When you do 1 divided by 10, you should see 0.1 on your calculator’s face. Your calculator should also be smiling at you because you gave it a nice short computation.

Just like my friend Bob had 2 names, “Bob” and “Fatso”, we are going to give the number 0.1 TWO NAMES:

  1. REAL NUMBER (because 0.1 clearly has a decimal part)
  2. RATIONAL NUMBER

Why do we say 0.1 is a RATIONAL NUMBER?

0.1 is called a RATIONAL NUMBER because it can be found out by dividing two integers together!!!. That’s really all there is to it.

Exercise:

Using your calculator, try to find out whether each of these numbers are RATIONAL (try to find two integers to divide together that makes your calculator show the number on its face):

  • a) 0.5
  • b) 1.2
  • c) 7.8
  • d) 9.8471

ANSWERS:

  • a) 0.5 is found by 1 divided by 2. Therefore 0.5 is RATIONAL.
  • b) 1.2 is found by 6 divided by 5. Therefore 1.2 is RATIONAL.
  • c) 7.8 is found by 78 divided by 10. Therefore 7.8 is RATIONAL.
  • d) 9.847 is found by 9847 divided by 1000. Therefore 9.847 is RATIONAL.

Ok, now the hard to understand part.

Notice what I did with the last one, d). I just took 9847 and divided it by 1000. That looks really cheap. Its almost like cheating.

In fact, I can do that with any decimal number that you can write down on paper.

1.1155 is just 11155 divided by 10000. Therefore 1.1155 is a RATIONAL NUMBER, because it can be found by dividing 2 INTEGERS together.

84.287158 is just 84,287,158 divided by 1,000,000. Therefore 84.287158 is a RATIONAL NUMBER, because it can be found by dividing 2 INTEGERS together.

1.1 is just 11 divided by 10. Therefore, 1.1 is a RATIONAL NUMBER, because it can be found by dividing 2 INTEGERS together.

Ok, ok. We know what a RATIONAL number is. But I have a question. What about numbers that repeat forever, like this:

  • a) 0.6666666666 (6′s repeat after the decimal forever)
  • b) 0.3333333333 (3′s repeat after the decimal forever)
  • c) 0.099099099 (099 repeats forever)

Are these RATIONAL NUMBERS? (Remember, a RATIONAL NUMBER is any decimal number that can be found by dividing two INTEGERS together).

Here are the answers:

  • a) 0.6666666666 can be found by dividing 2 by 3: Therefore 0.66666666 is a RATIONAL NUMBER
  • b) 0.3333333333 can be found by dividing 1 by 3: Therefore 0.3333333333 is a RATIONAL NUMBER
  • c) 0.099099099 can be found by dividing 11 by 111: Therefore 0.099099099 is a RATIONAL NUMBER

So far, we have discovered TWO TYPES of RATIONAL NUMBERS:

  1. The type that has a decimal value, then terminates
    • such as 0.1, 0.5, and 0.89
  2. The type that has a decimal value that repeats a pattern forever
    • such as 0.6666666666 [found by 2/3], 0.33333333333 [found by 1/3], and 0.099099099099099 [found by 11/111]

So does that mean that ANY DECIMAL NUMBER can be found by dividing 2 INTEGERS together???

ALMOST, but not quite. There is ANOTHER type of number called an IRRATIONAL NUMBER. We’ll explain that next.

IRRATIONAL NUMBERS

OK, so we know what a RATIONAL NUMBER is now. A RATIONAL NUMBER is just any REAL NUMBER that can be found by dividing two INTEGERS together.

But, try this in your calculator:

  • SQUARE ROOT of 2
  • SQUARE ROOT of 5

When I punch those into my calculator, I get:

  • SQUARE ROOT of 2 is found to be 1.414213562 (then it stops showing decimals, but it WOULD keep going if it had the space. Yours might cut off earlier.)
  • SQUARE ROOT of 5 is found to be 2.236067978 (then it stops showing decimals)

Both the SQUARE ROOT of 2 and the SQUARE ROOT of 5 are called IRRATIONAL NUMBERS. IRRATIONAL NUMBERS are numbers that, no matter how hard you try, you CAN’T CALCULATE THEM BY DIVIDING TWO INTEGERS TOGETHER.

Now you MIGHT think, “well, I can find out the SQUARE ROOT of 2 dividing two integers! I can do:

1,414,213,562 / 1,000,000,000 = 1.414213562

Actually that is WRONG!! Using a better calculator to find SQUARE ROOT of 2, we would get 1.4142135623730950488016887242097. The SQUARE ROOT of 2 has decimal values that GO ON FOREVER, with NO REPEATING PATTERN, so therefore, the SQUARE ROOT of 2 is an IRRATIONAL NUMBER. The SQUARE ROOT of 2 can NEVER be FULLY found out by dividing ANY two INTEGERS together. You always have to go for that SQUARE ROOT button on your calculator to find the true value of the SQUARE ROOT of 2.

man. The net is just . . .

EXCELLENT list of Open source software and other really cool stuff

interesting article about Terman

sweet php math formula printer

just another reason to use Smarty

matrix cookbook

stanford scanning repo

page on the history of the stanford bunny

the stanford bunny was from range images

If you have 2 points, for example:

P( 2, 1 ); Q( 5, 7 )

You can find the linear equation of the line that passes through those points in the form:

Ax + By + C = 0

in one step by simply using the formula:

(y1 – y2)x + (x2 – x1)y + (x1y2 – x2y1) = 0

OR, we can write this as (easier to read!)
(py – qy)x + (qx – px)y + (pxqy – qxpy) = 0

Let’s try it:

Take Point1=( 2, 1 )
Take Point2=( 5, 7 )

Find the LINEAR EQUATION of the line that passes through the points (2,1) and (5,7). Your answer must be in the form of Ax + By + C = 0.

Using the equation:
(y1 – y2)x + (x2 – x1)y + (x1y2 – x2y1) = 0

We’ll just plug numbers in:
(1 – 7)x + (5 – 2)y + ( (2 x 7) – (5 x 1) ) = 0
-6x + 3y + (14 – 5) = 0
-6x + 3y + 9 = 0

Factoring a -3 out:
-3( 2x – y – 3 ) = 0

Dividing both sides by -3:
2x – y – 3 = 0

And that’s the answer.

That’s hella shorter than having to go through and do it using y = mx + b, and its a systematic way to do it in a computer in case m is infinity.

Formula from Peter Shirley’s CG book

Here’s a handbook of mathematical functions

James Avro’s amazon reviews

4 different notations for the derivative.

I’m pretty pissed off about that last one. We used each of those types in engineering, but nobody explained their origins or anything about them. All they said was “this means the derivative too.” wtf?? Why didn’t they say “this was Euclid’s way of writing the derivative”, or “this was Leibniz, and this is why he wrote the derivative this way.

I remember being confused about these different notations and I hated Leibniz notation.

However, now I PREFER Leibniz’s notation because of the idea of the infinitesimal.

Say y = ex and x = cos(W). Then, if we were to find:

dy
--
dW

This would be equal to

dy   dy    dx
-- = -- * --
dW   dx    dW

So you can see its equal visually because the dx’s cancel.

I remember being told that this was something ‘only of a coincidence’, and “they don’t really cancel”.

However, I think Leibniz meant that they did actually cancel, because he saw dx as an infinitesimally small amount.

The idea of the infinitesimal was rejected by mathematicians and apparently replaced by the (more “rigorous”) Epsilon Delta crap that we take in school today.

In the first Calculus course I took, nothing was explained. All they said was “If you have an epsilon, then you have a delta”. It made absolutely no sense. The only way we got marks in that course was by memorizing, not by really understanding.

Why didn’t they talk about the infinitesimal and explain WHY its not used, instead of just totally avoiding it? Its a good concept.

This posting is currently being edited and expanded.

  1. Use simpler words whenever possible. see last paragraph.
  2. Avoid repeating yourself.
  3. Don’t use too many “aside” comments.

    If you have to make something into an “aside” comment, then perhaps it doesn’t belong this piece of writing at all.

    If every paragraph of your writing seems to have an “aside” comment in it, then your writing will be seen as “all over the place,” or “difficult to follow,” even if your writing appears “coherent,” and “clear” to you when you yourself read it.

    If you use too many aside comments, then your writing might even appear “boring” to some readers, simply because you take a little too long to get to your point. In this case, the reader isn’t interested in the asides, even if you find them very interesting. The reader is impatient, especially in technical writing, and wants to see you make your point as quickly as possible.

  4. Avoid using synonyms, or sets of words that mean the same thing, in a single sentence.

    This next quotation is from Keisler’s free calculus text.

    A second way to visualize a function is by drawing its graph. The graph of a real function f of one variable is the set of all points P(x,y) in the plane such that y = f(x). To draw the graph, we plot the value of x on the horizontal, or x-axis and the value of f(x) on the vertical, or y-axis.

    Why doesn’t he just write:

    A second way to visualize a function is by drawing its graph. The graph of a function f is the set of all points in the plane that satisfy y = f(x).

    To draw the graph, we plot the value of x on the x-axis and the value of f(x) on the y-axis.

    * Notice how I removed the words “on the horizontal,”. Really the thing here is more words that say the same thing = slower reading.

    Its kind of like writing: “The dog wagged, or moved from side-to-side, his tail.”

    If I need to define “wagged” for my reader, then I should do so either in the sentence immediately preceeding the sentence that uses the word “wagged”, or in the sentence immediately following the sentence that uses the word “wagged”.

    For example:
    “To wag one’s tail means to move it from side-to-side. And the dog was wagging his tail.”

    Or:
    “The dog was wagging his tail. To wag one’s tail means to move it from side-to-side.”

    Now if we did that with Keisler’s sentence:

    “To draw the graph, we plot the value of x on the x-axis and the value of f(x) on the y-axis. The x-axis is the horizontal axis and the y-axis is the vertical axis.”

    It looks silly because the fact that “The x-axis is the horizontal axis” should be bleeding obvious. So, that’s why “the horizontal, or” needs to be removed from the original sentence. It adds no meaning or value and bogs the reader down.

  5. Avoid repeating yourself.
  6. Make new paragraphs as often as possible. Technical writing should be written like common newspaper articles are written. One simple thought to a paragraph.

    When in doubt, create a new paragraph.

  7. Use parenthetical commentary only when absolutely necessary to retain correctness, not to show off how smart you are or how you have special sensitivity to some nuance that others do not. “Others” do not care, really.

    Nothing throws a student off or interrupts the flow (or “languistic motion characteristic”) of writing like unnecessary parenthetical commentary.

    *I just made up the term “languistic motion characteristic” to prove the point here -

    Here’s a good example of when TO use it:

    “For example, if you choose the vp30 profile, you can write a Cg vertex program that loop a varying (non-constant) number of times.”

  8. Every technical writer should be forced to read Strunk and White before being allowed to wield the pen.
  9. Avoid using the word “which”. Use “that” instead.

    The phenomenon which is responsible for this is the same phenomenom which is responsible for lightening.
    The phenomenon that is responsible for this is the same phenomenom that is responsible for lightening.

I realize this list is repetitive but I’m really tired now and need to sleep.

I have a huge bone to pick with Kuipers.

“We shall distinguish between two perspectives on rotations in the plane, and shall determine the effect which each has on coordinates of points in the plane. The first is rotation of the coordinate frame with respect to fixed points (vectors) in the plane; the second is rotation of points (vectors) with respect to a fixed coordinate frame.”

His writing suffers from the typical things that make an engineer’s / mathematicians writing harder to understand.

Can’t “we” just be clear?

There are two different types of planar rotation that we shall now discuss.

  1. A rotation of the actual coordinate frame with respect to fixed points in the plane.
  2. A rotation of the points with respect to a fixed coordinate frame.

The way I have written it is at least twice as fast to read, by my estimation. My criticisms are as follows:

- We know points are vectors, no need to slow us down with the parenthesis
- Use paragraphs more wisely. There was a need for a paragraph break as I have demonstrated.
- Removed the entire sentence “We shall determine the effect that each type of rotation has on the coordinates of points in the plane.” because the reader doesn’t care what you’re going to do with them yet. He’ll find out soon enough. Unless he sleeps. Let them have some degree of suspense, Kuipers.

Reading Kuipers’ writing is like trudging through a park with leaden shoes. The things he has to show you are very nice, but its the stifling formality of his writing that holds one back from enjoying the experience.

Originally I was going to try to write about where the transcendental number e comes from, but other people already have written a very good article about the origins of e.

Here’s a simple question with a simple answer.

From grade 6 you know:

c = pi*d

But where the did they get this number pi?

pi = c / d

It comes from experiment.

A teacher once told me that the way we know anything at all about our world is by experiment. All science comes from experiment. We experiment, then we form theories to explain the results we got from experimentation.

So here’s an experiment to explain pi:

Take any DVD and use a tape measure to measure its circumference.
Then measure the diameter of that DVD (width across its widest part).

We get:

circumference = 38cm
diameter = 12cm

Then, use a calculator and divide.

pi = 38/12 = 3.166666 . . . close enough to 3.14159 –

And that’s the origin of PI. It comes from any circle, anywhere in the universe that is perfectly round.

Mathematicians are very precise.

They name things very precisely.

They spend years and years formulating theories, and in the end, they have this rigorous (and very nasty) thing to present to the world and other mathematicians.

They also have a habit of naming everything.

One thing that I’ve found confusing is the reason for use of the word ‘transcendental’ when talking about trigonometry, or more confusingly, the number e.

The number e is called a “transcendental number”. Why?

In common English, the word “transcendental” means:

Transcendental
Beyond the relm and reach of the senses (i.e., something you simply can’t fully “get” or “grasp”) (sound like the right way to describe the number ‘e’?)
Transcendental
Non-natural (in the ‘supernatural’ sense) – existing outside of or not in accordance with (the nature we know)

very cool

What’s a resume for?

Its for telling people what you know how to do.

We know what you know how to do based on what you’ve already done. If you’ve done it before, then you can certainly do it again. Less importantly is what you claim to have learned in school. Lastly, its what you claim to know with no supporting evidence whatsoever.

I was reading Quaternions and Rotation Sequences.

The second paragraph says:

Historians of mathematics are generally agreed that…three highly significant developments occurred during the nineteenth century. These were:

  1. the development of non-Euclidean geomery,
  2. [the development] of a non-commutative algebra,
  3. and [the development] of a precise theoretical foundation for calculus.

Wait a minute . . . WTF is “Euclidean Geometry”, exactly? At first blush, I didn’t recognize that Euclidean Geometry is really what you learned in high school. They never call it that though! They just call it ‘algebra’. I can’t believe I didn’t actually know (or remember . . . ? ) that Euclidean Geometry __IS__ what fills algebra texts in schools today.

What of the original text from which Euclidean Geometry comes from? Still exists. Not read today by most, though. From Wikipedia:

“Not until the 20th century, by which time its content was universally taught through school books, did it cease to be considered something all educated people had read.”

Whew.

some more notes

There are so many resources that have headlines that promise to solve the problem, but they actually don’t, because they’re eah.

eah quaternion resource 1

why programmers grow beards

that comes from this codinghorror post “size is the enemy” (about programmers who think they can build huge pieces of software with relative ease).

I found the coding horror entry off of RandomAccess’s del.icio.us

oh its hilarious

Russell Smith says:

rigid body sim defs

Also looking at: natural motion.

There’s tons of information out there on physics programming.

Some of the sites I’ve now bookmarked:

Chris Hecker of MSFT
Erin Catto of Blizzard

In particular, I really liked the talk on Advanced Prototyping, which was delivered by CHecker and another bloke called Chaim Gingold. Great stuff.

Some more random stuff:
bokmann’s blog – but a mere software engineer
gsl

Also in News, I have found the home of the great and powerful John Miles, creator of the Miles Sound System.

EDIT: don’t listen to me

“Even if our application is throttled to a specific frame rate through a timer, the actual time between frames will vary.”

Assume I have the player’s position, velocity and acceleration in 3 vectors:

pos
vel
accel

- Player controls the acceleration vector though the keyboard.

- Game calcs velocity of character in next frame based on acceleration vector.

vel = accel * (time_passed_since_last_frame);
pos = vel * (time_passed_since_last_frame);

Or, more accurately

pos += vel * time_passed_since_last_frame + accel * time_passed_since_last_frame * time_passed_since_last_frame * 0.5f;
vel += accel * time_passed_since_last_frame;

So those are just
d = v1t + 0.5*at2
v = a * t

This works OK for moving the player around on the map, as long as frame rate is CONSTANT.

But what if a frame takes longer than usual to calculate?

Then (time_passed_since_last_frame) is TOO LARGE.

Motion becomes jerky, blocky. Player can move really far in just one frame, if that frame took particularly long to crunch out. So, this means that a collision can be missed!

Also it is a major problem when it comes to things like JUMPING.

The way I had it before, was when the player jumps by pressing the space bar, the player gets a force applied to him in the upwards direction for exactly 5 frames.

accel = (x, 1, z);

Since the amount of time that it takes to crunch out each frame varies, the player would jump different heights, depending on when / where the player was when he pressed the spacebar.

This was a problem. Was this acceptable? Did it happen in other games? I studied Quake III in action to see if the player jump height deviated at all. Not even by a pixel. Plus when you think about games like Warcraft 3 (that can run a replay out EXACTLY the same way, every time) there’s no room for this kind of error.

The player should jump exactly the same height (in game units) no matter when or where he jumps. Clearly not acceptable.

The only solution I can think of to this problem now is to treat “time” like a sort of “fuel” for the jump action.

When the player presses space bar, don’t measure the amount of “time” to apply the jump for in frames, but measure it in “seconds”.

When first jump:

player_jump_fuel = 1.0;

On every compute of player position:

if( player_jump_fuel - time_passed_since_last_frame < 0 )
{
    // overshot jump fuel.  e.g. frame took 0.1 seconds to compute, but only 0.07 seconds of jump fuel remain.
    // compute jump velocity using player_jump_fuel and NOT time_passed_since_last_frame
}

For a while, I was thinking the only solution is to NOT use time-based motion and the high performance timer. Instead, one should just decide that a “frame” represents 0.0166666666666666667 seconds (1/60 seconds) and compute next positions based on that.

And that’s actually a good solution when you think about it.

Using only the ‘virtual second’ if you wanted to slow the whole game down, all you have to do is set a global to make that “frame” represent 0.0111111111111111 seconds

So my conclusion (for now) is that using “real-time” offers absolutely no benefits while at the same time introducing a possibility of error.

If you can have perfect precision at no cost, why should you throw that to the wind?

Ahaha.

Finally.

ie 8 passes Acid 2.

Wow! I remember seeing Hakon Wium talk about how badly ie fails in this youtube video (he starts speaking at about the 28 minute mark)

also today: iui lib – apple-iphone like interface – very cool

asserts in C++

And some nerdcore rap that entertains (however briefly), linked to in above article: mcplusplus

Follow

Get every new post delivered to your Inbox.

Join 37 other followers