3838//| group.append(polygon)
3939//|
4040//| """
41+ //|
4142
4243
4344//| def circle_rectangle_intersects(
4445//| cx: int, cy: int, cr: int, rx: int, ry: int, rw: int, rh: int
46+ //| ) -> bool:
47+ //| """Checks for intersection between a cricle and a rectangle.
48+ //|
4549//| :param int cx: Circle center x coordinate
4650//| :param int cy: Circle center y coordinate
4751//| :param int cr: Circle radius
4852//| :param int rx: Rectangle x coordinate
4953//| :param int ry: Rectangle y coordinate
5054//| :param int rw: Rectangle width
51- //| :param int rh: Rectangle height
52- //| ) -> None:
55+ //| :param int rh: Rectangle height"""
56+ //| ...
57+ //|
5358static mp_obj_t vectorio_circle_rectangle_intersects (size_t n_args , const mp_obj_t * pos_args , mp_map_t * kw_args ) {
5459 enum {ARG_cx , ARG_cy , ARG_cr , ARG_rx , ARG_ry , ARG_rw , ARG_rh };
5560
@@ -75,28 +80,30 @@ static mp_obj_t vectorio_circle_rectangle_intersects(size_t n_args, const mp_obj
7580 int16_t rh = args [ARG_rh ].u_int ;
7681
7782 bool result = common_hal_vectorio_circle_rectangle_intersects (cx , cy , cr , rx , ry , rw , rh );
78- if (result ){
83+ if (result ) {
7984 return mp_const_true ;
80- }else {
85+ } else {
8186 return mp_const_false ;
8287 }
8388}
8489MP_DEFINE_CONST_FUN_OBJ_KW (vectorio_circle_rectangle_intersects_obj , 0 , vectorio_circle_rectangle_intersects );
8590
8691
8792//| def rectangle_rectangle_intersects(
88- //| r1x: int, r1y: int, r1w: int, r1h: int,
89- // r2x: int, r2y: int, r2w: int, r2h: int
93+ //| r1x: int, r1y: int, r1w: int, r1h: int, r2x: int, r2y: int, r2w: int, r2h: int
94+ //| ) -> bool:
95+ //| """Checks for intersection between a two rectangles.
96+ //|
97+ //| :param int r1x: First Rectangle x coordinate
98+ //| :param int r1y: First Rectangle y coordinate
99+ //| :param int r1w: First Rectangle width
100+ //| :param int r1h: First Rectangle height
101+ //| :param int r2x: Second Rectangle x coordinate
102+ //| :param int r2y: Second Rectangle y coordinate
103+ //| :param int r2w: Second Rectangle width
104+ //| :param int r2h: Second Rectangle height"""
105+ //| ...
90106//|
91- //| :param int r1x: Rectangle x coordinate
92- //| :param int r1y: Rectangle y coordinate
93- //| :param int r1w: Rectangle width
94- //| :param int r1h: Rectangle height
95- //| :param int r2x: Other Rectangle x coordinate
96- //| :param int r2y: Other Rectangle y coordinate
97- //| :param int r2w: Other Rectangle width
98- //| :param int r2h: Other Rectangle height
99- //| ) -> None:
100107static mp_obj_t vectorio_rectangle_rectangle_intersects (size_t n_args , const mp_obj_t * pos_args , mp_map_t * kw_args ) {
101108 enum {ARG_r1x , ARG_r1y , ARG_r1w , ARG_r1h , ARG_r2x , ARG_r2y , ARG_r2w , ARG_r2h };
102109
@@ -126,24 +133,27 @@ static mp_obj_t vectorio_rectangle_rectangle_intersects(size_t n_args, const mp_
126133
127134
128135 bool result = common_hal_vectorio_rectangle_rectangle_intersects (r1x , r1y , r1w , r1h , r2x , r2y , r2w , r2h );
129- if (result ){
136+ if (result ) {
130137 return mp_const_true ;
131- }else {
138+ } else {
132139 return mp_const_false ;
133140 }
134141}
135142MP_DEFINE_CONST_FUN_OBJ_KW (vectorio_rectangle_rectangle_intersects_obj , 0 , vectorio_rectangle_rectangle_intersects );
136143
137-
138144//| def circle_circle_intersects(
139- //| cx: int, cy: int, cr: int, rx: int, ry: int, rw: int, rh: int
140- //| :param int c1x: Circle center x coordinate
141- //| :param int c1y: Circle center y coordinate
142- //| :param int c1r: Circle radius
143- //| :param int c2x: Other Circle center x coordinate
144- //| :param int c2y: Other Circle center y coordinate
145- //| :param int c2r: Other Circle radius
146- //| ) -> None:
145+ //| c1x: int, c1y: int, c1r: int, c2x: int, c2y: int, c2r: int
146+ //| ) -> bool:
147+ //| """Checks for intersection between two circles.
148+ //|
149+ //| :param int c1x: First Circle center x coordinate
150+ //| :param int c1y: First Circle center y coordinate
151+ //| :param int c1r: First Circle radius
152+ //| :param int c2x: Second Circle center x coordinate
153+ //| :param int c2y: Second Circle center y coordinate
154+ //| :param int c2r: Second Circle radius"""
155+ //| ...
156+ //|
147157static mp_obj_t vectorio_circle_circle_intersects (size_t n_args , const mp_obj_t * pos_args , mp_map_t * kw_args ) {
148158 enum {ARG_c1x , ARG_c1y , ARG_c1r , ARG_c2x , ARG_c2y , ARG_c2r };
149159
@@ -167,9 +177,9 @@ static mp_obj_t vectorio_circle_circle_intersects(size_t n_args, const mp_obj_t
167177 int16_t c2r = args [ARG_c2r ].u_int ;
168178
169179 bool result = common_hal_vectorio_circle_circle_intersects (c1x , c1y , c1r , c2x , c2y , c2r );
170- if (result ){
180+ if (result ) {
171181 return mp_const_true ;
172- }else {
182+ } else {
173183 return mp_const_false ;
174184 }
175185}
0 commit comments