| 105 | } |
| 106 | |
| 107 | Vec3 Vec3::normal(const std::vector<Vec3> &polygon) |
| 108 | { |
| 109 | Vec3 n(0.0f, 0.0f, 0.0f); |
| 110 | |
| 111 | for (size_t i = 0; i < polygon.size(); i++) |
| 112 | { |
| 113 | const Vec3& a = polygon[i]; |
| 114 | const Vec3& b = polygon[(i + 1) % polygon.size()]; |
| 115 | |
| 116 | n.x += (a.y - b.y) * (a.z + b.z); |
| 117 | n.y += (a.z - b.z) * (a.x + b.x); |
| 118 | n.z += (a.x - b.x) * (a.y + b.y); |
| 119 | } |
| 120 | |
| 121 | return n; |
| 122 | } |
| 123 | |
| 124 | Vec3 Vec3::to_screen(const Vec3 &v, float zoom, float logical_x, float logical_y) |
| 125 | { |
nothing calls this directly
no outgoing calls
no test coverage detected