xc
Circle3d.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 //Circle2d.h
22 
23 #ifndef CIRCLE3D_H
24 #define CIRCLE3D_H
25 
26 #include "D2to3d.h"
27 #include "Circle2d.h"
28 
29 class Pos3d;
30 class Polygon3d;
31 
33 //
35 class Circle3d : public D2to3d
36  {
37  Circle2d circ;
38  public:
39  Circle3d(void);
40  Circle3d(const Pos3d &,const GEOM_FT &);
41  Circle3d(const GEOM_FT &,const Pos3d &);
42  Circle3d(const Pos3d &,const Pos3d &,const Pos3d &);
43  Circle3d(const Ref2d3d &,const Circle2d &);
44  Circle3d(const Ref3d3d &,const Circle2d &);
45 
46  virtual D2to3d *getCopy(void) const
47  { return new Circle3d(*this); }
48  Pos3d Centro(void) const;
49  virtual Pos3d getCenterOfMass(void) const;
50  GEOM_FT getSquaredRadius(void) const;
51  GEOM_FT getRadius(void) const;
52  GEOM_FT getDiameter(void) const;
53  double getAngle(const Pos3d &p) const;
55  virtual GEOM_FT getLength(void) const
56  { return circ.getLength(); }
58  inline GEOM_FT getPerimeter(void) const
59  { return getLength(); }
61  virtual GEOM_FT getArea(void) const
62  { return circ.getArea(); }
64  virtual GEOM_FT getVolume(void) const
65  { return 0; }
66  virtual GEOM_FT Ix(void) const;
67  virtual GEOM_FT Iy(void) const;
68  virtual GEOM_FT Pxy(void) const;
69  virtual GEOM_FT Iz(void) const;
70 
71  virtual GEOM_FT GetMax(unsigned short int i) const;
72  virtual GEOM_FT GetMin(unsigned short int i) const;
73 
74  virtual bool In(const Pos3d &p, const double &tol= 0.0) const;
75  const Pos3dArray &getPointsOnPerimeter(const size_t &n,const double &theta_inic= 0.0) const;
76  Polygon3d getInscribedPolygon(const size_t &n,const double &theta_inic= 0.0) const;
77 
78  friend bool operator ==(const Circle3d &a,const Circle3d &b);
79 
80 
81  void Print(std::ostream &os) const;
82  };
83 
84 Circle3d Circle3dThreepoints(const Pos3d &,const Pos3d &,const Pos3d &);
85 Vector3d curvature_vector(const Pos3d &,const Pos3d &,const Pos3d &);
86 Vector2d curvature_vector(const Pos2d &,const Pos2d &,const Pos2d &);
87 GEOM_FT curvature_radius(const Pos3d &,const Pos3d &,const Pos3d &);
88 GEOM_FT curvature_radius(const Pos2d &,const Pos2d &,const Pos2d &);
89 GEOM_FT curvature(const Pos3d &,const Pos3d &,const Pos3d &);
90 GEOM_FT curvature(const Pos2d &,const Pos2d &,const Pos2d &);
91 Pos3d circle_center(const Pos3d &,const Pos3d &,const Pos3d &);
92 
93 #endif
94 
95 
96 
virtual GEOM_FT getLength(void) const
Return the length of the object.
Definition: Circle3d.h:55
Plane polygon in a 3D space.
Definition: Polygon3d.h:35
Círculo en dos dimensiones.
Definition: Circle2d.h:37
friend bool operator==(const Circle3d &a, const Circle3d &b)
Equal operator.
Definition: Circle3d.cc:124
Posición en dos dimensiones.
Definition: Pos2d.h:41
Array of positions in a three-dimensional space.
Definition: Pos3dArray.h:38
virtual GEOM_FT getArea(void) const
Return the area of the object.
Definition: Circle3d.h:61
Circle3d(void)
Constructor.
Definition: Circle3d.cc:35
Vector en dos dimensiones.
Definition: Vector2d.h:40
virtual GEOM_FT GetMax(unsigned short int i) const
Return the maximum value of the i-th coordinate.
Definition: Circle3d.cc:86
virtual bool In(const Pos3d &p, const double &tol=0.0) const
Return true if the points is inside the circle.
Definition: Circle3d.cc:98
Polygon3d getInscribedPolygon(const size_t &n, const double &theta_inic=0.0) const
Return the n-gon inscribed int the circle.
Definition: Circle3d.cc:114
Class that places 2D objects (circle, ellipse, polygons, ...) in a 3D space.
Definition: D2to3d.h:44
virtual GEOM_FT GetMin(unsigned short int i) const
Return the minimum value of the i-th coordinate.
Definition: Circle3d.cc:91
const Pos3dArray & getPointsOnPerimeter(const size_t &n, const double &theta_inic=0.0) const
Return n points equally spaced on the object perimeter.
Definition: Circle3d.cc:107
Círculo en tres dimensiones.
Definition: Circle3d.h:35
virtual GEOM_FT getVolume(void) const
Return the volume of the object.
Definition: Circle3d.h:64
Posición en tres dimensiones.
Definition: Pos3d.h:44
GEOM_FT getPerimeter(void) const
Return the perimeter of the object.
Definition: Circle3d.h:58
virtual GEOM_FT getArea(void) const
Return the area of the circle.
Definition: Circle2d.cc:130
Vector en tres dimensiones.
Definition: Vector3d.h:39
Two-dimensional reference system defined in a three-dimensional space.
Definition: Ref2d3d.h:41
virtual GEOM_FT getLength(void) const
Return the length of the círcle.
Definition: Circle2d.cc:127
Three-dimensional reference system defined in a three-dimensional space.
Definition: Ref3d3d.h:39