Geogram  Version 1.9.1-rc
A programming library of geometric algorithms
FF.h
1 /*
2  * Copyright (c) 2000-2022 Inria
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright notice,
11  * this list of conditions and the following disclaimer in the documentation
12  * and/or other materials provided with the distribution.
13  * * Neither the name of the ALICE Project-Team nor the names of its
14  * contributors may be used to endorse or promote products derived from this
15  * software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  *
29  * Contact: Bruno Levy
30  *
31  * https://www.inria.fr/fr/bruno-levy
32  *
33  * Inria,
34  * Domaine de Voluceau,
35  * 78150 Le Chesnay - Rocquencourt
36  * FRANCE
37  *
38  */
39 
40 #ifndef H_HEXDOM_ALGO_FF_H
41 #define H_HEXDOM_ALGO_FF_H
42 
44 #include <geogram/mesh/mesh.h>
45 
46 namespace GEO {
47 
48  class FFopt {
49 
50  public:
51  // input object must have B, lockB, U and lockU defined (mandatory)
52  // constructor computes the bidirectional edge graph
53  // and init limits of variables pack (num_l_v and num_ln_v)
54  FFopt(Mesh* p_m);
55  ~FFopt();
56 
62  // FF_init() is use to initialize the FF with http://arxiv.org/abs/1507.03351 (mandatory)
63  void FF_init(bool generate_sh=false);
64 
65  // FF_smooth is to further optimize the FF with http://dl.acm.org/citation.cfm?id=2366196 (optional)
66  void FF_smooth();
67 
68  // size of cols(B,d)
69  void compute_Bid_norm();
70 
71  // brush FF (before solving PGP) and U (after solving PGP) (optional)
72  void brush_frame();
73 
74  // access to the graph to be optimized (either edge or dual edge graph)
75  index_t nb_neigs(index_t s) {
76  index_t start = v2e[s];
77  index_t end = m->edges.nb();
78  if (s + 1 < m->vertices.nb()) end = v2e[s + 1];
79  return end - start;
80  }
81  index_t neig(index_t s, index_t ls) {
82  return m->edges.vertex(ls + v2e[s], 1);
83  }
84 
85  // in/out members
86  Mesh* m;
87  vector<index_t> v2e; // for each vertex, gives the first edge starting on it
88 
89  // vertex ordering
90  index_t num_l_v; // v < num_l_v => the frame of vertex v is locked to rot[v]
91  index_t num_ln_v; // num_l_v < v < num_ln_v => the Z axis rotated by rot[v] should not change
92  };
93 }
94 
95 #endif
Definition: FF.h:48
void FF_init(bool generate_sh=false)
index_t vertex(index_t e, index_t lv) const
Gets the index of an edge vertex.
Definition: mesh.h:637
index_t nb() const
Gets the number of (sub-)elements.
Definition: mesh.h:89
Represents a mesh.
Definition: mesh.h:2693
Included by all headers in exploragram.
The class that represents a mesh.
Global Vorpaline namespace.
Definition: basic.h:55
geo_index_t index_t
The type for storing and manipulating indices.
Definition: numeric.h:329