13 using namespace mathfce;
21 double U[ 3 ], V[ 3 ];
38 for (
int i = 0; i < 3; i++) {
48 for (
int i = 0; i < 3; i++) {
49 if ((i != r1) && !
IsZero(U[ i ])) {
53 if ((i != r2) && !
IsZero(V[ i ])) {
60 if ((r1 == -1) || (r2 == -1)) {
66 for (
int i = 0; i < 3; i++) {
67 if ((r1 != i) && (r2 != i)) {
74 A.
Set(1, 2, -V[ r1 ]);
76 A.
Set(2, 2, -V[ r2 ]);
147 }
else if ( pos ==
same ) {
154 if (dot_product < 0 ) {
161 double loc_begin_A1, loc_end_A1, loc_begin_A2, loc_end_A2;
179 double X1=0, X2=0, Y1=0, Y2=0;
181 if ((loc_begin_A2 < 0) && (loc_end_A2 < 0)) {
186 if ((loc_begin_A2 < 0) && (loc_end_A2 >= 0) && (loc_end_A2 < 1)) {
193 if ((loc_begin_A2 >= 0) && (loc_end_A2 >= 0) && (loc_end_A2 < 1)) {
200 if ((loc_begin_A2 >= 0) && (loc_begin_A2 < 1) && (loc_end_A2 >= 1)) {
207 if ((loc_begin_A2 >= 1) && (loc_end_A2 >= 1)) {
212 if ((loc_begin_A2 < 0) && (loc_end_A2 >= 1)) {
218 ASSERT(X1==0 && X2==0 && Y1==0 && Y2==0,
"Uncovered situation.");
269 }
else if ( pos ==
same ) {
288 double loc_begin_A, loc_end_A;
289 loc_begin_A = (t1 > 0) ? t1 : 0;
290 loc_end_A = (t2 < 1) ? t2 : 1;
323 TPosition &pos,
double &t1,
double &t2) {
334 TPosition &pos,
double &t1,
double &t2) {
344 TPosition &pos,
double &t2,
double &t1) {
359 sqrt(pow(P.
GetA(), 2) + pow(P.
GetB(), 2) + pow(P.
GetC(), 2));
365 dis = sqrt(pow(P1.
X() - P2.
X(), 2) + pow(P1.
Y() - P2.
Y(), 2) +
366 pow(P1.
Z() - P2.
Z(), 2));
390 for (i = 1; i <= 3; i++)
395 u1 = v1 = u2 = v2 = -1;
423 for (i = 1; i <= 3; i++) {
437 if (u1 != -1 && v1 != -1)
465 for (i = 1; i <= 3; i++) {
472 aa(i-1,1) = (-P.
GetU().
Get(i));
473 aa(i-1,2) = (-P.
GetV().
Get(i));
476 arma::solve(xx, aa, bb);
627 loc_tria_coord_01[0]=0;
628 loc_tria_coord_01[1]=0;
630 loc_tria_coord_02[0]=1;
631 loc_tria_coord_02[1]=0;
633 loc_tria_coord_03[0]=0;
634 loc_tria_coord_03[1]=1;
638 if (insec_tmp != NULL) {
664 if (insec_tmp != NULL) {
685 if (insec_tmp != NULL) {
712 if (*(insec_point_tmp[0]) == *(insec_point_tmp[0])) {
716 for (
int i = 0; i < cit; i++) {
717 if (*(insec_point_tmp[i]) == *(insec_point_tmp[(i+1)%3])) {
722 delete insec_point_tmp[(i+1)%3];
728 insec_point_tmp[0] = insec_point_tmp[i];
729 insec_point_tmp[1] = tmp;
735 THROW( ExcAssertMsg() << EI_Message(
"Error - pocet bodu pruniku != 2.\n") );
738 if (*(insec_point_tmp[0]) == *(insec_point_tmp[1])) {
742 delete insec_point_tmp[1];
785 if (t1 < 0 - epsilon || t1 > 1 +
epsilon) {
809 if (A1_t < 0) A1_t = 0;
810 if (A2_t > 1) A2_t = 1;
946 coef = fabs(tt[1] - tt[0]);
953 for (
int i = 1; i <= 4; i++) {
967 if (tt1 < 0) tt1 = 0;
968 if (tt2 > 1) tt2 = 1;
969 coef = fabs(tt2 - tt1);
989 if (tt[0] < 0) tt[0] = 0;
990 if (tt[1] > 1) tt[1] = 1;
991 coef = fabs(tt[1] - tt[0]);
1016 for (
int i = 1; i <= 3; i++) {
1025 for (
int i = 1; i <= 3; i++) {
1026 for (
int j = 1; j <= 4; j++) {
1046 for (
int i = 1; i <= 6; i++) {
1080 for (
int i = 1; i <= 3; i++) {
1082 if (a.GetMin(i) > b.GetMax(i) +
epsilon || a.GetMax(i) < b.GetMin(i) -
epsilon) {
void SetVector(const TVector &)
const TVector & GetVector() const
const TPoint & GetPoint() const
bool ArePerpendicular(const TVector &, const TVector &)
double Distance(const TBisector &B, const TPoint &P)
IntersectionPoint * interpolate(const IntersectionPoint &A1, const IntersectionPoint &A2, double t)
const IntersectionPoint * get_point(const unsigned int index) const
bool AreParallel(const TVector &, const TVector &)
const std::vector< double > & el2_coord() const
const TPoint & GetPoint() const
void SetPoint(const TPoint &)
void GetIntersection(const TBisector &B1, const TBisector &B2, TPosition &pos, double &t1, double &t2)
bool IsInner(const TPoint &) const
const TPoint & GetPoint(int) const
const TTriangle & GetTriangle(int) const
const std::vector< double > & el1_coord() const
const TVector & GetU() const
TVector Cross(const TVector &, const TVector &)
const TAbscissa & GetAbscissa(int) const
void add_local_coord(const std::vector< double > &coordin1, const std::vector< double > &coordin2)
void GetParameter(const TPoint &, double &, bool &) const
const TVector & GetV() const
enum Intersections TIntersectionType
bool Belong(const TPoint &) const
bool Belong(const TPoint &) const
const TPlain & GetPlain() const
void Set(int, int, double)
const TVector & GetNormal() const
const TAbscissa & GetAbscissa(int) const
void Get(double &, double &, double &) const
bool QuickIntersectionTest(const A &a, const B &b)
#define THROW(whole_exception_expr)
Wrapper for throw. Saves the throwing point.
TNSolutions Gauss(const TMatrix &, TMVector *, const TMVector &)
double Dot(const TVector &, const TVector &)
IntersectionType get_type() const
void add_local_point(IntersectionPoint *InPoint)
bool IsInner(const TPoint &) const
bool IsEqual(double, double)