Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | pmbaty | 1 | /* |
2 | * Portions of this file are copyright Rebirth contributors and licensed as |
||
3 | * described in COPYING.txt. |
||
4 | */ |
||
5 | |||
6 | #pragma once |
||
7 | |||
8 | #include "maths.h" |
||
9 | #include "dxxsconf.h" |
||
10 | #include "dsx-ns.h" |
||
11 | |||
12 | namespace dcx { |
||
13 | |||
14 | struct vms_vector; |
||
15 | class vm_distance_squared; |
||
16 | |||
17 | class vm_distance; |
||
18 | class vm_magnitude; |
||
19 | class vm_distance_squared; |
||
20 | class vm_magnitude_squared; |
||
21 | struct vms_angvec; |
||
22 | struct vms_matrix; |
||
23 | struct vms_quaternion; |
||
24 | |||
25 | extern const vms_matrix vmd_identity_matrix; |
||
26 | |||
27 | #define IDENTITY_MATRIX { {f1_0,0,0}, {0,f1_0,0}, {0,0,f1_0} } |
||
28 | |||
29 | vms_vector &vm_vec_add (vms_vector &dest, const vms_vector &src0, const vms_vector &src1); |
||
30 | |||
31 | vms_vector &_vm_vec_sub(vms_vector &dest, const vms_vector &src0, const vms_vector &src1); |
||
32 | void vm_vec_add2 (vms_vector &dest, const vms_vector &src); |
||
33 | void vm_vec_sub2 (vms_vector &dest, const vms_vector &src); |
||
34 | void vm_vec_avg (vms_vector &dest, const vms_vector &src0, const vms_vector &src1); |
||
35 | vms_vector &vm_vec_scale (vms_vector &dest, fix s); |
||
36 | void vm_vec_divide(vms_vector &dest, const vms_vector &src, fix d); |
||
37 | |||
38 | #define vm_vec_copy_scale(A,B,...) vm_vec_copy_scale(A, ## __VA_ARGS__, B) |
||
39 | vms_vector &vm_vec_copy_scale (vms_vector &dest, const vms_vector &src, fix s); |
||
40 | void vm_vec_scale_add (vms_vector &dest, const vms_vector &src1, const vms_vector &src2, fix k); |
||
41 | void vm_vec_scale_add2 (vms_vector &dest, const vms_vector &src, fix k); |
||
42 | void vm_vec_scale2 (vms_vector &dest, fix n, fix d); |
||
43 | |||
44 | __attribute_warn_unused_result |
||
45 | vm_magnitude_squared vm_vec_mag2(const vms_vector &v); |
||
46 | __attribute_warn_unused_result |
||
47 | vm_magnitude vm_vec_mag(const vms_vector &v); |
||
48 | |||
49 | __attribute_warn_unused_result |
||
50 | vm_distance vm_vec_dist(const vms_vector &v0, const vms_vector &v1); |
||
51 | __attribute_warn_unused_result |
||
52 | vm_distance_squared vm_vec_dist2(const vms_vector &v0, const vms_vector &v1); |
||
53 | |||
54 | __attribute_warn_unused_result |
||
55 | vm_magnitude vm_vec_mag_quick(const vms_vector &v); |
||
56 | |||
57 | __attribute_warn_unused_result |
||
58 | vm_distance vm_vec_dist_quick(const vms_vector &v0, const vms_vector &v1); |
||
59 | |||
60 | __attribute_warn_unused_result |
||
61 | vm_magnitude vm_vec_copy_normalize(vms_vector &dest, const vms_vector &src); |
||
62 | |||
63 | vm_magnitude vm_vec_normalize(vms_vector &v); |
||
64 | |||
65 | vm_magnitude vm_vec_copy_normalize_quick(vms_vector &dest, const vms_vector &src); |
||
66 | |||
67 | vm_magnitude vm_vec_normalize_quick(vms_vector &v); |
||
68 | vm_magnitude vm_vec_normalized_dir (vms_vector &dest, const vms_vector &end, const vms_vector &start); |
||
69 | vm_magnitude vm_vec_normalized_dir_quick (vms_vector &dest, const vms_vector &end, const vms_vector &start); |
||
70 | |||
71 | __attribute_warn_unused_result |
||
72 | fix vm_vec_dot (const vms_vector &v0, const vms_vector &v1); |
||
73 | |||
74 | void vm_vec_cross (vms_vector &dest, const vms_vector &src0, const vms_vector &src1); |
||
75 | |||
76 | void vm_vec_normal (vms_vector &dest, const vms_vector &p0, const vms_vector &p1, const vms_vector &p2); |
||
77 | |||
78 | void vm_vec_perp (vms_vector &dest, const vms_vector &p0, const vms_vector &p1, const vms_vector &p2); |
||
79 | fixang vm_vec_delta_ang (const vms_vector &v0, const vms_vector &v1, const vms_vector &fvec) __attribute_warn_unused_result; |
||
80 | fixang vm_vec_delta_ang_norm (const vms_vector &v0, const vms_vector &v1, const vms_vector &fvec) __attribute_warn_unused_result; |
||
81 | |||
82 | void vm_angles_2_matrix (vms_matrix &m, const vms_angvec &a); |
||
83 | |||
84 | #if DXX_USE_EDITOR |
||
85 | void vm_vec_ang_2_matrix (vms_matrix &m, const vms_vector &v, fixang a); |
||
86 | #endif |
||
87 | |||
88 | void vm_vector_2_matrix (vms_matrix &m, const vms_vector &fvec, const vms_vector *uvec, const vms_vector *rvec); |
||
89 | void vm_vec_rotate (vms_vector &dest, const vms_vector &src, const vms_matrix &m); |
||
90 | void _vm_matrix_x_matrix (vms_matrix &dest, const vms_matrix &src0, const vms_matrix &src1); |
||
91 | void vm_extract_angles_matrix (vms_angvec &a, const vms_matrix &m); |
||
92 | void vm_extract_angles_vector (vms_angvec &a, const vms_vector &v); |
||
93 | fix vm_dist_to_plane (const vms_vector &checkp, const vms_vector &norm, const vms_vector &planep) __attribute_warn_unused_result; |
||
94 | void vms_quaternion_from_matrix(vms_quaternion &q, const vms_matrix &m); |
||
95 | void vms_matrix_from_quaternion(vms_matrix &m, const vms_quaternion &q); |
||
96 | |||
97 | } |