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

Function orient2d

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

Source from the content-addressed store, hash-verified

1618}
1619
1620REAL orient2d(pa, pb, pc)
1621REAL *pa;
1622REAL *pb;
1623REAL *pc;
1624{
1625 REAL detleft, detright, det;
1626 REAL detsum, errbound;
1627
1628 detleft = (pa[0] - pc[0]) * (pb[1] - pc[1]);
1629 detright = (pa[1] - pc[1]) * (pb[0] - pc[0]);
1630 det = detleft - detright;
1631
1632 if (detleft > 0.0) {
1633 if (detright <= 0.0) {
1634 return det;
1635 } else {
1636 detsum = detleft + detright;
1637 }
1638 } else if (detleft < 0.0) {
1639 if (detright >= 0.0) {
1640 return det;
1641 } else {
1642 detsum = -detleft - detright;
1643 }
1644 } else {
1645 return det;
1646 }
1647
1648 errbound = ccwerrboundA * detsum;
1649 if ((det >= errbound) || (-det >= errbound)) {
1650 return det;
1651 }
1652
1653 return orient2dadapt(pa, pb, pc, detsum);
1654}
1655
1656/*****************************************************************************/
1657/* */

Callers 4

is_colinear_2DMethod · 0.85
is_colinear_3DMethod · 0.85
init_predicatesFunction · 0.85

Calls 1

orient2dadaptFunction · 0.85

Tested by

no test coverage detected