Returns non-zero if edges A and B interact.
The type of interaction is given in the return value with the bitmask elements defined above.
3390{
3392 double ab_dot;
3393 int a1_side, a2_side, b1_side, b2_side;
3395
3396
3399
3400
3402
3403
3404
3405
3406
3407
3408
3409
3410 if ( 1.0 - fabs(ab_dot) <= 10e-16 )
3411 {
3412
3415 {
3418 }
3419 return rv;
3420 }
3421
3422
3423
3428
3429
3430 if ( a1_side == a2_side && a1_side != 0 )
3431 {
3432
3434 }
3435
3436
3437 if ( b1_side == b2_side && b1_side != 0 )
3438 {
3439
3441 }
3442
3443
3444 if ( a1_side != a2_side && (a1_side + a2_side) == 0 &&
3445 b1_side != b2_side && (b1_side + b2_side) == 0 )
3446 {
3447
3450 {
3452 }
3453
3454
3457 {
3459 }
3460
3462 }
3463
3464
3466
3467
3468 if ( a1_side == 0 )
3469 {
3470
3472 }
3473 else if ( a2_side == 0 )
3474 {
3475
3477 }
3478
3479
3480 if ( b1_side == 0 )
3481 {
3482
3484 }
3485 else if ( b2_side == 0 )
3486 {
3487
3489 }
3490
3491 return rv;
3492}
static int point_in_cone(const POINT3D *A1, const POINT3D *A2, const POINT3D *P)
Utility function for checking if P is within the cone defined by A1/A2.
void vector_scale(POINT3D *n, double scale)
Scale a vector out by a factor.
static int dot_product_side(const POINT3D *p, const POINT3D *q)
Utility function for edge_intersects(), signum with a tolerance in determining if the value is zero.
void unit_normal(const POINT3D *P1, const POINT3D *P2, POINT3D *normal)
Calculates the unit normal to two vectors, trying to avoid problems with over-narrow or over-wide cas...
static double dot_product(const POINT3D *p1, const POINT3D *p2)
Convert cartesian coordinates on unit sphere to lon/lat coordinates static void cart2ll(const POINT3D...
#define PIR_A_TOUCH_RIGHT
#define PIR_B_TOUCH_RIGHT
#define PIR_NO_INTERACT
Bitmask elements for edge_intersects() return value.