1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
mod ivec;
mod matrix;
mod vec;

pub use self::{ivec::*, matrix::*, vec::*};
use crate::{bindings::*, std_types::c_double};

/// Sets the x, y, and z components of a 3D vector
#[macro_export]
macro_rules! Vec3_Set {
    ($v:expr, $x:expr, $y:expr, $z:expr) => {
        $v.x = $x;
        $v.y = $y;
        $v.z = $z;
    };
}

/// Whether all components of a 3D vector are 0
#[macro_export]
macro_rules! Vec3_IsZero {
    ($v:expr) => {
        #[allow(clippy::float_cmp)]
        {
            $v.x == 0 as _ && $v.y == 0 as _ && $v.z == 0 as _
        }
    };
}

#[macro_export]
macro_rules! Vec3_AddBy {
    ($dst:expr, $value:expr) => {
        $crate::Vec3_Add($dst, $dst, $value)
    };
}

#[macro_export]
macro_rules! Vec3_SubBy {
    ($dst:expr, $value:expr) => {
        $crate::Vec3_Sub($dst, $dst, $value)
    };
}

#[macro_export]
macro_rules! Vec3_Mul1By {
    ($dst:expr, $value:expr) => {
        $crate::Vec3_Mul1($dst, $dst, $value)
    };
}

#[macro_export]
macro_rules! Vec3_Mul3By {
    ($dst:expr, $value:expr) => {
        $crate::Vec3_Mul3($dst, $dst, $value)
    };
}

pub fn Tan_Simple(x: c_double) -> c_double {
    unsafe { Math_Sin(x) / Math_Cos(x) }
}