Line data Source code
1 : /* File: geometry_grid.inl; Copyright and License: see below */ 2 : 3 : #include "u8/u8_trace.h" 4 : #include "u8/u8_log.h" 5 : #include <assert.h> 6 : #include <stdbool.h> 7 : 8 1 : static inline void geometry_grid_init ( geometry_grid_t *this_, geometry_grid_kind_t kind ) 9 : { 10 1 : (*this_).kind = kind; 11 1 : geometry_non_linear_scale_init( &((*this_).x_scale), 0.0, 640.0 ); 12 1 : geometry_non_linear_scale_init( &((*this_).y_scale), 0.0, 480.0 ); 13 1 : } 14 : 15 5 : static inline void geometry_grid_reinit ( geometry_grid_t *this_, geometry_grid_kind_t kind ) 16 : { 17 5 : (*this_).kind = kind; 18 5 : geometry_non_linear_scale_init( &((*this_).x_scale), 0.0, 640.0 ); 19 5 : geometry_non_linear_scale_init( &((*this_).y_scale), 0.0, 480.0 ); 20 5 : } 21 : 22 1 : static inline void geometry_grid_destroy ( geometry_grid_t *this_ ) 23 : { 24 1 : } 25 : 26 4 : static inline void geometry_grid_trace ( const geometry_grid_t *this_ ) 27 : { 28 4 : switch ( (*this_).kind ) 29 : { 30 1 : case GEOMETRY_GRID_KIND_0: 31 : default: 32 : { 33 1 : U8_TRACE_INFO( "geometry_grid_t: GEOMETRY_GRID_KIND_0" ); 34 : } 35 1 : break; 36 : 37 1 : case GEOMETRY_GRID_KIND_X: 38 : { 39 1 : U8_TRACE_INFO( "geometry_grid_t: GEOMETRY_GRID_KIND_X" ); 40 1 : geometry_non_linear_scale_trace( &((*this_).x_scale) ); 41 : } 42 1 : break; 43 : 44 1 : case GEOMETRY_GRID_KIND_Y: 45 : { 46 1 : U8_TRACE_INFO( "geometry_grid_t: GEOMETRY_GRID_KIND_Y" ); 47 1 : geometry_non_linear_scale_trace( &((*this_).y_scale) ); 48 : } 49 1 : break; 50 : 51 1 : case GEOMETRY_GRID_KIND_XY: 52 : { 53 1 : U8_TRACE_INFO( "geometry_grid_t: GEOMETRY_GRID_KIND_XY" ); 54 1 : geometry_non_linear_scale_trace( &((*this_).x_scale) ); 55 1 : geometry_non_linear_scale_trace( &((*this_).y_scale) ); 56 : } 57 1 : break; 58 : } 59 4 : } 60 : 61 1 : static inline geometry_grid_kind_t geometry_grid_get_kind ( const geometry_grid_t *this_ ) 62 : { 63 1 : return (*this_).kind; 64 : } 65 : 66 1 : static inline geometry_non_linear_scale_t * geometry_grid_get_x_scale_ptr ( geometry_grid_t *this_ ) 67 : { 68 1 : return &((*this_).x_scale); 69 : } 70 : 71 1 : static inline const geometry_non_linear_scale_t * geometry_grid_get_x_scale_const ( const geometry_grid_t *this_ ) 72 : { 73 1 : return &((*this_).x_scale); 74 : } 75 : 76 1 : static inline geometry_non_linear_scale_t * geometry_grid_get_y_scale_ptr ( geometry_grid_t *this_ ) 77 : { 78 1 : return &((*this_).y_scale); 79 : } 80 : 81 1 : static inline const geometry_non_linear_scale_t * geometry_grid_get_y_scale_const ( const geometry_grid_t *this_ ) 82 : { 83 1 : return &((*this_).y_scale); 84 : } 85 : 86 : 87 : /* 88 : Copyright 2024-2025 Andreas Warnke 89 : 90 : Licensed under the Apache License, Version 2.0 (the "License"); 91 : you may not use this file except in compliance with the License. 92 : You may obtain a copy of the License at 93 : 94 : http://www.apache.org/licenses/LICENSE-2.0 95 : 96 : Unless required by applicable law or agreed to in writing, software 97 : distributed under the License is distributed on an "AS IS" BASIS, 98 : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 99 : See the License for the specific language governing permissions and 100 : limitations under the License. 101 : */