xc
Dir3d.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 //Dir3d.h
22 
23 #ifndef DIR3D_H
24 #define DIR3D_H
25 
26 #include "../cgal_types.h"
27 
28 class Vector3d;
29 class FT_matrix;
30 
31 
33 //
35 class Dir3d
36  {
37  CGDirection_3 cgd;
38  public:
39  explicit Dir3d(const CGDirection_3 &d)
40  : cgd(d) {}
41  Dir3d(GEOM_FT x,GEOM_FT y,GEOM_FT z);
42  explicit Dir3d(const Vector3d &v);
43  virtual bool operator==(const Dir3d &) const;
44  bool operator!=(const Dir3d &) const;
45  const CGDirection_3 &ToCGAL(void) const
46  { return cgd; }
47  inline int dimension(void) const
48  { return 3; }
49  void Neg(void)
50  { cgd=-cgd; }
51  inline GEOM_FT operator()(const size_t &i) const
52  { return cgd.delta(i-1); }
53  inline GEOM_FT dx(void) const
54  { return cgd.dx(); }
55  inline GEOM_FT dy(void) const
56  { return cgd.dy(); }
57  inline GEOM_FT dz(void) const
58  { return cgd.dz(); }
59  FT_matrix getMatrix(void) const;
60  Vector3d GetVector(void) const;
61  friend std::ostream &operator << (std::ostream &stream,const Dir3d &n);
62  inline virtual ~Dir3d(void) {}
63  };
64 
65 inline bool parallel(const Dir3d &v1,const Dir3d &v2)
66  { return (v1==v2); }
67 
68 #endif
Vector3d GetVector(void) const
Returns the x, y and z components in a vector.
Definition: Dir3d.cc:60
virtual bool operator==(const Dir3d &) const
Comparison operator.
Definition: Dir3d.cc:37
bool operator!=(const Dir3d &) const
Comparison operator.
Definition: Dir3d.cc:48
Dirección en el espacio de tres dimensiones.
Definition: Dir3d.h:35
friend std::ostream & operator<<(std::ostream &stream, const Dir3d &n)
Insertion into an output stream.
Definition: Dir3d.cc:64
Matrix which components are GEOM_FT numbers.
Definition: FT_matrix.h:40
FT_matrix getMatrix(void) const
Returns the x, y and z components in a row matrix.
Definition: Dir3d.cc:52
Vector en tres dimensiones.
Definition: Vector3d.h:39