Graphite Version 3
An experimental 3D geometry processing program
Loading...
Searching...
No Matches
mesh_grob_surface_commands.h
Go to the documentation of this file.
1/*
2 * OGF/Graphite: Geometry and Graphics Programming Library + Utilities
3 * Copyright (C) 2000-2009 INRIA - Project ALICE
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 * If you modify this software, you should include a notice giving the
20 * name of the person performing the modification, the date of modification,
21 * and the reason for such modification.
22 *
23 * Contact: Bruno Levy - levy@loria.fr
24 *
25 * Project ALICE
26 * LORIA, INRIA Lorraine,
27 * Campus Scientifique, BP 239
28 * 54506 VANDOEUVRE LES NANCY CEDEX
29 * FRANCE
30 *
31 * Note that the GNU General Public License does not permit incorporating
32 * the Software into proprietary programs.
33 *
34 * As an exception to the GPL, Graphite can be linked with the following
35 * (non-GPL) libraries:
36 * Qt, SuperLU, WildMagic and CGAL
37 */
38
39
40#ifndef H_OGF_MESH_COMMANDS_MESH_GROB_SURFACE_COMMANDS_H
41#define H_OGF_MESH_COMMANDS_MESH_GROB_SURFACE_COMMANDS_H
42
45#include <geogram/parameterization/mesh_atlas_maker.h>
46#include <geogram/parameterization/mesh_segmentation.h>
47
53namespace OGF {
54
58 gom_class MESH_API MeshGrobSurfaceCommands :
59 public MeshGrobCommands {
60
61 public:
62
67
72
73 gom_slots:
74
91 void repair_surface(
92 double epsilon = 1e-6,
93 double min_comp_area = 0.03,
94 double max_hole_area = 1e-3,
95 double max_hole_edges = 2000,
96 double max_degree3_dist = 0.0,
97 bool remove_intersections = false
98 );
99
100 /**********************************************************/
101
109 void merge_vertices(double epsilon = 0.0);
110
111 /**********************************************************/
112
119 void expand_border(double margin=0.05);
120
121 /**********************************************************/
122
129 void fill_holes(index_t max_nb_vertices=0);
130
131
132 /**********************************************************/
133
139
140 /**********************************************************/
141
148 void remove_invisible_facets(double min_visibility = 0.005);
149
150
151 /**********************************************************/
152
181 const NewMeshGrobName& remesh = "remesh",
182 unsigned int nb_points = 30000,
183 double tri_shape_adapt = 1.0,
184 double tri_size_adapt = 0.0,
185 bool adjust = true,
186 double adjust_max_edge_distance = 0.5,
187 double adjust_border_importance = 2.0,
188 unsigned int normal_iter = 3,
189 unsigned int Lloyd_iter = 5,
190 unsigned int Newton_iter = 30,
191 unsigned int Newton_m = 7,
192 unsigned int LFS_samples = 10000
193 );
194
195 /**********************************************************/
196
217 const NewMeshGrobName& remesh = "remesh",
218 unsigned int nb_points = 30000,
219 bool refine = false,
220 double max_dist = 0.5,
221 double normal_anisotropy = 5.0,
222 unsigned int nb_Lloyd_iter = 5,
223 unsigned int nb_Newton_iter = 30,
224 unsigned int nb_LpCVT_iter = 10,
225 unsigned int Newton_m = 7,
226 bool RVC_centroids = false
227 );
228
229 /**********************************************************/
230
242 const NewMeshGrobName& remesh = "remesh",
243 double rel_edge_len = 1.0,
244 bool sharp_features = true,
245 bool optimize_parity = false,
246 double max_scaling_corr = 1.0
247 );
248
249 /**********************************************************/
250
263 const MeshGrobName& other,
264 const NewMeshGrobName& result = "result",
265 bool pre_process=false,
266 bool post_process=false
267 );
268
269
282 const MeshGrobName& other,
283 const NewMeshGrobName& result = "result",
284 bool pre_process=false,
285 bool post_process=false
286 );
287
300 const MeshGrobName& other,
301 const NewMeshGrobName& result = "result",
302 bool pre_process=false,
303 bool post_process=false
304 );
305
318 gom_arg_attribute(operation, handler, "combo_box")
319 gom_arg_attribute(operation, values, "A+B;A*B;A-B;B-A")
320 MeshGrob* compute_boolean_operation(
321 const MeshGrobName& other,
322 const NewMeshGrobName& result = "result",
323 const std::string& operation = "A+B",
324 bool pre_process=false,
325 bool post_process=false
326 );
327
340 void intersect(
341 bool remove_internal_shells = true,
342 bool simplify_coplanar_facets = true,
343 double coplanar_angle_tolerance = 0.001,
344 bool interpolate_attributes = false,
345 bool verbose = false,
346 const NewMeshGrobName& skeleton = ""
347 );
348
349 /**********************************************************/
350
361 void decimate(
362 index_t nb_bins = 100,
363 bool remove_deg3_vrtx = true,
364 bool keep_borders = true,
365 bool repair = true
366 );
367
368 /**********************************************************/
369
376 void split_triangles(index_t nb_times=1);
377
383 void split_quads(index_t nb_times=1);
384
385
392 void split_catmull_clark(index_t nb_times=1);
393
399 void tessellate_facets(index_t max_vertices_per_facet=4);
400
401
406 void triangulate() {
408 }
409
410
417
418
423 void smooth();
424
425 /**********************************************************/
426
427 enum Parameterizer {
428 LSCM, SpectralLSCM, ABFplusplus
429 };
430
437 index_t nb_segments=10
438 );
439
445
451
458 void unglue_sharp_edges(double angle_threshold=90);
459
465 void unglue_charts(const std::string& attrib_name = "chart");
466
482 bool detect_sharp_edges = false,
483 double sharp_edges_threshold = 45.0,
484 ChartParameterizer param=PARAM_ABF,
485 ChartPacker pack=PACK_XATLAS,
486 bool verbose=false
487 );
488
489
496 ChartPacker pack=PACK_XATLAS
497 );
498
509 const std::string& attribute="tex_coord",
510 ChartParameterizer param=PARAM_LSCM,
511 bool verbose=false
512 );
513
527 const MeshGrobName& surface,
528 index_t size=1024,
529 const NewImageFileName& image="normals.png",
530 index_t nb_dilate=2,
531 const std::string& tex_coord="tex_coord"
532 );
533
534
549 const MeshGrobName& surface,
550 const std::string& color="color",
551 index_t size=1024,
552 const NewImageFileName& image="colors.png",
553 index_t nb_dilate=2,
554 const std::string& attribute="tex_coord"
555 );
556
557
575 const MeshGrobName& src_surface,
576 const ImageFileName& src_texture,
577 const std::string& src_tex_coord="tex_coord",
578 index_t size=1024,
579 const NewImageFileName& image="texture.png",
580 index_t nb_dilate=2,
581 const std::string& tex_coord="tex_coord"
582 );
583
584
585 };
586}
587#endif
Base class for Commands related with a MeshGrob object.
Commands that manipulate surface meshes.
~MeshGrobSurfaceCommands() override
MeshGrobSurfaceCommands destructor.
void fill_holes(index_t max_nb_vertices=0)
Fills the holes of the surface.
void triangulate_center_vertex()
Triangulates all the facets by inserting a vertex in the center of each facet.
void unglue_charts(const std::string &attrib_name="chart")
Unglues facet edges adjacent to two different charts.
MeshGrobSurfaceCommands()
MeshGrobSurfaceCommands constructor.
void get_charts()
Gets the charts attribute from a parameterized mesh.
void remove_invisible_facets(double min_visibility=0.005)
Removes all facets that have visibility smaller than a given threshold.
void merge_vertices(double epsilon=0.0)
Merges vertices that are at the same location or within tolerance.
void bake_colors(const MeshGrobName &surface, const std::string &color="color", index_t size=1024, const NewImageFileName &image="colors.png", index_t nb_dilate=2, const std::string &attribute="tex_coord")
Bakes colors from a surface to the texture atlas.
void bake_texture(const MeshGrobName &src_surface, const ImageFileName &src_texture, const std::string &src_tex_coord="tex_coord", index_t size=1024, const NewImageFileName &image="texture.png", index_t nb_dilate=2, const std::string &tex_coord="tex_coord")
Bakes texture from a textured surface to an atlas.
void remove_charts()
Removes the charts attribute.
MeshGrob * compute_union(const MeshGrobName &other, const NewMeshGrobName &result="result", bool pre_process=false, bool post_process=false)
Computes the union between two meshes.
gom_arg_attribute(operation, handler, "combo_box") gom_arg_attribute(operation
Computes a boolean operation between two meshes.
void unglue_sharp_edges(double angle_threshold=90)
Unglues facet edges based on specified angle.
void parameterize_chart(const std::string &attribute="tex_coord", ChartParameterizer param=PARAM_LSCM, bool verbose=false)
Computes texture coordinates of a single unfoldable surface.
void segment(MeshSegmenter segmenter=SEGMENT_GEOMETRIC_VSA_L2, index_t nb_segments=10)
Segments a mesh.
void bake_normals(const MeshGrobName &surface, index_t size=1024, const NewImageFileName &image="normals.png", index_t nb_dilate=2, const std::string &tex_coord="tex_coord")
Bakes normals from a surface to the texture atlas.
void make_texture_atlas(bool detect_sharp_edges=false, double sharp_edges_threshold=45.0, ChartParameterizer param=PARAM_ABF, ChartPacker pack=PACK_XATLAS, bool verbose=false)
Computes texture coordinates of a surface.
MeshGrob * remesh_quad_dominant(const NewMeshGrobName &remesh="remesh", double rel_edge_len=1.0, bool sharp_features=true, bool optimize_parity=false, double max_scaling_corr=1.0)
Generates a quad-dominant mesh.
void pack_texture_space(ChartPacker pack=PACK_XATLAS)
Packs charts in texture space.
MeshGrob * remesh_feature_sensitive(const NewMeshGrobName &remesh="remesh", unsigned int nb_points=30000, bool refine=false, double max_dist=0.5, double normal_anisotropy=5.0, unsigned int nb_Lloyd_iter=5, unsigned int nb_Newton_iter=30, unsigned int nb_LpCVT_iter=10, unsigned int Newton_m=7, bool RVC_centroids=false)
Remeshes a surface that has sharp features.
MeshGrob * compute_difference(const MeshGrobName &other, const NewMeshGrobName &result="result", bool pre_process=false, bool post_process=false)
Computes the difference between two meshes.
void smooth()
Smooths the mesh by optimizing the vertices that are not selected. Selected vertices are locked.
void expand_border(double margin=0.05)
Preprocessing for remesh_feature_sensitive.
MeshGrob * remesh_smooth(const NewMeshGrobName &remesh="remesh", unsigned int nb_points=30000, double tri_shape_adapt=1.0, double tri_size_adapt=0.0, bool adjust=true, double adjust_max_edge_distance=0.5, double adjust_border_importance=2.0, unsigned int normal_iter=3, unsigned int Lloyd_iter=5, unsigned int Newton_iter=30, unsigned int Newton_m=7, unsigned int LFS_samples=10000)
Remeshes a (smooth) surface.
void fix_facets_orientation()
Fixes facets orientation based on computed visibility.
MeshGrob * compute_intersection(const MeshGrobName &other, const NewMeshGrobName &result="result", bool pre_process=false, bool post_process=false)
Computes the intersection between two meshes.
A Grob wrapper around Geogram's Mesh class.
Definition mesh_grob.h:56
A template class for strings that need to have a specific type in the GOM system.
Definition properties.h:218
Base class for Commands related with a MeshGrob object.
ChartParameterizer
Parameterizer used to flatten individual charts.
geo_index_t index_t
The type for storing and manipulating indices.
Definition numeric.h:329
void tessellate_facets(Mesh &M, index_t max_nb_vertices)
Subdivides the facets with more than nb_vertices.
@ SEGMENT_GEOMETRIC_VSA_L2
ChartPacker
Packer used to organize the charts in texture space.
Global Graphite namespace.
Definition common.h:76
Definitions common to all include files in the mesh library.