inline int plane_box_overlap(const glm::vec3& normal, const glm::vec3& vert, const glm::vec3& maxbox) { glm::vec3 vmin, vmax; test_axis(glm::X, normal, vert, maxbox, vmin, vmax); test_axis(glm::Y, normal, vert, maxbox, vmin, vmax); test_axis(glm::Z, normal, vert, maxbox, vmin, vmax); if (glm::dot(normal, vmin) > 0.0f) return 0; if (glm::dot(normal, vmax) >= 0.0f) return 1; return 0; }
_FORCE_INLINE_ bool test_previous_axis() { if (callback && callback->prev_axis && *callback->prev_axis != Vector3()) return test_axis(*callback->prev_axis); else return true; }
_FORCE_INLINE_ bool test_previous_axis() { if (callback && callback->sep_axis && *callback->sep_axis!=Vector2()) { return test_axis(*callback->sep_axis); } else { #ifdef DEBUG_ENABLED best_axis_count++; #endif } return true; }
_FORCE_INLINE_ bool test_cast() { if (castA) { Vector2 na = motion_A.normalized(); if (!test_axis(na)) return false; if (!test_axis(na.tangent())) return false; } if (castB) { Vector2 nb = motion_B.normalized(); if (!test_axis(nb)) return false; if (!test_axis(nb.tangent())) return false; } return true; }
int main(int argc, char **argv) { int i; char testfile[NC_MAX_NAME + 1]; printf("\n*** Testing coordinate systems.\n"); /*nc_set_log_level(3);*/ /* Go thru formats and run all tests for each of two (for netCDF-3 * only builds), or 3 (for netCDF-4 builds) different formats. */ for (i = NUM_FORMATS; i >= 1; i--) { switch (i) { case NC_FORMAT_CLASSIC: nc_set_default_format(NC_FORMAT_CLASSIC, NULL); fprintf(stderr, "\nSwitching to netCDF classic format.\n"); strcpy(testfile, "tst_coords_classic.nc"); break; case NC_FORMAT_64BIT: nc_set_default_format(NC_FORMAT_64BIT, NULL); fprintf(stderr, "\nSwitching to 64-bit offset format.\n"); strcpy(testfile, "tst_coords_64bit.nc"); break; #ifdef USE_NETCDF4 case NC_FORMAT_NETCDF4_CLASSIC: nc_set_default_format(NC_FORMAT_NETCDF4_CLASSIC, NULL); strcpy(testfile, "tst_coords_netcdf4_classic.nc"); fprintf(stderr, "\nSwitching to netCDF-4 format (with NC_CLASSIC_MODEL).\n"); break; case NC_FORMAT_NETCDF4: /* actually it's _CLASSIC. */ nc_set_default_format(NC_FORMAT_NETCDF4, NULL); strcpy(testfile, "tst_coords_netcdf4.nc"); fprintf(stderr, "\nSwitching to netCDF-4 format.\n"); break; #endif default: fprintf(stderr, "Unexpected format!\n"); return 2; } printf("*** creating coordinate axis..."); test_axis(testfile); SUMMARIZE_ERR; printf("*** creating coordinate system..."); test_system(testfile); SUMMARIZE_ERR; printf("*** assigning a coordinate system..."); test_system_assign(testfile); SUMMARIZE_ERR; printf("*** creating coordinate transform..."); test_transform(testfile); SUMMARIZE_ERR; printf("*** assigning a coordinate transform..."); test_transform_assign(testfile); SUMMARIZE_ERR; } FINAL_RESULTS; }