xc
Trihedron.h
1 // -*-c++-*-
2 //----------------------------------------------------------------------------
3 // xc utils library; general purpose classes and functions.
4 //
5 // Copyright (C) Luis C. Pérez Tato
6 //
7 // XC utils is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // This software is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program.
19 // If not, see <http://www.gnu.org/licenses/>.
20 //----------------------------------------------------------------------------
21 //Trihedron.h
22 
23 #ifndef TRIHEDRON_H
24 #define TRIHEDRON_H
25 
26 #include "../d3/GeomObj3d.h"
27 #include "utility/geom/pos_vec/Pos3d.h"
28 #include "utility/geom/d2/Triangle3d.h"
29 
30 class Plane;
31 class Polyhedron3d;
32 
34 //
37 class Trihedron: public GeomObj3d
38  {
39  Pos3d p0;
40  Triangle3d tr;
41  protected:
42  Plane get_plane(const size_t &i) const;
43  public:
44  Trihedron(void);
45  Trihedron(const Pos3d &p0, const Pos3d &p1,const Pos3d &p2, const Pos3d &p3);
46  Trihedron(const Pos3d &p0, const Triangle3d &tr);
47  virtual GeomObj *getCopy(void) const
48  { return new Trihedron(*this); }
49  ~Trihedron(void) {}
50  void Put( const Pos3d &p0, const Pos3d &p1,
51  const Pos3d &p2, const Pos3d &p3);
52  void Put(const Pos3d &p0, const Triangle3d &tr);
53  inline virtual unsigned int getNumVertices(void) const
54  { return 4; }
55  inline virtual unsigned int getNumVerticesFaceta(unsigned int faceta) const
56  { return 3; }
57  inline virtual unsigned int getNumEdges(void) const
58  { return 3; }
59  inline virtual unsigned int GetNumFacetas(void) const
60  { return 3; }
62  inline virtual GEOM_FT getLength(void) const
63  { return 0.0; }
65  virtual GEOM_FT getArea(void) const
66  { return NAN; }
68  virtual GEOM_FT getVolume(void) const
69  { return NAN; }
70  virtual GEOM_FT Ix(void) const
71  { return NAN; }
72  virtual GEOM_FT Iy(void) const
73  { return NAN; }
74  virtual GEOM_FT Iz(void) const
75  { return NAN; }
76  short unsigned int Dimension() const
77  { return 3; }
78  GEOM_FT GetMax(short unsigned int) const;
79  GEOM_FT GetMin(short unsigned int) const;
80  Pos3d getCenterOfMass() const;
81  bool TocaCuadrante(const int &) const;
82 
83  const Triangle3d &Base(void) const;
84  const Pos3d &Cuspide(void) const;
85  Line3d Axis(void) const;
86  GEOM_FT getConeHalfAngle(void) const;
87 
88  Polyhedron3d getPolyhedron3d(void) const;
89  Pos3d Vertice(const size_t &i) const;
90  virtual GEOM_FT PseudoDist(const Pos3d &p) const;
91  virtual bool In(const Pos3d &p,const double &tol= 0.0) const;
92 
93  void Print(std::ostream &os) const;
94  };
95 
96 
97 #endif
98 
99 
100 
GEOM_FT getConeHalfAngle(void) const
Return the angle of the cone that has the same apex and contains the trihedron.
Definition: Trihedron.cc:65
virtual GEOM_FT PseudoDist(const Pos3d &p) const
Return the SIGNED distance from the point to the trihedron.
Definition: Trihedron.cc:86
virtual GEOM_FT getArea(void) const
Return the object area.
Definition: Trihedron.h:65
Base class for polyhedrons in a three-dimensional space.
Definition: Polyhedron3d.h:41
bool TocaCuadrante(const int &) const
Return true if any vertex touches the quadrant argument.
Definition: Trihedron.cc:154
Line3d Axis(void) const
Return the straight line that passes through the trihedron apex.
Definition: Trihedron.cc:60
Plane in a three-dimensional space.
Definition: Plane.h:49
Triangle in a three-dimensional space.
Definition: Triangle3d.h:34
short unsigned int Dimension() const
Return the dimension of the object 0, 1, 2 or 3.
Definition: Trihedron.h:76
const Triangle3d & Base(void) const
Return the triangle that is the trihedron base.
Definition: Trihedron.cc:51
Posición en tres dimensiones.
Definition: Pos3d.h:44
Line in a three-dimensional space.
Definition: Line3d.h:62
A geometric figure composed of three planes meeting at a single vertex.
Definition: Trihedron.h:37
virtual GEOM_FT getLength(void) const
Return the length of the object.
Definition: Trihedron.h:62
virtual GEOM_FT getVolume(void) const
Return the volume of the object.
Definition: Trihedron.h:68
const Pos3d & Cuspide(void) const
Return the trihedron apex.
Definition: Trihedron.cc:55
Clase base para las entidades geométricas.
Definition: GeomObj.h:40
virtual bool In(const Pos3d &p, const double &tol=0.0) const
Return true if the point is inside the thriedron.
Definition: Trihedron.cc:102
Clase base para los objetos en tres dimensiones.
Definition: GeomObj3d.h:43