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

Function orient3d

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

Source from the content-addressed store, hash-verified

2290}
2291
2292REAL orient3d(pa, pb, pc, pd)
2293REAL *pa;
2294REAL *pb;
2295REAL *pc;
2296REAL *pd;
2297{
2298 REAL adx, bdx, cdx, ady, bdy, cdy, adz, bdz, cdz;
2299 REAL bdxcdy, cdxbdy, cdxady, adxcdy, adxbdy, bdxady;
2300 REAL det;
2301 REAL permanent, errbound;
2302
2303 adx = pa[0] - pd[0];
2304 bdx = pb[0] - pd[0];
2305 cdx = pc[0] - pd[0];
2306 ady = pa[1] - pd[1];
2307 bdy = pb[1] - pd[1];
2308 cdy = pc[1] - pd[1];
2309 adz = pa[2] - pd[2];
2310 bdz = pb[2] - pd[2];
2311 cdz = pc[2] - pd[2];
2312
2313 bdxcdy = bdx * cdy;
2314 cdxbdy = cdx * bdy;
2315
2316 cdxady = cdx * ady;
2317 adxcdy = adx * cdy;
2318
2319 adxbdy = adx * bdy;
2320 bdxady = bdx * ady;
2321
2322 det = adz * (bdxcdy - cdxbdy)
2323 + bdz * (cdxady - adxcdy)
2324 + cdz * (adxbdy - bdxady);
2325
2326 permanent = (Absolute(bdxcdy) + Absolute(cdxbdy)) * Absolute(adz)
2327 + (Absolute(cdxady) + Absolute(adxcdy)) * Absolute(bdz)
2328 + (Absolute(adxbdy) + Absolute(bdxady)) * Absolute(cdz);
2329 errbound = o3derrboundA * permanent;
2330 if ((det > errbound) || (-det > errbound)) {
2331 return det;
2332 }
2333
2334 return orient3dadapt(pa, pb, pc, pd, permanent);
2335}
2336
2337/*****************************************************************************/
2338/* */

Callers 3

get_tet_orientationsMethod · 0.85
init_predicatesFunction · 0.85
TESTFunction · 0.85

Calls 1

orient3dadaptFunction · 0.85

Tested by 1

TESTFunction · 0.68