Wed, 08 May 2013 01:40:07 +0300
Added icon for intersector
64
ada4679d5bce
Considerably improved sub-file inlining. Use a matrix class instead of double[9], educated myself on what matrix multiplication actually is and fixed the algorithm up. Aside from I/O problems, 32551.dat is correctly rendered now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1 | #include <assert.h> |
ada4679d5bce
Considerably improved sub-file inlining. Use a matrix class instead of double[9], educated myself on what matrix multiplication actually is and fixed the algorithm up. Aside from I/O problems, 32551.dat is correctly rendered now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
2 | #include "common.h" |
ada4679d5bce
Considerably improved sub-file inlining. Use a matrix class instead of double[9], educated myself on what matrix multiplication actually is and fixed the algorithm up. Aside from I/O problems, 32551.dat is correctly rendered now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
3 | #include "types.h" |
ada4679d5bce
Considerably improved sub-file inlining. Use a matrix class instead of double[9], educated myself on what matrix multiplication actually is and fixed the algorithm up. Aside from I/O problems, 32551.dat is correctly rendered now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
4 | #include "misc.h" |
ada4679d5bce
Considerably improved sub-file inlining. Use a matrix class instead of double[9], educated myself on what matrix multiplication actually is and fixed the algorithm up. Aside from I/O problems, 32551.dat is correctly rendered now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
5 | |
ada4679d5bce
Considerably improved sub-file inlining. Use a matrix class instead of double[9], educated myself on what matrix multiplication actually is and fixed the algorithm up. Aside from I/O problems, 32551.dat is correctly rendered now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
6 | // ============================================================================= |
ada4679d5bce
Considerably improved sub-file inlining. Use a matrix class instead of double[9], educated myself on what matrix multiplication actually is and fixed the algorithm up. Aside from I/O problems, 32551.dat is correctly rendered now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
7 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
ada4679d5bce
Considerably improved sub-file inlining. Use a matrix class instead of double[9], educated myself on what matrix multiplication actually is and fixed the algorithm up. Aside from I/O problems, 32551.dat is correctly rendered now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
8 | // ============================================================================= |
ada4679d5bce
Considerably improved sub-file inlining. Use a matrix class instead of double[9], educated myself on what matrix multiplication actually is and fixed the algorithm up. Aside from I/O problems, 32551.dat is correctly rendered now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
9 | vertex vertex::midpoint (vertex& other) { |
ada4679d5bce
Considerably improved sub-file inlining. Use a matrix class instead of double[9], educated myself on what matrix multiplication actually is and fixed the algorithm up. Aside from I/O problems, 32551.dat is correctly rendered now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
10 | vertex mid; |
147
291a1fe2d278
Further work on constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
140
diff
changeset
|
11 | |
291a1fe2d278
Further work on constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
140
diff
changeset
|
12 | for (const Axis ax : g_Axes) |
291a1fe2d278
Further work on constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
140
diff
changeset
|
13 | mid[ax] = (m_coords[ax] + other[ax]) / 2; |
291a1fe2d278
Further work on constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
140
diff
changeset
|
14 | |
64
ada4679d5bce
Considerably improved sub-file inlining. Use a matrix class instead of double[9], educated myself on what matrix multiplication actually is and fixed the algorithm up. Aside from I/O problems, 32551.dat is correctly rendered now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
15 | return mid; |
ada4679d5bce
Considerably improved sub-file inlining. Use a matrix class instead of double[9], educated myself on what matrix multiplication actually is and fixed the algorithm up. Aside from I/O problems, 32551.dat is correctly rendered now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
16 | } |
ada4679d5bce
Considerably improved sub-file inlining. Use a matrix class instead of double[9], educated myself on what matrix multiplication actually is and fixed the algorithm up. Aside from I/O problems, 32551.dat is correctly rendered now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
17 | |
ada4679d5bce
Considerably improved sub-file inlining. Use a matrix class instead of double[9], educated myself on what matrix multiplication actually is and fixed the algorithm up. Aside from I/O problems, 32551.dat is correctly rendered now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
18 | // ============================================================================= |
ada4679d5bce
Considerably improved sub-file inlining. Use a matrix class instead of double[9], educated myself on what matrix multiplication actually is and fixed the algorithm up. Aside from I/O problems, 32551.dat is correctly rendered now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
19 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
ada4679d5bce
Considerably improved sub-file inlining. Use a matrix class instead of double[9], educated myself on what matrix multiplication actually is and fixed the algorithm up. Aside from I/O problems, 32551.dat is correctly rendered now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
20 | // ============================================================================= |
140
2e8c1626aef7
Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
135
diff
changeset
|
21 | str vertex::stringRep (const bool mangled) { |
161 | 22 | return fmt (mangled ? "(%s, %s, %s)" : "%s %s %s", |
147
291a1fe2d278
Further work on constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
140
diff
changeset
|
23 | ftoa (coord (X)).chars(), |
291a1fe2d278
Further work on constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
140
diff
changeset
|
24 | ftoa (coord (Y)).chars(), |
291a1fe2d278
Further work on constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents:
140
diff
changeset
|
25 | ftoa (coord (Z)).chars()); |
64
ada4679d5bce
Considerably improved sub-file inlining. Use a matrix class instead of double[9], educated myself on what matrix multiplication actually is and fixed the algorithm up. Aside from I/O problems, 32551.dat is correctly rendered now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
26 | } |
ada4679d5bce
Considerably improved sub-file inlining. Use a matrix class instead of double[9], educated myself on what matrix multiplication actually is and fixed the algorithm up. Aside from I/O problems, 32551.dat is correctly rendered now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
27 | |
ada4679d5bce
Considerably improved sub-file inlining. Use a matrix class instead of double[9], educated myself on what matrix multiplication actually is and fixed the algorithm up. Aside from I/O problems, 32551.dat is correctly rendered now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
28 | // ============================================================================= |
ada4679d5bce
Considerably improved sub-file inlining. Use a matrix class instead of double[9], educated myself on what matrix multiplication actually is and fixed the algorithm up. Aside from I/O problems, 32551.dat is correctly rendered now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
29 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
ada4679d5bce
Considerably improved sub-file inlining. Use a matrix class instead of double[9], educated myself on what matrix multiplication actually is and fixed the algorithm up. Aside from I/O problems, 32551.dat is correctly rendered now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
30 | // ============================================================================= |
162
b7d65e89861a
matrix is now templated with N=int (usually 3)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
31 | void vertex::transform (matrix<3> matr, vertex pos) { |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
162
diff
changeset
|
32 | double x2 = (matr[0] * x ()) + (matr[1] * y ()) + (matr[2] * z ()) + pos[X]; |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
162
diff
changeset
|
33 | double y2 = (matr[3] * x ()) + (matr[4] * y ()) + (matr[5] * z ()) + pos[Y]; |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
162
diff
changeset
|
34 | double z2 = (matr[6] * x ()) + (matr[7] * y ()) + (matr[8] * z ()) + pos[Z]; |
64
ada4679d5bce
Considerably improved sub-file inlining. Use a matrix class instead of double[9], educated myself on what matrix multiplication actually is and fixed the algorithm up. Aside from I/O problems, 32551.dat is correctly rendered now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
35 | |
163
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
162
diff
changeset
|
36 | x () = x2; |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
162
diff
changeset
|
37 | y () = y2; |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
162
diff
changeset
|
38 | z () = z2; |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
162
diff
changeset
|
39 | } |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
162
diff
changeset
|
40 | |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
162
diff
changeset
|
41 | // ============================================================================= |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
162
diff
changeset
|
42 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
162
diff
changeset
|
43 | // ============================================================================= |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
162
diff
changeset
|
44 | void vertex::transform (matrix<4> matr) { |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
162
diff
changeset
|
45 | double x2 = (matr[0] * x ()) + (matr[4] + y ()) + (matr[8] + z ()) + matr[12]; |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
162
diff
changeset
|
46 | double y2 = (matr[1] * x ()) + (matr[5] + y ()) + (matr[9] + z ()) + matr[13]; |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
162
diff
changeset
|
47 | double z2 = (matr[2] * x ()) + (matr[6] + y ()) + (matr[10] + z ()) + matr[14]; |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
162
diff
changeset
|
48 | double w2 = (matr[3] * x ()) + (matr[7] + y ()) + (matr[11] + z ()) + matr[15]; |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
162
diff
changeset
|
49 | |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
162
diff
changeset
|
50 | x () = x2 / w2; |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
162
diff
changeset
|
51 | y () = y2 / w2; |
46955613626d
Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
162
diff
changeset
|
52 | z () = z2 / w2; |
64
ada4679d5bce
Considerably improved sub-file inlining. Use a matrix class instead of double[9], educated myself on what matrix multiplication actually is and fixed the algorithm up. Aside from I/O problems, 32551.dat is correctly rendered now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
53 | } |