Flow123d  last_with_con_2.0.0-4-g42e6930
abscissa.cpp
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 3 as published by the
7  * Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12  *
13  *
14  * @file abscissa.cpp
15  * @brief
16  */
17 
18 #include <cmath>
19 
21 #include "stdio.h"
22 
24 
27 }
28 
30  id = generateId();
31 }
32 
33 TAbscissa::TAbscissa(const TPoint& PP0, const TPoint& PP1)
34 : TBisector(PP0, PP1)
35 {
36  id = generateId();
37 
38  ComputeLength();
39 }
40 
41 
43 : TBisector(ele)
44 {
45  id = generateId();
46 
47  ComputeLength();
48 }
49 
50 
51 
53 
54  *U = *(a.U);
55  *X0 = *(a.X0);
56 
57  length = a.length;
58 
59  return *this;
60 }
61 
63 }
64 
65 void TAbscissa::SetPoints(const TPoint& PP0, const TPoint& PP1) {
66  TBisector::SetPoints(PP0, PP1);
67  ComputeLength();
68 }
69 
71 
72  length = U->Length();
73 }
74 
76  return length;
77 }
78 
80  arma::vec3 minCoor;
81  arma::vec3 maxCoor;
82 
83  for (int i=0; i<3; ++i) {
84  minCoor(i) = GetMin(i+1);
85  maxCoor(i) = GetMax(i+1);
86  }
87 
88  boundingBox=BoundingBox(minCoor, maxCoor);
89 
90  return boundingBox;
91 }
92 
93 double TAbscissa::GetMin(int x) const {
94  if (U == NULL ) printf("U is null!");
95  if (U->Get(x) < 0 ) {
96  return U->Get(x)+X0->Get(x);
97  } else {
98  return X0->Get(x);
99  }
100 }
101 
102 double TAbscissa::GetMax(int x) const {
103  if (U->Get(x) > 0 ) {
104  return U->Get(x)+X0->Get(x);
105  } else {
106  return X0->Get(x);
107  }
108 }
double Length()
Definition: abscissa.cpp:75
Bounding box in 3d ambient space.
Definition: bounding_box.hh:45
BoundingBox boundingBox
Definition: abscissa.h:31
void SetPoints(const TPoint &, const TPoint &)
Definition: abscissa.cpp:65
double GetMax(int) const
Definition: abscissa.cpp:102
TPoint * X0
Definition: bisector.h:34
static int numberInstance
Definition: abscissa.h:28
double length
Definition: abscissa.h:33
Definition: point.h:27
void ComputeLength()
Definition: abscissa.cpp:70
BoundingBox & get_bounding_box()
Definition: abscissa.cpp:79
void SetPoints(const TPoint &, const TPoint &)
Definition: bisector.cpp:99
double Get(int) const
Definition: point.cpp:120
int generateId()
Definition: abscissa.cpp:25
TAbscissa & operator=(const TAbscissa &)
Definition: abscissa.cpp:52
double Length() const
Definition: vector.cpp:157
double GetMin(int) const
Definition: abscissa.cpp:93
~TAbscissa()
Definition: abscissa.cpp:62
void Get(double &, double &, double &) const
Definition: vector.cpp:161
TVector * U
Definition: bisector.h:35
void printf(BasicWriter< Char > &w, BasicCStringRef< Char > format, ArgList args)
Definition: printf.h:444