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
ac6fa7a2
Commit
ac6fa7a2
authored
2 years ago
by
Astrid Beyer
Browse files
Options
Downloads
Patches
Plain Diff
triangulate becomes operation, detection of open surface mesh
parent
71310059
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
CMakeLists.txt
+1
-1
1 addition, 1 deletion
CMakeLists.txt
main.cpp
+5
-4
5 additions, 4 deletions
main.cpp
operation_mesh.cpp
+32
-4
32 additions, 4 deletions
operation_mesh.cpp
operation_mesh.h
+33
-0
33 additions, 0 deletions
operation_mesh.h
with
71 additions
and
9 deletions
CMakeLists.txt
+
1
−
1
View file @
ac6fa7a2
...
@@ -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
triangulate
.cpp vtkOFFReader.cxx
)
add_executable
(
projet-stage main.cpp
operation_mesh
.cpp vtkOFFReader.cxx
)
target_link_libraries
(
projet-stage
target_link_libraries
(
projet-stage
PUBLIC
PUBLIC
...
...
This diff is collapsed.
Click to expand it.
main.cpp
+
5
−
4
View file @
ac6fa7a2
...
@@ -55,7 +55,7 @@
...
@@ -55,7 +55,7 @@
#include
<vtkAppendPolyData.h>
#include
<vtkAppendPolyData.h>
#include
<vtkSortDataArray.h>
#include
<vtkSortDataArray.h>
#include
"
triangulate
.h"
#include
"
operation_mesh
.h"
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
{
{
...
@@ -78,7 +78,8 @@ int main(int argc, char *argv[])
...
@@ -78,7 +78,8 @@ 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
=
operation
::
buildValidTriangulation
(
reader
->
GetOutput
());
vtkSmartPointer
<
vtkPolyData
>
toto
=
operation
::
closeMesh
(
reader
->
GetOutput
());
}
}
else
if
(
extension
==
".off"
)
else
if
(
extension
==
".off"
)
{
{
...
@@ -93,7 +94,7 @@ int main(int argc, char *argv[])
...
@@ -93,7 +94,7 @@ int main(int argc, char *argv[])
return
EXIT_FAILURE
;
return
EXIT_FAILURE
;
}
}
if
(
source
->
GetNumberOfCells
()
>
9
0000
)
// avoid segmentation fault
if
(
source
->
GetNumberOfCells
()
>
10
0000
)
// avoid segmentation fault
{
{
std
::
cerr
<<
"Your mesh has too many polygones ("
<<
source
->
GetNumberOfCells
()
<<
") for this program to run properly.
\n
"
;
std
::
cerr
<<
"Your mesh has too many polygones ("
<<
source
->
GetNumberOfCells
()
<<
") for this program to run properly.
\n
"
;
return
EXIT_FAILURE
;
return
EXIT_FAILURE
;
...
@@ -121,7 +122,7 @@ int main(int argc, char *argv[])
...
@@ -121,7 +122,7 @@ int main(int argc, char *argv[])
vtkNew
<
vtkDoubleArray
>
shapeIndex
;
vtkNew
<
vtkDoubleArray
>
shapeIndex
;
shapeIndex
->
SetName
(
"Shape_Index"
);
shapeIndex
->
SetName
(
"Shape_Index"
);
for
(
vtkIdType
i
=
0
;
i
<
k
1
->
GetNumberOfPoints
();
++
i
)
for
(
vtkIdType
i
=
0
;
i
<
k
2
->
GetNumberOfPoints
();
++
i
)
{
{
double
kmax
=
k1Array
->
GetVariantValue
(
i
).
ToDouble
();
double
kmax
=
k1Array
->
GetVariantValue
(
i
).
ToDouble
();
double
kmin
=
k2Array
->
GetVariantValue
(
i
).
ToDouble
();
double
kmin
=
k2Array
->
GetVariantValue
(
i
).
ToDouble
();
...
...
This diff is collapsed.
Click to expand it.
triangulate
.cpp
→
operation_mesh
.cpp
+
32
−
4
View file @
ac6fa7a2
#include
<vtkTriangleFilter.h>
#include
"operation_mesh.h"
#include
"triangulate.h"
vtkSmartPointer
<
vtkPolyData
>
triangulate
::
buildValidTriangulation
(
vtkSmartPointer
<
vtkPolyData
>
polyData
)
vtkSmartPointer
<
vtkPolyData
>
operation
::
buildValidTriangulation
(
vtkSmartPointer
<
vtkPolyData
>
polyData
)
{
{
vtkSmartPointer
<
vtkPolyData
>
triPolyData
=
vtkSmartPointer
<
vtkPolyData
>::
New
();
vtkSmartPointer
<
vtkPolyData
>
triPolyData
=
vtkSmartPointer
<
vtkPolyData
>::
New
();
...
@@ -32,3 +31,32 @@ vtkSmartPointer<vtkPolyData> triangulate::buildValidTriangulation(vtkSmartPointe
...
@@ -32,3 +31,32 @@ vtkSmartPointer<vtkPolyData> triangulate::buildValidTriangulation(vtkSmartPointe
return
triangleFilter
->
GetOutput
();
return
triangleFilter
->
GetOutput
();
}
}
#include
<vtkSmartPointer.h>
#include
<vtkPolyData.h>
#include
<vtkCellArray.h>
#include
<vtkIdList.h>
#include
<vtkTriangle.h>
#include
<vtkTetra.h>
#include
<vtkCleanPolyData.h>
#include
<vtkFeatureEdges.h>
vtkSmartPointer
<
vtkPolyData
>
operation
::
closeMesh
(
vtkSmartPointer
<
vtkPolyData
>
polyData
)
{
// Check if the input mesh is open
vtkSmartPointer
<
vtkFeatureEdges
>
featureEdges
=
vtkSmartPointer
<
vtkFeatureEdges
>::
New
();
featureEdges
->
SetInputData
(
polyData
);
featureEdges
->
BoundaryEdgesOn
();
featureEdges
->
NonManifoldEdgesOn
();
featureEdges
->
FeatureEdgesOff
();
featureEdges
->
Update
();
vtkSmartPointer
<
vtkPolyData
>
output
=
featureEdges
->
GetOutput
();
int
numOpenEdges
=
output
->
GetNumberOfCells
();
if
(
numOpenEdges
!=
0
)
{
std
::
cout
<<
"There are "
<<
numOpenEdges
<<
" open edges.
\n
"
;
}
else
{
std
::
cout
<<
"There are no open edges.
\n
"
;
}
}
This diff is collapsed.
Click to expand it.
triangulate
.h
→
operation_mesh
.h
+
33
−
0
View file @
ac6fa7a2
/**
/**
* @class
triangulate
* @class
operation_mesh
*
*
* @author Astrid BEYER
* @author Astrid BEYER
* @date 2023
* @date 2023
* @version 1.
1
* @version 1.
0
*
*
*/
*/
#ifndef
TRIANGULATE
_H
#ifndef
OPERATION_MESH
_H
#define
TRIANGULATE
_H
#define
OPERATION_MESH
_H
namespace
triangulate
#include
<vtkTriangleFilter.h>
namespace
operation
{
{
/**
/**
* @brief buildValidTriangulation : transforms, if necessary, input's polyData so it ensure it's triangulated
* @brief buildValidTriangulation : transforms, if necessary, input's polyData so it ensure it's triangulated
...
@@ -18,6 +21,13 @@ namespace triangulate
...
@@ -18,6 +21,13 @@ namespace triangulate
* @returns vtkSmartPointer<vtkPolyData>
* @returns vtkSmartPointer<vtkPolyData>
*/
*/
vtkSmartPointer
<
vtkPolyData
>
buildValidTriangulation
(
vtkSmartPointer
<
vtkPolyData
>
polyData
);
vtkSmartPointer
<
vtkPolyData
>
buildValidTriangulation
(
vtkSmartPointer
<
vtkPolyData
>
polyData
);
/**
* @brief closeMesh : close the surface of the mesh, if necessary
* @param polyData
* @returns vtkSmartPointer<vtkPolyData>
*/
vtkSmartPointer
<
vtkPolyData
>
closeMesh
(
vtkSmartPointer
<
vtkPolyData
>
polyData
);
}
}
#endif
#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