… | |
… | |
108 | } |
108 | } |
109 | else if (p1->x == p2->x) |
109 | else if (p1->x == p2->x) |
110 | { |
110 | { |
111 | /* Repeat points */ |
111 | /* Repeat points */ |
112 | |
112 | |
113 | fprintf(stderr, "Repeat points:shapes.c: p1->x %f p1->y %f p2->x %f p2->y %f", p1->x, p1->y, p2->x, p2->y); |
113 | fprintf_(stderr, "Repeat points:shapes.c: p1->x %f p1->y %f p2->x %f p2->y %f\n", p1->x, p1->y, p2->x, p2->y); |
114 | |
114 | |
115 | // try to recover !!!!! |
115 | // try to recover !!!!! |
116 | THROW( MAPTOOL_00001_EXCEPTION ); |
116 | THROW( MAPTOOL_00001_EXCEPTION ); |
117 | |
117 | |
118 | // assert is not called!! |
118 | // assert is not called!! |
119 | assert (FALSE); |
119 | // assert (FALSE); |
120 | } |
120 | } |
121 | } |
121 | } |
122 | |
122 | |
123 | g_ptr_array_add (THIS->q->edge_list, THIS); |
123 | g_ptr_array_add (THIS->q->edge_list, THIS); |
124 | } |
124 | } |
… | |
… | |
175 | else if ((p1 == THIS->points_[0] && p2 == THIS->points_[1]) || (p1 == THIS->points_[1] && p2 == THIS->points_[0])) |
175 | else if ((p1 == THIS->points_[0] && p2 == THIS->points_[1]) || (p1 == THIS->points_[1] && p2 == THIS->points_[0])) |
176 | THIS->neighbors_[2] = t; |
176 | THIS->neighbors_[2] = t; |
177 | else |
177 | else |
178 | { |
178 | { |
179 | THROW( MAPTOOL_00001_EXCEPTION ); |
179 | THROW( MAPTOOL_00001_EXCEPTION ); |
180 | assert (0); |
180 | // assert (0); |
181 | } |
181 | } |
182 | } |
182 | } |
183 | |
183 | |
184 | /* Exhaustive search to update neighbor pointers */ |
184 | /* Exhaustive search to update neighbor pointers */ |
185 | |
185 | |
… | |
… | |
258 | p2t_triangle_opposite_point (P2tTriangle* THIS, P2tTriangle* t, P2tPoint* p) |
258 | p2t_triangle_opposite_point (P2tTriangle* THIS, P2tTriangle* t, P2tPoint* p) |
259 | { |
259 | { |
260 | |
260 | |
261 | if (THIS == NULL) |
261 | if (THIS == NULL) |
262 | { |
262 | { |
263 | fprintf(stderr, "P2tTriangle* THIS is NULL!\n"); |
263 | fprintf_(stderr, "P2tTriangle* THIS is NULL!\n"); |
264 | THROW( MAPTOOL_00001_EXCEPTION ); |
264 | THROW( MAPTOOL_00001_EXCEPTION ); |
265 | } |
265 | } |
266 | |
266 | |
267 | P2tPoint *cw = p2t_triangle_point_cw (t, p); |
267 | P2tPoint *cw = p2t_triangle_point_cw (t, p); |
268 | /*double x = cw->x; |
268 | /*double x = cw->x; |
… | |
… | |
307 | THIS->points_[1] = npoint; |
307 | THIS->points_[1] = npoint; |
308 | } |
308 | } |
309 | else |
309 | else |
310 | { |
310 | { |
311 | THROW( MAPTOOL_00001_EXCEPTION ); |
311 | THROW( MAPTOOL_00001_EXCEPTION ); |
312 | assert (0); |
312 | // assert (0); |
313 | } |
313 | } |
314 | } |
314 | } |
315 | |
315 | |
316 | int |
316 | int |
317 | p2t_triangle_index (P2tTriangle* THIS, const P2tPoint* p) |
317 | p2t_triangle_index (P2tTriangle* THIS, const P2tPoint* p) |
… | |
… | |
327 | else if (p == THIS->points_[2]) |
327 | else if (p == THIS->points_[2]) |
328 | { |
328 | { |
329 | return 2; |
329 | return 2; |
330 | } |
330 | } |
331 | THROW( MAPTOOL_00001_EXCEPTION ); |
331 | THROW( MAPTOOL_00001_EXCEPTION ); |
332 | assert (0); |
332 | // assert (0); |
333 | } |
333 | } |
334 | |
334 | |
335 | int |
335 | int |
336 | p2t_triangle_edge_index (P2tTriangle* THIS, const P2tPoint* p1, const P2tPoint* p2) |
336 | p2t_triangle_edge_index (P2tTriangle* THIS, const P2tPoint* p1, const P2tPoint* p2) |
337 | { |
337 | { |
… | |
… | |
408 | p2t_triangle_point_cw (P2tTriangle* THIS, P2tPoint* point) |
408 | p2t_triangle_point_cw (P2tTriangle* THIS, P2tPoint* point) |
409 | { |
409 | { |
410 | |
410 | |
411 | if (point == NULL) |
411 | if (point == NULL) |
412 | { |
412 | { |
413 | fprintf(stderr, "P2tPoint* point is NULL!\n"); |
413 | fprintf_(stderr, "P2tPoint* point is NULL!\n"); |
414 | THROW( MAPTOOL_00001_EXCEPTION ); |
414 | THROW( MAPTOOL_00001_EXCEPTION ); |
415 | } |
415 | } |
416 | |
416 | |
417 | |
417 | |
418 | if (point == THIS->points_[0]) |
418 | if (point == THIS->points_[0]) |
… | |
… | |
428 | return THIS->points_[1]; |
428 | return THIS->points_[1]; |
429 | } |
429 | } |
430 | |
430 | |
431 | double x = point->x; |
431 | double x = point->x; |
432 | double y = point->y; |
432 | double y = point->y; |
433 | fprintf(stderr, "x=%f, y=%f\n", x, y); |
433 | fprintf_(stderr, "x=%f, y=%f\n", x, y); |
434 | x = THIS->points_[0]->x; |
434 | x = THIS->points_[0]->x; |
435 | y = THIS->points_[0]->y; |
435 | y = THIS->points_[0]->y; |
436 | fprintf(stderr, "tp[0] x=%f, y=%f\n", x, y); |
436 | fprintf_(stderr, "tp[0] x=%f, y=%f\n", x, y); |
437 | x = THIS->points_[1]->x; |
437 | x = THIS->points_[1]->x; |
438 | y = THIS->points_[1]->y; |
438 | y = THIS->points_[1]->y; |
439 | fprintf(stderr, "tp[1] x=%f, y=%f\n", x, y); |
439 | fprintf_(stderr, "tp[1] x=%f, y=%f\n", x, y); |
440 | x = THIS->points_[2]->x; |
440 | x = THIS->points_[2]->x; |
441 | y = THIS->points_[2]->y; |
441 | y = THIS->points_[2]->y; |
442 | fprintf(stderr, "tp[2] x=%f, y=%f\n", x, y); |
442 | fprintf_(stderr, "tp[2] x=%f, y=%f\n", x, y); |
443 | |
443 | |
444 | |
444 | |
445 | THROW( MAPTOOL_00001_EXCEPTION ); |
445 | THROW( MAPTOOL_00001_EXCEPTION ); |
446 | // assert (0); |
446 | // assert (0); |
447 | |
447 | |
… | |
… | |
467 | return THIS->points_[0]; |
467 | return THIS->points_[0]; |
468 | } |
468 | } |
469 | |
469 | |
470 | |
470 | |
471 | THROW( MAPTOOL_00001_EXCEPTION ); |
471 | THROW( MAPTOOL_00001_EXCEPTION ); |
472 | assert (0); |
472 | // assert (0); |
473 | } |
473 | } |
474 | |
474 | |
475 | /* The neighbor clockwise to given point */ |
475 | /* The neighbor clockwise to given point */ |
476 | |
476 | |
477 | P2tTriangle* |
477 | P2tTriangle* |
… | |
… | |
505 | } |
505 | } |
506 | |
506 | |
507 | gboolean |
507 | gboolean |
508 | p2t_triangle_get_constrained_edge_ccw (P2tTriangle* THIS, P2tPoint* p) |
508 | p2t_triangle_get_constrained_edge_ccw (P2tTriangle* THIS, P2tPoint* p) |
509 | { |
509 | { |
|
|
510 | |
|
|
511 | if (THIS == NULL) |
|
|
512 | { |
|
|
513 | fprintf_(stderr, "P2tTriangle* 11 THIS is NULL!\n"); |
|
|
514 | THROW( MAPTOOL_00001_EXCEPTION ); |
|
|
515 | } |
|
|
516 | |
510 | if (p == THIS->points_[0]) |
517 | if (p == THIS->points_[0]) |
511 | { |
518 | { |
512 | return THIS->constrained_edge[2]; |
519 | return THIS->constrained_edge[2]; |
513 | } |
520 | } |
514 | else if (p == THIS->points_[1]) |
521 | else if (p == THIS->points_[1]) |
… | |
… | |
519 | } |
526 | } |
520 | |
527 | |
521 | gboolean |
528 | gboolean |
522 | p2t_triangle_get_constrained_edge_cw (P2tTriangle* THIS, P2tPoint* p) |
529 | p2t_triangle_get_constrained_edge_cw (P2tTriangle* THIS, P2tPoint* p) |
523 | { |
530 | { |
|
|
531 | |
|
|
532 | if (THIS == NULL) |
|
|
533 | { |
|
|
534 | fprintf_(stderr, "P2tTriangle* 22 THIS is NULL!\n"); |
|
|
535 | THROW( MAPTOOL_00001_EXCEPTION ); |
|
|
536 | } |
|
|
537 | |
|
|
538 | |
|
|
539 | |
524 | if (p == THIS->points_[0]) |
540 | if (p == THIS->points_[0]) |
525 | { |
541 | { |
526 | return THIS->constrained_edge[1]; |
542 | return THIS->constrained_edge[1]; |
527 | } |
543 | } |
528 | else if (p == THIS->points_[1]) |
544 | else if (p == THIS->points_[1]) |