Debian Codegraph @

pencil/include/geometry/geometry_point.h

raw
1 /* File: geometry_point.h; Copyright and License: see below */
2
3 #ifndef GEOMETRY_POINT_H
4 #define GEOMETRY_POINT_H
5
6 /* public file for the doxygen documentation: */
7 /*!
8 * \file
9 * \brief Stores the coordinates of a point
10 */
11
12 #include "geometry/geometry_direction.h"
13 #include <stdbool.h>
14
15 /*!
16 * \brief attributes of a point
17 */
18 struct geometry_point_struct {
19 double x;
20 double y;
21 };
22
23 typedef struct geometry_point_struct geometry_point_t;
24
25 /*!
26 * \brief initializes the geometry_point_t struct
27 *
28 * \param this_ pointer to own object attributes
29 * \param x x coordinate of the object
30 * \param y y coordinate of the object
31 */
32 static inline void geometry_point_init ( geometry_point_t *this_, double x, double y );
33
34 /*!
35 * \brief initializes the geometry_point_t struct
36 *
37 * \param x x coordinate of the object
38 * \param y y coordinate of the object
39 * \return the initialized point
40 */
41 static inline geometry_point_t geometry_point_new ( double x, double y );
42
43 /*!
44 * \brief re-initializes the geometry_point_t struct
45 *
46 * \param this_ pointer to own object attributes
47 * \param x x coordinate of the object
48 * \param y y coordinate of the object
49 */
50 static inline void geometry_point_reinit ( geometry_point_t *this_, double x, double y );
51
52 /*!
53 * \brief copies original to this uninitialized geometry_point_t struct
54 *
55 * \param this_ pointer to own object attributes
56 * \param original pointer to object attributes that shall be copied
57 */
58 static inline void geometry_point_copy ( geometry_point_t *this_, const geometry_point_t *original );
59
60 /*!
61 * \brief replaces the already initialized geometry_point_t struct by other data
62 *
63 * \param this_ pointer to own object attributes
64 * \param original pointer to object attributes that shall be copied
65 */
66 static inline void geometry_point_replace ( geometry_point_t *this_, const geometry_point_t *original );
67
68 /*!
69 * \brief destroys the geometry_point_t struct
70 *
71 * \param this_ pointer to own object attributes
72 */
73 static inline void geometry_point_destroy ( geometry_point_t *this_ );
74
75 /*!
76 * \brief gets the x coordinate of geometry_point_t
77 *
78 * \param this_ pointer to own object attributes
79 */
80 static inline double geometry_point_get_x ( const geometry_point_t *this_ );
81
82 /*!
83 * \brief gets the y coordinate of geometry_point_t
84 *
85 * \param this_ pointer to own object attributes
86 */
87 static inline double geometry_point_get_y ( const geometry_point_t *this_ );
88
89 /*!
90 * \brief gets the chess distance between two geometry_point_t structs
91 *
92 * \param this_ pointer to own object attributes
93 * \param that pointer to other object attributes
94 * \return chess distance between the two points
95 */
96 static inline double geometry_point_calc_chess_distance ( const geometry_point_t *this_, const geometry_point_t *that );
97
98 /*!
99 * \brief determines if the two geometry_point_t refer to the same location
100 *
101 * \param this_ pointer to own object attributes
102 * \param that pointer to other object attributes
103 * \return true if the two points are equal
104 */
105 static inline bool geometry_point_equals ( const geometry_point_t *this_, const geometry_point_t *that );
106
107 /*!
108 * \brief shifts the geometry_point_t
109 *
110 * \param this_ pointer to own object attributes
111 * \param delta_x value by which to increase the x.
112 * \param delta_y value by which to increase the y.
113 */
114 static inline void geometry_point_shift ( geometry_point_t *this_, double delta_x, double delta_y );
115
116 /*!
117 * \brief prints the geometry_point_t struct to the trace output
118 *
119 * \param this_ pointer to own object attributes
120 */
121 static inline void geometry_point_trace ( const geometry_point_t *this_ );
122
123 #include "geometry/geometry_point.inl"
124
125 #endif /* GEOMETRY_POINT_H */
126
127
128 /*
129 Copyright 2019-2026 Andreas Warnke
130
131 Licensed under the Apache License, Version 2.0 (the "License");
132 you may not use this file except in compliance with the License.
133 You may obtain a copy of the License at
134
135 http://www.apache.org/licenses/LICENSE-2.0
136
137 Unless required by applicable law or agreed to in writing, software
138 distributed under the License is distributed on an "AS IS" BASIS,
139 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
140 See the License for the specific language governing permissions and
141 limitations under the License.
142 */