xc
Triangle3d.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 //Triangle3d.h
22 
23 #ifndef TRIANGLE3D_H
24 #define TRIANGLE3D_H
25 
26 #include "utility/geom/d2/Polygon3d.h"
27 
28 class Plane;
29 class Triangle2d;
30 
32 //
34 class Triangle3d: public Polygon3d
35  {
36  Triangle3d(const Ref2d3d &rf, const Triangle2d &p);
37 
38  inline void push_back(const Pos3d &p)
39  { Polygon3d::push_back(p); }
40  public:
41  Triangle3d(void);
42  Triangle3d(const Pos3d &p1,const Pos3d &p2,const Pos3d &p3);
43 
44  virtual GeomObj *getCopy(void) const
45  { return new Triangle3d(*this); }
46 
47  inline virtual unsigned int getNumVertices(void) const
48  { return 3; }
49  GEOM_FT dist(const Pos3d &p) const;
50  GEOM_FT dist2(const Pos3d &p) const;
51  };
52 
53 #endif
Triangle in a two-dimensional space.
Definition: Triangle2d.h:38
Plane polygon in a 3D space.
Definition: Polygon3d.h:35
GEOM_FT dist(const Pos3d &p) const
Return the distance from the point to the triangle.
Definition: Triangle3d.cc:42
Plane in a three-dimensional space.
Definition: Plane.h:49
Triangle in a three-dimensional space.
Definition: Triangle3d.h:34
Posición en tres dimensiones.
Definition: Pos3d.h:44
GEOM_FT dist2(const Pos3d &p) const
Return the squared distance from the point to the triangle.
Definition: Triangle3d.cc:35
Clase base para las entidades geométricas.
Definition: GeomObj.h:40
Two-dimensional reference system defined in a three-dimensional space.
Definition: Ref2d3d.h:41