| Line | Branch | Exec | Source |
|---|---|---|---|
| 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 | |||
| 41 | #ifndef H_HEXDOM_ALGO_PGP_OPT_H | ||
| 42 | #define H_HEXDOM_ALGO_PGP_OPT_H | ||
| 43 | |||
| 44 | #include <exploragram/basic/common.h> | ||
| 45 | #include <exploragram/hexdom/basic.h> | ||
| 46 | #include <geogram/mesh/mesh.h> | ||
| 47 | |||
| 48 | |||
| 49 | namespace GEO { | ||
| 50 | |||
| 51 | class EXPLORAGRAM_API PGPopt { | ||
| 52 | public: | ||
| 53 | |||
| 54 | // what we need to create the parametric space U | ||
| 55 | PGPopt(Mesh* p_m); | ||
| 56 | |||
| 57 | void optimize_corr(double max_corr_prop = .35); | ||
| 58 | void optimize_PGP(); | ||
| 59 | |||
| 60 | |||
| 61 | vec3 wish_angle_edge_geom(index_t e, bool inv); | ||
| 62 | vec3 wish_angle_corr(index_t e, bool inv); | ||
| 63 | vec3 wish_angle(index_t e, bool inv); | ||
| 64 | bool is_PGP_singular(index_t c, index_t lf); | ||
| 65 | |||
| 66 | bool face_is_resp(index_t c, index_t lf); | ||
| 67 | |||
| 68 | |||
| 69 | bool tet_is_PGP_singular_fct(index_t t); | ||
| 70 | |||
| 71 | |||
| 72 | //// cubecover | ||
| 73 | //index_t get_the_only_non_zero_lc(index_t c, index_t cf, Attribute<index_t>& CCedgeid); | ||
| 74 | //index_t number_edges_on_cut_graph(Attribute<index_t>& CCedgeid); | ||
| 75 | index_t get_non_nulledge(index_t c, index_t cf, Attribute<bool>& nulledge); | ||
| 76 | void mark_null_edges(Attribute<bool>& nulledge); | ||
| 77 | |||
| 78 | //bool constraint_boundary is set to false only to compute the correction one form | ||
| 79 | void cubcover(bool compute_only_corr =false); | ||
| 80 | void grow_ball(Attribute<bool>& tet_in_ball); | ||
| 81 | void grow_triangle_ball(vector<bool>& tetface_in_ball); | ||
| 82 | |||
| 83 | |||
| 84 | |||
| 85 | ✗ | index_t edge_from_vertices(index_t v0, index_t v1, bool &inv) { | |
| 86 | ✗ | inv = v0 > v1; | |
| 87 | ✗ | if (inv) std::swap(v0, v1); | |
| 88 | |||
| 89 | ✗ | index_t start = v2e[v0]; | |
| 90 | ✗ | index_t end = v0 < m->vertices.nb() - 1 ? v2e[v0 + 1] : m->edges.nb(); | |
| 91 | ✗ | for (index_t e = start; e < end; e++) { | |
| 92 | ✗ | if (m->edges.vertex(e, 1) == v1) return e; | |
| 93 | } | ||
| 94 | ✗ | geo_assert_not_reached; | |
| 95 | |||
| 96 | } | ||
| 97 | |||
| 98 | void move_U_to_corner(); | ||
| 99 | |||
| 100 | /* | ||
| 101 | void snap_U_to_round(double eps = 0.05) { | ||
| 102 | return; | ||
| 103 | FOR(v, m->vertices.nb()) FOR(d, 3) { | ||
| 104 | if (std::abs(U[v][d] - round(U[v][d])) < eps) { | ||
| 105 | U[v][d] = round(U[v][d]); | ||
| 106 | } | ||
| 107 | } | ||
| 108 | } | ||
| 109 | */ | ||
| 110 | |||
| 111 | |||
| 112 | |||
| 113 | Mesh* m; | ||
| 114 | Attribute<vec3> U; | ||
| 115 | Attribute<mat3> B; | ||
| 116 | |||
| 117 | // A PGP solution is not only a mesh + attrib: it also requires these datas | ||
| 118 | |||
| 119 | Attribute<vec3> corr; | ||
| 120 | //Attribute<vec3i> tij; | ||
| 121 | Attribute<vec3> tij; | ||
| 122 | |||
| 123 | vector<index_t> v2e; | ||
| 124 | vector<vector<index_t> > v2eopp; | ||
| 125 | }; | ||
| 126 | |||
| 127 | } | ||
| 128 | #endif | ||
| 129 |