test_ssol_rect2D_geometry.h (2061B)
1 /* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com) 2 * Copyright (C) 2016, 2018 CNRS 3 * 4 * This program is free software: you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation, either version 3 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program. If not, see <http://www.gnu.org/licenses/>. */ 16 17 #include "test_ssol_geometries.h" 18 19 /******************************************************************************* 20 * Rectangle polygon 21 ******************************************************************************/ 22 #if !defined(HALF_X) && !(defined(X_MIN) && defined(X_MAX)) 23 #error "Missing the HALF_X or X_MIN and X_MAX macros defining the rectangle size" 24 #endif 25 #if !defined(HALF_Y) && !(defined(Y_MIN) && defined(Y_MAX)) 26 #error "Missing the HALF_Y or Y_MIN and Y_MAX macros defining the rectangle size" 27 #endif 28 #if !defined(POLYGON_NAME) 29 #error "Missing the POLYGON_NAME macro defining the rectangle name" 30 #endif 31 32 #define EDGES__ CONCAT(POLYGON_NAME, _EDGES__) 33 #define POLY_NVERTS__ CONCAT(POLYGON_NAME, _NVERTS__) 34 35 #if !defined(X_MIN) 36 #define X_MIN (float)(-(HALF_X)) 37 #endif 38 39 #if !defined(X_MAX) 40 #define X_MAX (float)(HALF_X) 41 #endif 42 43 #if !defined(Y_MIN) 44 #define Y_MIN (float)(-(HALF_Y)) 45 #endif 46 47 #if !defined(Y_MAX) 48 #define Y_MAX (float)(HALF_Y) 49 #endif 50 51 /* should be const but scpr expects non-const data */ 52 static double EDGES__ [] = { 53 X_MIN, Y_MIN, 54 X_MIN, Y_MAX, 55 X_MAX, Y_MAX, 56 X_MAX, Y_MIN 57 }; 58 59 const unsigned POLY_NVERTS__ = sizeof(EDGES__) / (2*sizeof(double)); 60 61 #undef EDGES__ 62 #undef POLY_NVERTS__ 63 64 #undef HALF_X 65 #undef HALF_Y 66 #undef X_MIN 67 #undef X_MAX 68 #undef Y_MIN 69 #undef Y_MAX 70 #undef POLYGON_NAME