Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
VTK Examples
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
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
VTK
VTK Examples
Merge requests
!57
Modernising the code, improving images
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Modernising the code, improving images
Modernise_Meshes_1
into
master
Overview
0
Commits
1
Pipelines
0
Changes
44
Merged
Andrew Maclean
requested to merge
Modernise_Meshes_1
into
master
4 years ago
Overview
0
Commits
1
Pipelines
0
Changes
44
Expand
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
b24fde43
1 commit,
4 years ago
44 files
+
539
−
401
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
44
Search (e.g. *.vue) (Ctrl+P)
src/Cxx/Meshes/AddCell.cxx
+
22
−
24
Options
#include
<vtkSmartPointer.h>
#include
<vtkTriangle.h>
#include
<vtkCellArray.h>
#include
<vtkNew.h>
#include
<vtkPolyData.h>
#include
<vtkTriangle.h>
int
main
(
int
,
char
*
[])
int
main
(
int
,
char
*
[])
{
// Create a triangle
vtkSmartPointer
<
vtkPoints
>
points
=
vtkSmartPointer
<
vtkPoints
>::
New
();
points
->
InsertNextPoint
(
1.0
,
0.0
,
0.0
);
points
->
InsertNextPoint
(
0.0
,
0.0
,
0.0
);
points
->
InsertNextPoint
(
0.0
,
1.0
,
0.0
);
vtkSmartPointer
<
vtkTriangle
>
triangle
=
vtkSmartPointer
<
vtkTriangle
>::
New
();
triangle
->
GetPointIds
()
->
SetId
(
0
,
0
);
triangle
->
GetPointIds
()
->
SetId
(
1
,
1
);
triangle
->
GetPointIds
()
->
SetId
(
2
,
2
);
vtkSmartPointer
<
vtkCellArray
>
triangles
=
vtkSmartPointer
<
vtkCellArray
>::
New
();
triangles
->
InsertNextCell
(
triangle
);
vtkNew
<
vtkPoints
>
points
;
points
->
InsertNextPoint
(
1.0
,
0.0
,
0.0
);
points
->
InsertNextPoint
(
0.0
,
0.0
,
0.0
);
points
->
InsertNextPoint
(
0.0
,
1.0
,
0.0
);
vtkNew
<
vtkTriangle
>
triangle
;
triangle
->
GetPointIds
()
->
SetId
(
0
,
0
);
triangle
->
GetPointIds
()
->
SetId
(
1
,
1
);
triangle
->
GetPointIds
()
->
SetId
(
2
,
2
);
vtkNew
<
vtkCellArray
>
triangles
;
triangles
->
InsertNextCell
(
triangle
);
// Create a polydata object
vtkSmartPointer
<
vtkPolyData
>
polyData
=
vtkSmartPointer
<
vtkPolyData
>::
New
();
vtkNew
<
vtkPolyData
>
polyData
;
// Add the geometry and topology to the polydata
polyData
->
SetPoints
(
points
);
polyData
->
SetPolys
(
triangles
);
polyData
->
SetPoints
(
points
);
polyData
->
SetPolys
(
triangles
);
std
::
cout
<<
"There are "
<<
polyData
->
GetNumberOfCells
()
<<
" cells."
<<
std
::
endl
;
std
::
cout
<<
"There are "
<<
polyData
->
GetNumberOfCells
()
<<
" cells."
<<
std
::
endl
;
polyData
->
GetPolys
()
->
InsertNextCell
(
triangle
);
std
::
cout
<<
"There are "
<<
polyData
->
GetNumberOfCells
()
<<
" cells."
<<
std
::
endl
;
std
::
cout
<<
"There are "
<<
polyData
->
GetNumberOfCells
()
<<
" cells."
<<
std
::
endl
;
return
EXIT_SUCCESS
;
}
Loading