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

Function incircle

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

Source from the content-addressed store, hash-verified

3224}
3225
3226REAL incircle(pa, pb, pc, pd)
3227REAL *pa;
3228REAL *pb;
3229REAL *pc;
3230REAL *pd;
3231{
3232 REAL adx, bdx, cdx, ady, bdy, cdy;
3233 REAL bdxcdy, cdxbdy, cdxady, adxcdy, adxbdy, bdxady;
3234 REAL alift, blift, clift;
3235 REAL det;
3236 REAL permanent, errbound;
3237
3238 adx = pa[0] - pd[0];
3239 bdx = pb[0] - pd[0];
3240 cdx = pc[0] - pd[0];
3241 ady = pa[1] - pd[1];
3242 bdy = pb[1] - pd[1];
3243 cdy = pc[1] - pd[1];
3244
3245 bdxcdy = bdx * cdy;
3246 cdxbdy = cdx * bdy;
3247 alift = adx * adx + ady * ady;
3248
3249 cdxady = cdx * ady;
3250 adxcdy = adx * cdy;
3251 blift = bdx * bdx + bdy * bdy;
3252
3253 adxbdy = adx * bdy;
3254 bdxady = bdx * ady;
3255 clift = cdx * cdx + cdy * cdy;
3256
3257 det = alift * (bdxcdy - cdxbdy)
3258 + blift * (cdxady - adxcdy)
3259 + clift * (adxbdy - bdxady);
3260
3261 permanent = (Absolute(bdxcdy) + Absolute(cdxbdy)) * alift
3262 + (Absolute(cdxady) + Absolute(adxcdy)) * blift
3263 + (Absolute(adxbdy) + Absolute(bdxady)) * clift;
3264 errbound = iccerrboundA * permanent;
3265 if ((det > errbound) || (-det > errbound)) {
3266 return det;
3267 }
3268
3269 return incircleadapt(pa, pb, pc, pd, permanent);
3270}
3271
3272/*****************************************************************************/
3273/* */

Callers 1

init_predicatesFunction · 0.85

Calls 1

incircleadaptFunction · 0.85

Tested by

no test coverage detected