Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
extraction_informations_forme_3D
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Astrid Beyer
extraction_informations_forme_3D
Commits
b926d1c4
Commit
b926d1c4
authored
2 years ago
by
Astrid Beyer
Browse files
Options
Downloads
Patches
Plain Diff
feat: gère bien le cas où un obj a besoin d'être triangulé, précise si ce n'est pas possible
parent
fe98a605
No related branches found
No related tags found
No related merge requests found
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
CMakeLists.txt
+1
-1
1 addition, 1 deletion
CMakeLists.txt
isTriangulate.h
+0
-9
0 additions, 9 deletions
isTriangulate.h
main.cpp
+19
-2
19 additions, 2 deletions
main.cpp
triangulate.cpp
+34
-0
34 additions, 0 deletions
triangulate.cpp
triangulate.h
+23
-0
23 additions, 0 deletions
triangulate.h
with
77 additions
and
12 deletions
CMakeLists.txt
+
1
−
1
View file @
b926d1c4
...
@@ -7,7 +7,7 @@ set(CMAKE_CXX_STANDARD 11)
...
@@ -7,7 +7,7 @@ set(CMAKE_CXX_STANDARD 11)
find_package
(
TTKVTK REQUIRED
)
find_package
(
TTKVTK REQUIRED
)
add_executable
(
projet-stage main.cpp
isT
riangulate.cpp
)
add_executable
(
projet-stage main.cpp
t
riangulate.cpp
)
target_link_libraries
(
projet-stage
target_link_libraries
(
projet-stage
PUBLIC
PUBLIC
...
...
This diff is collapsed.
Click to expand it.
isTriangulate.h
deleted
100644 → 0
+
0
−
9
View file @
fe98a605
#ifndef IS_TRIANGULATE_H // Vérification d'inclusion multiple
#define IS_TRIANGULATE_H
namespace
triangulate
{
vtkSmartPointer
<
vtkPolyData
>
buildValidTriangulation
(
vtkSmartPointer
<
vtkPolyData
>
polyData
);
// Prototype de la fonction
}
#endif // Fin de vérification d'inclusion multiple
This diff is collapsed.
Click to expand it.
main.cpp
+
19
−
2
View file @
b926d1c4
/**=========================================================================
* @file main.cpp
*
* @brief This script reads mesh files and translate them in VTKPolyData.
* It calculates the main curvature of the mesh, then the shape index in
* each vertex of the mesh. Generates a Reeb's graph of shape index.
* Finally, it writes the graph in .vtp format and colors the map with
* the shape index of mesh.
*
* @authors Lucie CLERAND, Eve REGA
* Astrid BEYER
*
* @date 2023
* @version 1.0.1
*
=========================================================================**/
#include
<vtkNew.h>
#include
<vtkNew.h>
#include
<vtkSmartPointer.h>
#include
<vtkSmartPointer.h>
#include
<vtkOBJReader.h>
#include
<vtkOBJReader.h>
...
@@ -38,10 +55,11 @@
...
@@ -38,10 +55,11 @@
#include
<vtkAppendPolyData.h>
#include
<vtkAppendPolyData.h>
#include
<vtkSortDataArray.h>
#include
<vtkSortDataArray.h>
#include
"
isT
riangulate.h"
#include
"
t
riangulate.h"
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
{
{
vtkObject
::
GlobalWarningDisplayOff
();
if
(
argc
!=
2
)
if
(
argc
!=
2
)
{
{
std
::
cout
<<
"Required arguments: Filename(.obj)"
<<
std
::
endl
;
std
::
cout
<<
"Required arguments: Filename(.obj)"
<<
std
::
endl
;
...
@@ -60,7 +78,6 @@ int main(int argc, char *argv[])
...
@@ -60,7 +78,6 @@ int main(int argc, char *argv[])
vtkNew
<
vtkOBJReader
>
reader
;
vtkNew
<
vtkOBJReader
>
reader
;
reader
->
SetFileName
(
filename
.
c_str
());
reader
->
SetFileName
(
filename
.
c_str
());
reader
->
Update
();
reader
->
Update
();
source
=
triangulate
::
buildValidTriangulation
(
reader
->
GetOutput
());
source
=
triangulate
::
buildValidTriangulation
(
reader
->
GetOutput
());
}
}
else
else
...
...
This diff is collapsed.
Click to expand it.
isT
riangulate.cpp
→
t
riangulate.cpp
+
34
−
0
View file @
b926d1c4
#include
<vtkTriangleFilter.h>
#include
<vtkTriangleFilter.h>
#include
"
isT
riangulate.h"
#include
"
t
riangulate.h"
// Fonction pour construire une triangulation valide à partir d'un vtkPolyData contenant des quadrilatères
vtkSmartPointer
<
vtkPolyData
>
triangulate
::
buildValidTriangulation
(
vtkSmartPointer
<
vtkPolyData
>
polyData
)
vtkSmartPointer
<
vtkPolyData
>
triangulate
::
buildValidTriangulation
(
vtkSmartPointer
<
vtkPolyData
>
polyData
)
{
{
vtkSmartPointer
<
vtkPolyData
>
triPolyData
=
vtkSmartPointer
<
vtkPolyData
>::
New
();
vtkSmartPointer
<
vtkPolyData
>
triPolyData
=
vtkSmartPointer
<
vtkPolyData
>::
New
();
//
Si le maillage en entrée est composé de quadrilatères, on construit une
triangulation
valide
//
if mesh is composed of quads, builds a valid
triangulation
if
(
polyData
->
GetMaxCellSize
()
>
3
)
if
(
polyData
->
GetMaxCellSize
()
==
4
)
{
{
std
::
cout
<<
"maillage composé de quads"
;
// we're using a vtkQuadToTriangle filter to convert quads in triangles
// On utilise un filtre vtkQuadToTriangle pour convertir les quadrilatères en triangles
vtkSmartPointer
<
vtkTriangleFilter
>
quadToTri
=
vtkSmartPointer
<
vtkTriangleFilter
>::
New
();
vtkSmartPointer
<
vtkTriangleFilter
>
quadToTri
=
vtkSmartPointer
<
vtkTriangleFilter
>::
New
();
quadToTri
->
SetInputData
(
polyData
);
quadToTri
->
SetInputData
(
polyData
);
quadToTri
->
Update
();
quadToTri
->
Update
();
triPolyData
=
quadToTri
->
GetOutput
();
triPolyData
=
quadToTri
->
GetOutput
();
}
}
else
if
(
polyData
->
GetMaxCellSize
()
==
3
)
//
Si le maillage en entrée est déjà triangulé, on renvoie le
vtkPolyData
d'origine
else
if
(
polyData
->
GetMaxCellSize
()
==
3
)
//
if mesh is already triangulated, return origin's
vtkPolyData
{
{
triPolyData
=
polyData
;
triPolyData
=
polyData
;
}
}
else
else
{
{
std
::
cout
<<
"Ce maillage n'est pas géré par ce programme, sont acceptés les maillages triangulés et quadrilatérisés"
;
std
::
cout
<<
"This mesh is not handled by this program, allows only triangulated and quadrilated meshes.
\n
"
;
std
::
cout
<<
"Maximum cell size for this mesh: "
<<
polyData
->
GetMaxCellSize
()
<<
".
\n
"
;
exit
(
0
);
}
}
// adding a vtkTriangleFilter to ensure that the output is a well triangulated mesh
// On ajoute un filtre vtkTriangleFilter pour garantir que la sortie est bien un maillage triangulé
vtkSmartPointer
<
vtkTriangleFilter
>
triangleFilter
=
vtkSmartPointer
<
vtkTriangleFilter
>::
New
();
vtkSmartPointer
<
vtkTriangleFilter
>
triangleFilter
=
vtkSmartPointer
<
vtkTriangleFilter
>::
New
();
triangleFilter
->
SetInputData
(
triPolyData
);
triangleFilter
->
SetInputData
(
triPolyData
);
triangleFilter
->
Update
();
triangleFilter
->
Update
();
...
...
This diff is collapsed.
Click to expand it.
triangulate.h
0 → 100644
+
23
−
0
View file @
b926d1c4
/**
* @class triangulate
*
* @author Astrid BEYER
* @date 2023
* @version 1.1
*
*/
#ifndef TRIANGULATE_H
#define TRIANGULATE_H
namespace
triangulate
{
/**
* @brief buildValidTriangulation : transforms, if necessary, input's polyData so it ensure it's triangulated
* @param polyData
* @returns vtkSmartPointer<vtkPolyData>
*/
vtkSmartPointer
<
vtkPolyData
>
buildValidTriangulation
(
vtkSmartPointer
<
vtkPolyData
>
polyData
);
}
#endif
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment