54 Inequation(
float pa,
float pb,
float pc,
float pw);
72 void SetAbcw(
float pa,
float pb,
float pc,
float pw);
103 float alpha, b, c, w;
129 :alpha(0), b(0), c(0), w(0), strict(false), used(true)
134 :alpha(pa), b(pb), c(pc), w(pw), strict(false), used(true)
180 if(fabs(alpha)>
EPS && fabs(b)>
EPS && fabs(c)>
EPS)
184 if ((fabs(alpha)>
EPS && fabs(b)>
EPS)||
185 (fabs(alpha)>
EPS && fabs(c)>
EPS)||
186 (fabs(b)>
EPS && fabs(c)>
EPS))
190 if(fabs(alpha)>
EPS || fabs(b)>
EPS || fabs(c)>
EPS)
264 if (alpha*pt.getX() + b*pt.getY() + c*pt.getZ() < w)
271 if (alpha*pt.getX() + b*pt.getY() + c*pt.getZ() <= w +
EPS)
284 if (fabs(alpha*pt.getX() + b*pt.getY() + c*pt.getZ() - w) <=
EPS)
296 float const epsilon = 0.0001;
298 float mat[3][4] = {{alpha, b, c, w},
299 {i1.alpha, i1.b, i1.c, i1.w},
300 {i2.alpha, i2.b, i2.c, i2.w}};
304 for (
int i=0; i<3; i++)
305 for (
int j=0; j<4; j++)
306 if (fabs(mat[i][j]) < epsilon)
311 for (
int i=0; i<3; i++)
312 if (mat[i][0] == 0.0)
322 for (
int i=0; i<4; i++)
323 mat[0][i] = mat[0][i]*coef2 - mat[1][i]*coef1;
328 for (
int i=0; i<4; i++)
329 mat[1][i] = mat[1][i]*coef1 - mat[2][i]*coef2;
336 if (mat[0][0] == 0.0)
341 for (
int i=0; i<4; i++)
342 mat[1][i] = mat[1][i]*coef2 - mat[2][i]*coef1;
346 if (mat[1][0] == 0.0)
351 for (
int i=0; i<4; i++)
352 mat[0][i] = mat[0][i]*coef2 - mat[2][i]*coef1;
360 for (
int i=0; i<4; i++)
361 mat[0][i] = mat[0][i]*coef2 - mat[1][i]*coef1;
368 for (
int i=0; i<3; i++)
369 if (mat[i][1] == 0.0)
375 if (mat[0][0] == 0.0)
379 if (mat[1][0] == 0.0)
383 for (
int i=1; i<4; i++)
384 mat[1][i] = mat[1][i]*coef1 - mat[0][i]*coef2;
388 for (
int i=0; i<4; i++)
389 mat[2][i] = mat[2][i]*coef1 - mat[0][i]*coef2;
396 for (
int i=1; i<4; i++)
397 mat[2][i] = mat[2][i]*coef1 - mat[0][i]*coef2;
401 for (
int i=0; i<4; i++)
402 mat[1][i] = mat[1][i]*coef1 - mat[0][i]*coef2;
411 for (
int i=0; i<4; i++)
412 mat[0][i] = mat[0][i]*coef2 - mat[1][i]*coef1;
416 for (
int i=1; i<4; i++)
417 mat[1][i] = mat[1][i]*coef1 - mat[2][i]*coef2;
425 if (mat[0][1] == 0.0)
427 if (mat[0][0] == 0.0)
432 if (mat[1][0] == 0.0)
434 for (
int i=0; i<4; i++)
435 mat[2][i] = mat[2][i]*coef1 - mat[1][i]*coef2;
440 for (
int i=0; i<4; i++)
441 mat[1][i] = mat[1][i]*coef2 - mat[2][i]*coef1;
450 for (
int i=1; i<4; i++)
451 mat[1][i] = mat[1][i]*coef1 - mat[2][i]*coef2;
456 if (mat[1][1] == 0.0)
458 if (mat[1][0] == 0.0)
463 if (mat[0][0] == 0.0)
465 for (
int i=0; i<4; i++)
466 mat[2][i] = mat[2][i]*coef1 - mat[0][i]*coef2;
471 for (
int i=0; i<4; i++)
472 mat[0][i] = mat[0][i]*coef2 - mat[2][i]*coef1;
481 for (
int i=1; i<4; i++)
482 mat[0][i] = mat[0][i]*coef2 - mat[2][i]*coef1;
488 if (mat[2][0] == 0.0)
493 if (mat[0][0] == 0.0)
495 for (
int i=0; i<4; i++)
496 mat[1][i] = mat[1][i]*coef1 - mat[0][i]*coef2;
501 for (
int i=0; i<4; i++)
502 mat[0][i] = mat[0][i]*coef2 - mat[1][i]*coef1;
511 for (
int i=1; i<4; i++)
512 mat[0][i] = mat[0][i]*coef2 - mat[1][i]*coef1;
520 for (
int i=0; i<3; i++)
521 if (mat[i][2] == 0.0)
527 if (mat[0][0] == 0.0 && mat[0][1] == 0.0)
532 for (
int i=0; i<4; i++)
533 mat[1][i] = mat[1][i]*coef1 - mat[0][i]*coef2;
537 for (
int i=0; i<4; i++)
538 mat[2][i] = mat[2][i]*coef1 - mat[0][i]*coef2;
542 if (mat[1][0] == 0.0 && mat[1][1] == 0.0)
547 for (
int i=0; i<4; i++)
548 mat[0][i] = mat[0][i]*coef1 - mat[1][i]*coef2;
552 for (
int i=0; i<4; i++)
553 mat[2][i] = mat[2][i]*coef1 - mat[1][i]*coef2;
561 for (
int i=0; i<4; i++)
562 mat[0][i] = mat[0][i]*coef1 - mat[2][i]*coef2;
566 for (
int i=0; i<4; i++)
567 mat[1][i] = mat[1][i]*coef1 - mat[2][i]*coef2;
574 if (mat[0][2] == 0.0)
579 if (mat[1][0] == 0.0 && mat[1][1] == 0.0)
581 for (
int i=0; i<4; i++)
582 mat[2][i] = mat[2][i]*coef2 - mat[1][i]*coef1;
587 for (
int i=0; i<4; i++)
588 mat[1][i] = mat[1][i]*coef1 - mat[2][i]*coef2;
593 if (mat[1][2] == 0.0)
598 if (mat[0][0] == 0.0 && mat[0][1] == 0.0)
600 for (
int i=0; i<4; i++)
601 mat[2][i] = mat[2][i]*coef1 - mat[0][i]*coef2;
606 for (
int i=0; i<4; i++)
607 mat[0][i] = mat[0][i]*coef2 - mat[2][i]*coef1;
616 if (mat[0][0] == 0.0 && mat[0][1] == 0.0)
618 for (
int i=0; i<4; i++)
619 mat[1][i] = mat[1][i]*coef1 - mat[0][i]*coef2;
624 for (
int i=0; i<4; i++)
625 mat[0][i] = mat[0][i]*coef2 - mat[1][i]*coef1;
632 if (mat[0][0] != 0.0)
633 x = mat[0][3] / mat[0][0];
636 if (mat[1][0] != 0.0)
637 x = mat[1][3] / mat[1][0];
640 x = mat[2][3] / mat[2][0];
642 if (mat[0][1] != 0.0)
643 y = mat[0][3] / mat[0][1];
646 if (mat[1][1] != 0.0)
647 y = mat[1][3] / mat[1][1];
650 y = mat[2][3] / mat[2][1];
652 if (mat[0][2] != 0.0)
653 z = mat[0][3] / mat[0][2];
656 if (mat[1][2] != 0.0)
657 z = mat[1][3] / mat[1][2];
660 z = mat[2][3] / mat[2][2];
662 return new CVertex (x, y, z);
672 if (alpha != 0.0 && i.alpha != 0.0)
674 i.b = (i.b * alpha)/i.alpha;
675 i.c = (i.c * alpha)/i.alpha;
676 i.w = (i.w * alpha)/i.alpha;
680 if (alpha != 0.0 || i.alpha != 0.0)
683 if (b != 0.0 && i.b != 0.0)
685 if (change && fabs(b - i.b) >
EPS)
688 if (fabs(b - i.b) >
EPS)
695 if (b != 0.0 || i.b != 0.0)
698 if (c != 0.0 && i.c != 0.0)
700 if (change && fabs(c - i.c) >
EPS)
703 if (fabs(c - i.c) >
EPS)
709 if (c != 0.0 || i.c != 0.0)
712 if (fabs(w - i.w) >
EPS)
723 return !(*
this == i);
731 s << i.
GetA() <<
"\t"
733 << i.
GetC() <<
"\t\t"
736 s <<
"\t\t" << i.
GetW() <<
"\t\t" << i.
Is_Used() << std::endl;
744 float alpha, b, c, w;
747 s >> alpha >> b >> c >> strict >> w >> used;