MCPcopy Create free account
hub / github.com/PyMesh/PyMesh / orient2dadapt

Function orient2dadapt

tools/Predicates/predicates.c:1536–1618  ·  view source on GitHub ↗
(pa, pb, pc, detsum)

Source from the content-addressed store, hash-verified

1534}
1535
1536REAL orient2dadapt(pa, pb, pc, detsum)
1537REAL *pa;
1538REAL *pb;
1539REAL *pc;
1540REAL detsum;
1541{
1542 INEXACT REAL acx, acy, bcx, bcy;
1543 REAL acxtail, acytail, bcxtail, bcytail;
1544 INEXACT REAL detleft, detright;
1545 REAL detlefttail, detrighttail;
1546 REAL det, errbound;
1547 REAL B[4], C1[8], C2[12], D[16];
1548 INEXACT REAL B3;
1549 int C1length, C2length, Dlength;
1550 REAL u[4];
1551 INEXACT REAL u3;
1552 INEXACT REAL s1, t1;
1553 REAL s0, t0;
1554
1555 INEXACT REAL bvirt;
1556 REAL avirt, bround, around;
1557 INEXACT REAL c;
1558 INEXACT REAL abig;
1559 REAL ahi, alo, bhi, blo;
1560 REAL err1, err2, err3;
1561 INEXACT REAL _i, _j;
1562 REAL _0;
1563
1564 acx = (REAL) (pa[0] - pc[0]);
1565 bcx = (REAL) (pb[0] - pc[0]);
1566 acy = (REAL) (pa[1] - pc[1]);
1567 bcy = (REAL) (pb[1] - pc[1]);
1568
1569 Two_Product(acx, bcy, detleft, detlefttail);
1570 Two_Product(acy, bcx, detright, detrighttail);
1571
1572 Two_Two_Diff(detleft, detlefttail, detright, detrighttail,
1573 B3, B[2], B[1], B[0]);
1574 B[3] = B3;
1575
1576 det = estimate(4, B);
1577 errbound = ccwerrboundB * detsum;
1578 if ((det >= errbound) || (-det >= errbound)) {
1579 return det;
1580 }
1581
1582 Two_Diff_Tail(pa[0], pc[0], acx, acxtail);
1583 Two_Diff_Tail(pb[0], pc[0], bcx, bcxtail);
1584 Two_Diff_Tail(pa[1], pc[1], acy, acytail);
1585 Two_Diff_Tail(pb[1], pc[1], bcy, bcytail);
1586
1587 if ((acxtail == 0.0) && (acytail == 0.0)
1588 && (bcxtail == 0.0) && (bcytail == 0.0)) {
1589 return det;
1590 }
1591
1592 errbound = ccwerrboundC * detsum + resulterrbound * Absolute(det);
1593 det += (acx * bcytail + bcy * acxtail)

Callers 1

orient2dFunction · 0.85

Calls 2

estimateFunction · 0.85

Tested by

no test coverage detected