NCBI C++ ToolKit
tri_perimeter.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef GUI_UTILS__TRI_PERIMETER_HPP
2 #define GUI_UTILS__TRI_PERIMETER_HPP
3 
4 /* $Id: tri_perimeter.hpp 44300 2019-11-25 19:10:32Z evgeniev $
5  * ===========================================================================
6  *
7  * PUBLIC DOMAIN NOTICE
8  * National Center for Biotechnology Information
9  *
10  * This software/database is a "United States Government Work" under the
11  * terms of the United States Copyright Act. It was written as part of
12  * the author's official duties as a United States Government employee and
13  * thus cannot be copyrighted. This software/database is freely available
14  * to the public for use. The National Library of Medicine and the U.S.
15  * Government have not placed any restriction on its use or reproduction.
16  *
17  * Although all reasonable efforts have been taken to ensure the accuracy
18  * and reliability of the software and data, the NLM and the U.S.
19  * Government do not and cannot warrant the performance or results that
20  * may be obtained by using this software or data. The NLM and the U.S.
21  * Government disclaim all warranties, express or implied, including
22  * warranties of performance, merchantability or fitness for any particular
23  * purpose.
24  *
25  * Please cite the author in any work or product based on this material.
26  *
27  * ===========================================================================
28  *
29  * Authors: Peter Meric, Bob Falk
30  *
31  * File Description:
32  * Helper class to extract a single perimeter from a bunch of triangles
33  *
34  */
35 
36 #include <corelib/ncbistd.hpp>
37 #include <gui/gui.hpp>
38 #include <gui/utils/vect2.hpp>
39 #include <gui/utils/vect3.hpp>
40 
42 
43 ///
44 /// Simple helper class to take a bunch of triangles and extract from
45 /// that set, if possible, a single perimeter. If the triangle set happens
46 /// to have no perimeters or multiple perimeters, nothing will be returned.
48 {
49 public:
50  size_t AddTri(CVect2<float>& v1p, CVect2<float>& v2p, CVect2<float>& v3p);
51  size_t AddVertex(CVect2<float>& v);
52  size_t AddEdge(size_t vert1, size_t vert2);
53  /// returns empty vec if no perimeter can be found.
54  std::vector<CVect2<float> > GetPerimiter() const;
55 
56  void Clear()
57  {
58  m_Vertices.clear();
59  m_Edges.clear();
60  m_Triangles.clear();
61  };
62 protected:
63  std::vector<CVect2<float> > m_Vertices;
64  std::vector<CVect2<size_t> > m_Edges;
65  std::vector<CVect3<size_t> > m_Triangles;
66 };
67 
69 
70 #endif // GUI_UTILS__VBO_TRI_PERIMETER_HPP
Simple helper class to take a bunch of triangles and extract from that set, if possible,...
std::vector< CVect3< size_t > > m_Triangles
std::vector< CVect2< float > > m_Vertices
std::vector< CVect2< size_t > > m_Edges
Include a standard set of the NCBI C++ Toolkit most basic headers.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define NCBI_GUIOPENGL_EXPORT
Definition: gui_export.h:514
Modified on Tue May 28 05:52:30 2024 by modify_doxy.py rev. 669887