nml::vec3 operator-(nml::vec3 lhs, const nml::vec3& rhs)
Return a vec3 that is the difference between two vec3.
The difference between two vec3 is calculated this way:
\(\begin{bmatrix} lhs.x \\ lhs.y \\ lhs.z \end{bmatrix} - \begin{bmatrix} rhs.x \\ rhs.y \\ rhs.z \end{bmatrix} = \begin{bmatrix} lhs.x - rhs.x \\ lhs.y - rhs.y \\ lhs.z - rhs.z \end{bmatrix}\)
Example
#include "include/vec3.h"
#include <iostream>
int main() {
nml::vec3 a(2.0f, 5.0f, 7.0f);
nml::vec3 b(1.0f, 2.0f, 6.5f);
nml::vec3 c = a - b;
std::cout << nml::to_string(c) << std::endl;
return 0;
}
Result:
[1.000000, 3.000000, 0.500000]