| 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 |
static inline void geometry_grid_init ( geometry_grid_t *this_, geometry_grid_kind_t kind ) |
| 9 |
{ |
| 10 |
(*this_).kind = kind; |
| 11 |
geometry_non_linear_scale_init( &((*this_).x_scale), 0.0, 640.0 ); |
| 12 |
geometry_non_linear_scale_init( &((*this_).y_scale), 0.0, 480.0 ); |
| 13 |
} |
| 14 |
|
| 15 |
static inline void geometry_grid_reinit ( geometry_grid_t *this_, geometry_grid_kind_t kind ) |
| 16 |
{ |
| 17 |
(*this_).kind = kind; |
| 18 |
geometry_non_linear_scale_init( &((*this_).x_scale), 0.0, 640.0 ); |
| 19 |
geometry_non_linear_scale_init( &((*this_).y_scale), 0.0, 480.0 ); |
| 20 |
} |
| 21 |
|
| 22 |
static inline void geometry_grid_destroy ( geometry_grid_t *this_ ) |
| 23 |
{ |
| 24 |
} |
| 25 |
|
| 26 |
static inline void geometry_grid_trace ( const geometry_grid_t *this_ ) |
| 27 |
{ |
| 28 |
switch ( (*this_).kind ) |
| 29 |
{ |
| 30 |
case GEOMETRY_GRID_KIND_0: |
| 31 |
default: |
| 32 |
{ |
| 33 |
U8_TRACE_INFO( "geometry_grid_t: GEOMETRY_GRID_KIND_0" ); |
| 34 |
} |
| 35 |
break; |
| 36 |
|
| 37 |
case GEOMETRY_GRID_KIND_X: |
| 38 |
{ |
| 39 |
U8_TRACE_INFO( "geometry_grid_t: GEOMETRY_GRID_KIND_X" ); |
| 40 |
geometry_non_linear_scale_trace( &((*this_).x_scale) ); |
| 41 |
} |
| 42 |
break; |
| 43 |
|
| 44 |
case GEOMETRY_GRID_KIND_Y: |
| 45 |
{ |
| 46 |
U8_TRACE_INFO( "geometry_grid_t: GEOMETRY_GRID_KIND_Y" ); |
| 47 |
geometry_non_linear_scale_trace( &((*this_).y_scale) ); |
| 48 |
} |
| 49 |
break; |
| 50 |
|
| 51 |
case GEOMETRY_GRID_KIND_XY: |
| 52 |
{ |
| 53 |
U8_TRACE_INFO( "geometry_grid_t: GEOMETRY_GRID_KIND_XY" ); |
| 54 |
geometry_non_linear_scale_trace( &((*this_).x_scale) ); |
| 55 |
geometry_non_linear_scale_trace( &((*this_).y_scale) ); |
| 56 |
} |
| 57 |
break; |
| 58 |
} |
| 59 |
} |
| 60 |
|
| 61 |
static inline geometry_grid_kind_t geometry_grid_get_kind ( const geometry_grid_t *this_ ) |
| 62 |
{ |
| 63 |
return (*this_).kind; |
| 64 |
} |
| 65 |
|
| 66 |
static inline geometry_non_linear_scale_t * geometry_grid_get_x_scale_ptr ( geometry_grid_t *this_ ) |
| 67 |
{ |
| 68 |
return &((*this_).x_scale); |
| 69 |
} |
| 70 |
|
| 71 |
static inline const geometry_non_linear_scale_t * geometry_grid_get_x_scale_const ( const geometry_grid_t *this_ ) |
| 72 |
{ |
| 73 |
return &((*this_).x_scale); |
| 74 |
} |
| 75 |
|
| 76 |
static inline geometry_non_linear_scale_t * geometry_grid_get_y_scale_ptr ( geometry_grid_t *this_ ) |
| 77 |
{ |
| 78 |
return &((*this_).y_scale); |
| 79 |
} |
| 80 |
|
| 81 |
static inline const geometry_non_linear_scale_t * geometry_grid_get_y_scale_const ( const geometry_grid_t *this_ ) |
| 82 |
{ |
| 83 |
return &((*this_).y_scale); |
| 84 |
} |
| 85 |
|
| 86 |
|
| 87 |
/* |
| 88 |
Copyright 2024-2026 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 |
*/ |