Debian Codegraph @

pencil/include/geometry/geometry_dimensions.h

raw
1 /* File: geometry_dimensions.h; Copyright and License: see below */
2
3 #ifndef GEOMETRY_DIMENSIONS_H
4 #define GEOMETRY_DIMENSIONS_H
5
6 /* public file for the doxygen documentation: */
7 /*!
8 * \file
9 * \brief Stores width and height of an object
10 */
11
12 #include <stdbool.h>
13
14 /*!
15 * \brief attributes of dimensions
16 */
17 struct geometry_dimensions_struct {
18 double width;
19 double height;
20 };
21
22 typedef struct geometry_dimensions_struct geometry_dimensions_t;
23
24 /*!
25 * \brief initializes the geometry_dimensions_t struct
26 *
27 * \param this_ pointer to own object attributes
28 * \param width width of the object
29 * \param height height of the object
30 */
31 static inline void geometry_dimensions_init ( geometry_dimensions_t *this_, double width, double height );
32
33 /*!
34 * \brief re-initializes the geometry_dimensions_t struct
35 *
36 * \param this_ pointer to own object attributes
37 * \param width width of the object
38 * \param height height of the object
39 */
40 static inline void geometry_dimensions_reinit ( geometry_dimensions_t *this_, double width, double height );
41
42 /*!
43 * \brief copies original to this uninitialized geometry_dimensions_t struct
44 *
45 * \param this_ pointer to own object attributes
46 * \param original pointer to object attributes that shall be copied
47 */
48 static inline void geometry_dimensions_copy ( geometry_dimensions_t *this_, const geometry_dimensions_t *original );
49
50 /*!
51 * \brief replaces the already initialized geometry_dimensions_t struct by other data
52 *
53 * \param this_ pointer to own object attributes
54 * \param original pointer to object attributes that shall be copied
55 */
56 static inline void geometry_dimensions_replace ( geometry_dimensions_t *this_, const geometry_dimensions_t *original );
57
58 /*!
59 * \brief initializes the geometry_dimensions_t struct to an empty rect
60 *
61 * \param this_ pointer to own object attributes
62 */
63 static inline void geometry_dimensions_init_empty ( geometry_dimensions_t *this_ );
64
65 /*!
66 * \brief re-initializes the geometry_dimensions_t struct to an empty rect
67 *
68 * \param this_ pointer to own object attributes
69 */
70 static inline void geometry_dimensions_reinit_empty ( geometry_dimensions_t *this_ );
71
72 /*!
73 * \brief destroys the geometry_dimensions_t struct
74 *
75 * \param this_ pointer to own object attributes
76 */
77 static inline void geometry_dimensions_destroy ( geometry_dimensions_t *this_ );
78
79 /*!
80 * \brief gets the width of geometry_dimensions_t
81 *
82 * \param this_ pointer to own object attributes
83 */
84 static inline double geometry_dimensions_get_width ( const geometry_dimensions_t *this_ );
85
86 /*!
87 * \brief gets the height of geometry_dimensions_t
88 *
89 * \param this_ pointer to own object attributes
90 */
91 static inline double geometry_dimensions_get_height ( const geometry_dimensions_t *this_ );
92
93 /*!
94 * \brief gets the area-value of geometry_dimensions_t
95 *
96 * \param this_ pointer to own object attributes
97 */
98 static inline double geometry_dimensions_get_area ( const geometry_dimensions_t *this_ );
99
100 /*!
101 * \brief determines if the given dimensions have a valid (positive) size
102 *
103 * \param this_ pointer to own object attributes
104 * \return false if the dimensions have a positive size.
105 */
106 static inline bool geometry_dimensions_is_empty ( const geometry_dimensions_t *this_ );
107
108 /*!
109 * \brief determines if the given dimensions can contain the other
110 *
111 * \param this_ pointer to own object attributes
112 * \param that pointer to others object attributes
113 * \return false if the dimensions can not contain the other. (touching is still containing)
114 */
115 static inline bool geometry_dimensions_can_contain ( const geometry_dimensions_t *this_, const geometry_dimensions_t *that );
116
117 /*!
118 * \brief expands or shrinks the geometry_dimensions_t
119 *
120 * \param this_ pointer to own object attributes
121 * \param delta_width value by which to increase the width. In case of a negative value, the dimensions shrink (but not below 0).
122 * \param delta_height value by which to increase the height. In case of a negative value, the dimensions shrink (but not below 0).
123 */
124 static inline void geometry_dimensions_expand ( geometry_dimensions_t *this_, double delta_width, double delta_height );
125
126 /*!
127 * \brief prints the geometry_dimensions_t struct to the trace output
128 *
129 * \param this_ pointer to own object attributes
130 */
131 static inline void geometry_dimensions_trace ( const geometry_dimensions_t *this_ );
132
133 #include "geometry/geometry_dimensions.inl"
134
135 #endif /* GEOMETRY_DIMENSIONS_H */
136
137
138 /*
139 Copyright 2019-2026 Andreas Warnke
140
141 Licensed under the Apache License, Version 2.0 (the "License");
142 you may not use this file except in compliance with the License.
143 You may obtain a copy of the License at
144
145 http://www.apache.org/licenses/LICENSE-2.0
146
147 Unless required by applicable law or agreed to in writing, software
148 distributed under the License is distributed on an "AS IS" BASIS,
149 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
150 See the License for the specific language governing permissions and
151 limitations under the License.
152 */