NeoPZ
pzline.cpp
Go to the documentation of this file.
1 
6 #include "pzfunction.h"
7 
8 #include "pznumeric.h"
9 #include "pzline.h"
10 #include <iostream>
11 #include <numeric>
12 #include <assert.h>
13 
14 using namespace std;
15 
16 TPZLine::TPZLine():fPoint(3, 0.0), fDirection(3,1.0){
17  fTolerance = 0.0001;
18 }
19 
21 }
22 
24 void TPZLine::SetLine(const TPZVec<REAL> &point, const TPZVec<REAL> &dir){
25  assert(point.NElements()==3 && dir.NElements()==3);
26  fPoint = point;
27  fDirection = dir;
28 }
29 
31 bool TPZLine::Belongs(const TPZVec<REAL> &point){
32  assert(point.NElements()==3);
33  int i;
34  TPZVec<REAL> vetor(3);
35  REAL norma;
36  vetor = point;
37  //Calculando o vetor deslocamento, do point ao fPoint
38  for(i=0; i<3; i++){
39  vetor[i]= (fPoint[i] - vetor[i]);
40  }
42  norma = inner_product(&vetor[0], &vetor[3], &vetor[0], REAL(0.0));
43  if (norma < fTolerance) return true;
44  else return false;
45 }
46 
48 void TPZLine::SetTolerance(const REAL &tol){
49  fTolerance = tol;
50 }
51 
54  return fTolerance;
55 }
56 
TPZVec< REAL > fPoint
Any point belongs at the line.
Definition: pzline.h:37
REAL GetTolerance()
Returns the tolerance value considered to compute.
Definition: pzline.cpp:53
REAL fTolerance
Tolerance value to computes.
Definition: pzline.h:43
void SetLine(const TPZVec< REAL > &point, const TPZVec< REAL > &dir)
Store a point and direction vector of the line.
Definition: pzline.cpp:24
Contains declaration of the TPZLine class which implements a line.
static void ProdVetorial(TPZVec< Tvar > &u, TPZVec< Tvar > &v, TPZVec< Tvar > &result)
Computes the vectorial product u x v.
Definition: pznumeric.cpp:96
static const double tol
Definition: pzgeoprism.cpp:23
TPZLine()
Definition: pzline.cpp:16
bool Belongs(const TPZVec< REAL > &point)
Verify whether the point belongs at the line.
Definition: pzline.cpp:31
~TPZLine()
Definition: pzline.cpp:20
int64_t NElements() const
Returns the number of elements of the vector.
Definition: pzvec.h:190
TPZVec< REAL > fDirection
Vector direction of the line.
Definition: pzline.h:40
Contains declaration of the TPZNumeric class which implements several methods to calculation.
void SetTolerance(const REAL &tol)
Sets the tolerance value to compute.
Definition: pzline.cpp:48