PDA

View Full Version : 3D Calculations



DarknessX
12-09-2007, 02:52 PM
I'm doing a project for Math, for my Math 11-2 course (G. 11, level 2) and I have decided to do it on 3D Calculations and such. So basically, what I wanted to know, was what types of math's are involved in things like calculating a characters current position, acceleration, direction of motion, things like that. If possible, some (fairly simple) pseudo code would be a great help.

Basically my project is on anything to do with 3D math. Please try to write anything you give me in a way people who know little 3D related math can understand it... (I have to present this in an understandable format :))

Thanks everyone!

Brainer
12-09-2007, 03:34 PM
Look at this:
http://www.glsoftworks.pastebin.com/f71bee92

Don't get scared - 10698 lines of code. :)

NecroDOME
12-09-2007, 08:11 PM
@Brainer, thats usefull stuff :) !!

@DarknessX, for 3D math its mostly matrix and vector calculations. So thats what I would look for.

Brainer
12-09-2007, 09:22 PM
If you have D2006, you can implement vectors like this:


type
TVector3f = class(TObject)
X, Y, Z: Single;

class operator Implicit(Value: Single) : TVector3f; // :=
class operator Add(V1: TVector3f; V2: TVector3f): TVector3f; // +
{ ... and so on ... }
end;


I'm not sure, but it should works with records, too. :)

DarknessX
13-09-2007, 01:03 AM
Thanks alot, thats given me a good starting point for my research...

@Brainer:
That huge code file is crazy! I've only gotten a game I was making (text-based) to 3500 lines...

@NecroDome:
Thanks, I'll look into those subjects :)

{MSX}
13-09-2007, 09:11 AM
Quaternions are also important in 3d, as they're a good representation of a spatial rotation:

http://en.wikipedia.org/wiki/Quaternion
http://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation