@@ -96,9 +96,9 @@ boolean Is_Adjacent(t_vertexID id1, t_vertexID id2)
96
96
{
97
97
if ((vertex[id1].adjacency_active & ((t_adjacency)1u << id2))
98
98
|| (vertex[id2].adjacency_active & ((t_adjacency)1u << id1)))
99
- return 1 ;
99
+ return true ;
100
100
101
- return 0 ;
101
+ return false ;
102
102
}
103
103
104
104
/* ***************************************************************************************
@@ -118,10 +118,10 @@ boolean Is_Intersection_Segment(Segment *s1, Segment *s2)
118
118
119
119
if ((s1->a == s2->a ) && (s1->b == s2->b )) // segments are one the same line (parallel but not distinct)
120
120
if (Is_Point_On_Segment (&s2->p1 , s1) && Is_Point_On_Segment (&s2->p2 , s1))
121
- return 1 ;
121
+ return true ;
122
122
123
123
if ((s1->a == s2->a ) && (s1->b != s2->b )) // segments are parallel and distinct
124
- return 0 ;
124
+ return false ;
125
125
126
126
if (s1->a == 9999 ) // segment 1 is vertical
127
127
{
@@ -140,9 +140,9 @@ boolean Is_Intersection_Segment(Segment *s1, Segment *s2)
140
140
}
141
141
142
142
if (Is_Point_On_Segment (&commun, s1) && Is_Point_On_Segment (&commun, s2))
143
- return 1 ;
143
+ return true ;
144
144
145
- return 0 ;
145
+ return false ;
146
146
}
147
147
148
148
/* ***************************************************************************************
@@ -152,9 +152,9 @@ boolean Is_Point_On_Segment(Point * p, Segment *s)
152
152
{
153
153
if ((p->x <= max (s->p1 .x ,s->p2 .x )) && (p->x >= min (s->p1 .x ,s->p2 .x ))
154
154
&& (p->y <= max (s->p1 .y ,s->p2 .y )) && (p->y >= min (s->p1 .y ,s->p2 .y )))
155
- return 1 ;
155
+ return true ;
156
156
157
- return 0 ;
157
+ return false ;
158
158
}
159
159
160
160
/* ***************************************************************************************
@@ -205,9 +205,9 @@ Point GePoint_ProjectionOn_Segment(Point *p, Segment *s)
205
205
boolean Is_Equal_Point (Point *p1, Point *p2)
206
206
{
207
207
if ((p1->x == p2->x ) && (p1->y == p2->y ))
208
- return 1 ;
208
+ return true ;
209
209
210
- return 0 ;
210
+ return false ;
211
211
}
212
212
213
213
/* ***************************************************************************************
@@ -226,20 +226,20 @@ boolean Is_Point_CloseTo_Segment(Point *p, Segment *s, uint16 d)
226
226
Point projected;
227
227
228
228
// if (Get_Distance_Point(p, s.p1) <= d) // check distance from first end point
229
- // return 1 ;
229
+ // return true ;
230
230
//
231
231
// if (Get_Distance_Point(p, s.p2) <= d) // check distance from second end point
232
- // return 1 ;
232
+ // return true ;
233
233
234
234
projected = GePoint_ProjectionOn_Segment (p, s);
235
235
236
236
if (Is_Point_On_Segment (&projected, s))
237
237
{
238
238
if (Get_Distance_Point (p, &projected) <= d) // check distance from line
239
- return 1 ;
239
+ return true ;
240
240
}
241
241
242
- return 0 ;
242
+ return false ;
243
243
}
244
244
245
245
/* ***************************************************************************************
@@ -249,8 +249,8 @@ boolean Is_Circle_CloseTo_Segment(Circle *c, Segment *s, uint16 d)
249
249
{
250
250
d = d + c->r ;
251
251
// check distance from each end point to circle
252
- if (Get_Distance_Point (&s->p1 , &c->p ) <= d) return 1 ;
253
- if (Get_Distance_Point (&s->p2 , &c->p ) <= d) return 1 ;
252
+ if (Get_Distance_Point (&s->p1 , &c->p ) <= d) return true ;
253
+ if (Get_Distance_Point (&s->p2 , &c->p ) <= d) return true ;
254
254
255
255
return Is_Point_CloseTo_Segment (&c->p , s, d);
256
256
}
@@ -261,21 +261,21 @@ boolean Is_Circle_CloseTo_Segment(Circle *c, Segment *s, uint16 d)
261
261
boolean Is_Segment_CloseTo_Segment (Segment *s1, Segment *s2, uint16 d)
262
262
{
263
263
// check segment intersection
264
- if (Is_Intersection_Segment (s1, s2)) return 1 ;
264
+ if (Is_Intersection_Segment (s1, s2)) return true ;
265
265
266
266
// // check distance from each end point to each other // manually done in excel map
267
- // if (Get_Distance_Point(&s1->p1, &s2->p1) <= d) return 1 ;
268
- // if (Get_Distance_Point(&s1->p1, &s2->p2) <= d) return 1 ;
269
- // if (Get_Distance_Point(&s1->p2, &s2->p1) <= d) return 1 ;
270
- // if (Get_Distance_Point(&s1->p2, &s2->p2) <= d) return 1 ;
267
+ // if (Get_Distance_Point(&s1->p1, &s2->p1) <= d) return true ;
268
+ // if (Get_Distance_Point(&s1->p1, &s2->p2) <= d) return true ;
269
+ // if (Get_Distance_Point(&s1->p2, &s2->p1) <= d) return true ;
270
+ // if (Get_Distance_Point(&s1->p2, &s2->p2) <= d) return true ;
271
271
272
272
// // check distance orthogonal from end point // manually done in excel map
273
- // if (Is_Point_CloseTo_Segment(&s1->p1, s2, d)) return 1 ;
274
- // if (Is_Point_CloseTo_Segment(&s1->p2, s2, d)) return 1 ;
275
- // if (Is_Point_CloseTo_Segment(&s2->p1, s1, d)) return 1 ;
276
- // if (Is_Point_CloseTo_Segment(&s2->p2, s1, d)) return 1 ;
273
+ // if (Is_Point_CloseTo_Segment(&s1->p1, s2, d)) return true ;
274
+ // if (Is_Point_CloseTo_Segment(&s1->p2, s2, d)) return true ;
275
+ // if (Is_Point_CloseTo_Segment(&s2->p1, s1, d)) return true ;
276
+ // if (Is_Point_CloseTo_Segment(&s2->p2, s1, d)) return true ;
277
277
278
- return 0 ;
278
+ return false ;
279
279
}
280
280
281
281
/* ***************************************************************************************
@@ -295,26 +295,26 @@ boolean Is_Passable_Point(Point *source, Point *target, uint16 margin)
295
295
Segment edge;
296
296
297
297
// if (Is_Equal_Point(source, target)) // check segment existence
298
- // return 0 ;
298
+ // return false ;
299
299
300
300
edge = Segment (*source, *target);
301
301
302
302
for (i=0 ; i<Max_Segment; i++)
303
303
{
304
304
if (Is_Segment_CloseTo_Segment (&segment[i], &edge, margin)) // check segment proximity
305
- return 0 ;
305
+ return false ;
306
306
}
307
307
308
308
for (i=0 ; i<Max_Circle; i++)
309
309
{
310
310
if (Is_NotNull_Circle (&circle[i]))
311
311
{
312
312
if (Is_Circle_CloseTo_Segment (&circle[i], &edge, margin)) // check circle proximity
313
- return 0 ;
313
+ return false ;
314
314
}
315
315
}
316
316
317
- return 1 ; // after all checking
317
+ return true ; // after all checking
318
318
}
319
319
320
320
/* ***************************************************************************************
@@ -331,19 +331,19 @@ boolean Is_Passable_Robot(Point *target, uint16 margin)
331
331
for (i=0 ; i<Max_Segment; i++) // check segment proximity
332
332
{
333
333
// check segment intersection
334
- if (Is_Intersection_Segment (&segment[i], &edge)) return 0 ;
334
+ if (Is_Intersection_Segment (&segment[i], &edge)) return false ;
335
335
336
336
// // check distance from each end point to each other
337
- // //if (Get_Distance_Point(&edge.p1, &segment[i].p1) <= margin) return 0 ; // ignore edge.p1 = vertex[0] = robot
338
- // //if (Get_Distance_Point(&edge.p1, &segment[i].p2) <= margin) return 0 ;
339
- // if (Get_Distance_Point(&edge.p2, &segment[i].p1) <= margin) return 0 ;
340
- // if (Get_Distance_Point(&edge.p2, &segment[i].p2) <= margin) return 0 ;
337
+ // //if (Get_Distance_Point(&edge.p1, &segment[i].p1) <= margin) return false ; // ignore edge.p1 = vertex[0] = robot
338
+ // //if (Get_Distance_Point(&edge.p1, &segment[i].p2) <= margin) return false ;
339
+ // if (Get_Distance_Point(&edge.p2, &segment[i].p1) <= margin) return false ;
340
+ // if (Get_Distance_Point(&edge.p2, &segment[i].p2) <= margin) return false ;
341
341
342
342
// // check distance orthogonal from end point
343
- // if (Is_Point_CloseTo_Segment(&segment[i].p1, &edge, margin)) return 0 ;
344
- // if (Is_Point_CloseTo_Segment(&segment[i].p2, &edge, margin)) return 0 ;
345
- // //if (Is_Point_CloseTo_Segment(edge.p1, segment[i], margin)) return 0 ;
346
- // if (Is_Point_CloseTo_Segment(&edge.p2, &segment[i], margin)) return 0 ; // manually done in excel map
343
+ // if (Is_Point_CloseTo_Segment(&segment[i].p1, &edge, margin)) return false ;
344
+ // if (Is_Point_CloseTo_Segment(&segment[i].p2, &edge, margin)) return false ;
345
+ // //if (Is_Point_CloseTo_Segment(edge.p1, segment[i], margin)) return false ;
346
+ // if (Is_Point_CloseTo_Segment(&edge.p2, &segment[i], margin)) return false ; // manually done in excel map
347
347
}
348
348
349
349
for (i=0 ; i<Max_Circle; i++) // check circle proximity
@@ -352,10 +352,10 @@ boolean Is_Passable_Robot(Point *target, uint16 margin)
352
352
{
353
353
margin_temp = margin + circle[i].r ;
354
354
// check distance from end point to circle
355
- // if (Get_Distance_Point(&edge.p1, &circle[i].p) <= margin_temp) return 0 ;
356
- if (Get_Distance_Point (&edge.p2 , &circle[i].p ) <= margin_temp) return 0 ; // usefull for vertex in circle
355
+ // if (Get_Distance_Point(&edge.p1, &circle[i].p) <= margin_temp) return false ;
356
+ if (Get_Distance_Point (&edge.p2 , &circle[i].p ) <= margin_temp) return false ; // usefull for vertex in circle
357
357
358
- if (Is_Point_CloseTo_Segment (&circle[i].p , &edge, margin_temp)) return 0 ; // most important
358
+ if (Is_Point_CloseTo_Segment (&circle[i].p , &edge, margin_temp)) return false ; // most important
359
359
}
360
360
}
361
361
@@ -366,14 +366,14 @@ boolean Is_Passable_Robot(Point *target, uint16 margin)
366
366
if (Is_Valid_Obstacle (i))
367
367
{
368
368
if (Get_Distance_Point (&edge.p2 , &obstacle[i].p ) < margin_temp)
369
- return 0 ;
369
+ return false ;
370
370
371
371
if (Is_Point_CloseTo_Segment (&obstacle[i].p , &edge, margin_temp))
372
- return 0 ;
372
+ return false ;
373
373
}
374
374
}
375
375
376
- return 1 ; // after all checking
376
+ return true ; // after all checking
377
377
}
378
378
379
379
/* ***************************************************************************************
0 commit comments