Line data Source code
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 42 : static inline geometry_3dir_t geometry_3dir_new ( geometry_direction_t first,
8 : geometry_direction_t second,
9 : geometry_direction_t third )
10 : {
11 42 : const geometry_3dir_t result = { .first = first, .second = second, .third = third };
12 42 : return result;
13 : }
14 :
15 1 : static inline bool geometry_3dir_equals ( const geometry_3dir_t *this_, const geometry_3dir_t *that )
16 : {
17 1 : const bool result
18 1 : = (( (*this_).first == (*that).first )&&( (*this_).second == (*that).second )&&( (*this_).third == (*that).third ));
19 1 : return result;
20 : }
21 :
22 1 : static inline geometry_direction_t geometry_3dir_get_first ( const geometry_3dir_t *this_ )
23 : {
24 1 : return (*this_).first;
25 : }
26 :
27 1 : static inline geometry_direction_t geometry_3dir_get_second ( const geometry_3dir_t *this_ )
28 : {
29 1 : return (*this_).second;
30 : }
31 :
32 1 : static inline geometry_direction_t geometry_3dir_get_third ( const geometry_3dir_t *this_ )
33 : {
34 1 : return (*this_).third;
35 : }
36 :
37 32 : static inline bool geometry_3dir_is_first_h ( const geometry_3dir_t *this_ )
38 : {
39 32 : return ( (*this_).first == GEOMETRY_DIRECTION_LEFT )||( (*this_).first == GEOMETRY_DIRECTION_RIGHT );
40 : }
41 :
42 50 : static inline bool geometry_3dir_is_first_v ( const geometry_3dir_t *this_ )
43 : {
44 50 : return ( (*this_).first == GEOMETRY_DIRECTION_UP )||( (*this_).first == GEOMETRY_DIRECTION_DOWN );
45 : }
46 :
47 32 : static inline bool geometry_3dir_is_second_h ( const geometry_3dir_t *this_ )
48 : {
49 32 : return ( (*this_).second == GEOMETRY_DIRECTION_LEFT )||( (*this_).second == GEOMETRY_DIRECTION_RIGHT );
50 : }
51 :
52 50 : static inline bool geometry_3dir_is_second_v ( const geometry_3dir_t *this_ )
53 : {
54 50 : return ( (*this_).second == GEOMETRY_DIRECTION_UP )||( (*this_).second == GEOMETRY_DIRECTION_DOWN );
55 : }
56 :
57 32 : static inline bool geometry_3dir_is_third_h ( const geometry_3dir_t *this_ )
58 : {
59 32 : return ( (*this_).third == GEOMETRY_DIRECTION_LEFT )||( (*this_).third == GEOMETRY_DIRECTION_RIGHT );
60 : }
61 :
62 50 : static inline bool geometry_3dir_is_third_v ( const geometry_3dir_t *this_ )
63 : {
64 50 : return ( (*this_).third == GEOMETRY_DIRECTION_UP )||( (*this_).third == GEOMETRY_DIRECTION_DOWN );
65 : }
66 :
67 :
68 : /*
69 : Copyright 2021-2025 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 : */
|