| 1 |
/* File: geometry_3dir.inl; Copyright and License: see below */ |
| 2 |
|
| 3 |
#include "u8/u8_trace.h" |
| 4 |
#include "u8/u8_log.h" |
| 5 |
#include <assert.h> |
| 6 |
|
| 7 |
static inline geometry_3dir_t geometry_3dir_new ( geometry_direction_t first, |
| 8 |
geometry_direction_t second, |
| 9 |
geometry_direction_t third ) |
| 10 |
{ |
| 11 |
const geometry_3dir_t result = { .first = first, .second = second, .third = third }; |
| 12 |
return result; |
| 13 |
} |
| 14 |
|
| 15 |
static inline bool geometry_3dir_equals ( const geometry_3dir_t *this_, const geometry_3dir_t *that ) |
| 16 |
{ |
| 17 |
const bool result |
| 18 |
= (( (*this_).first == (*that).first )&&( (*this_).second == (*that).second )&&( (*this_).third == (*that).third )); |
| 19 |
return result; |
| 20 |
} |
| 21 |
|
| 22 |
static inline geometry_direction_t geometry_3dir_get_first ( const geometry_3dir_t *this_ ) |
| 23 |
{ |
| 24 |
return (*this_).first; |
| 25 |
} |
| 26 |
|
| 27 |
static inline geometry_direction_t geometry_3dir_get_second ( const geometry_3dir_t *this_ ) |
| 28 |
{ |
| 29 |
return (*this_).second; |
| 30 |
} |
| 31 |
|
| 32 |
static inline geometry_direction_t geometry_3dir_get_third ( const geometry_3dir_t *this_ ) |
| 33 |
{ |
| 34 |
return (*this_).third; |
| 35 |
} |
| 36 |
|
| 37 |
static inline bool geometry_3dir_is_first_h ( const geometry_3dir_t *this_ ) |
| 38 |
{ |
| 39 |
return ( (*this_).first == GEOMETRY_DIRECTION_LEFT )||( (*this_).first == GEOMETRY_DIRECTION_RIGHT ); |
| 40 |
} |
| 41 |
|
| 42 |
static inline bool geometry_3dir_is_first_v ( const geometry_3dir_t *this_ ) |
| 43 |
{ |
| 44 |
return ( (*this_).first == GEOMETRY_DIRECTION_UP )||( (*this_).first == GEOMETRY_DIRECTION_DOWN ); |
| 45 |
} |
| 46 |
|
| 47 |
static inline bool geometry_3dir_is_second_h ( const geometry_3dir_t *this_ ) |
| 48 |
{ |
| 49 |
return ( (*this_).second == GEOMETRY_DIRECTION_LEFT )||( (*this_).second == GEOMETRY_DIRECTION_RIGHT ); |
| 50 |
} |
| 51 |
|
| 52 |
static inline bool geometry_3dir_is_second_v ( const geometry_3dir_t *this_ ) |
| 53 |
{ |
| 54 |
return ( (*this_).second == GEOMETRY_DIRECTION_UP )||( (*this_).second == GEOMETRY_DIRECTION_DOWN ); |
| 55 |
} |
| 56 |
|
| 57 |
static inline bool geometry_3dir_is_third_h ( const geometry_3dir_t *this_ ) |
| 58 |
{ |
| 59 |
return ( (*this_).third == GEOMETRY_DIRECTION_LEFT )||( (*this_).third == GEOMETRY_DIRECTION_RIGHT ); |
| 60 |
} |
| 61 |
|
| 62 |
static inline bool geometry_3dir_is_third_v ( const geometry_3dir_t *this_ ) |
| 63 |
{ |
| 64 |
return ( (*this_).third == GEOMETRY_DIRECTION_UP )||( (*this_).third == GEOMETRY_DIRECTION_DOWN ); |
| 65 |
} |
| 66 |
|
| 67 |
|
| 68 |
/* |
| 69 |
Copyright 2021-2026 Andreas Warnke |
| 70 |
|
| 71 |
Licensed under the Apache License, Version 2.0 (the "License"); |
| 72 |
you may not use this file except in compliance with the License. |
| 73 |
You may obtain a copy of the License at |
| 74 |
|
| 75 |
http://www.apache.org/licenses/LICENSE-2.0 |
| 76 |
|
| 77 |
Unless required by applicable law or agreed to in writing, software |
| 78 |
distributed under the License is distributed on an "AS IS" BASIS, |
| 79 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 80 |
See the License for the specific language governing permissions and |
| 81 |
limitations under the License. |
| 82 |
*/ |