================= CM_NeedsSubdivision Returns true if the given quadratic curve is not flat enough for our collision detection purposes ================= */
| 182 | ================= |
| 183 | */ |
| 184 | static qboolean CM_NeedsSubdivision( vec3_t a, vec3_t b, vec3_t c ) { |
| 185 | vec3_t cmid; |
| 186 | vec3_t lmid; |
| 187 | vec3_t delta; |
| 188 | float dist; |
| 189 | int i; |
| 190 | |
| 191 | // calculate the linear midpoint |
| 192 | for ( i = 0 ; i < 3 ; i++ ) { |
| 193 | lmid[i] = 0.5*(a[i] + c[i]); |
| 194 | } |
| 195 | |
| 196 | // calculate the exact curve midpoint |
| 197 | for ( i = 0 ; i < 3 ; i++ ) { |
| 198 | cmid[i] = 0.5 * ( 0.5*(a[i] + b[i]) + 0.5*(b[i] + c[i]) ); |
| 199 | } |
| 200 | |
| 201 | // see if the curve is far enough away from the linear mid |
| 202 | VectorSubtract( cmid, lmid, delta ); |
| 203 | dist = VectorLengthSquared( delta ); |
| 204 | |
| 205 | return (qboolean)(dist >= (SUBDIVIDE_DISTANCE * SUBDIVIDE_DISTANCE)); |
| 206 | } |
| 207 | |
| 208 | /* |
| 209 | =============== |
no test coverage detected