Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
VTK-CGAL
VESPA
Commits
27e9152a
Commit
27e9152a
authored
May 10, 2022
by
Charles Gueunet
Browse files
Improve Delaunay2
parent
0cd2f2f9
Pipeline
#280514
failed with stages
in 21 minutes
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
vespa/Delaunay/vtkCGALDelaunay2.cxx
View file @
27e9152a
...
...
@@ -12,18 +12,14 @@
#include
<CGAL/Simple_cartesian.h>
#include
<CGAL/Constrained_Delaunay_triangulation_2.h>
using
CGAL_Kernel
=
CGAL
::
Simple_cartesian
<
double
>
;
using
CGAL_Kernel
=
CGAL
::
Simple_cartesian
<
double
>
;
vtkStandardNewMacro
(
vtkCGALDelaunay2
);
using
CGAL_Kernel
=
CGAL
::
Simple_cartesian
<
double
>
;
using
CGAL_Kernel
=
CGAL
::
Simple_cartesian
<
double
>
;
// TODO May try to use ProjectionTraits_3 to handle open 3D surfaces
// Look at perf then
// caution, a sphere won't work: intersection
// caution, infinite loop on some tests
using
Delaunay
=
CGAL
::
Constrained_Delaunay_triangulation_2
<
CGAL_Kernel
>
;
using
CGAL_
Delaunay
=
CGAL
::
Constrained_Delaunay_triangulation_2
<
CGAL_Kernel
>
;
//------------------------------------------------------------------------------
void
vtkCGALDelaunay2
::
PrintSelf
(
ostream
&
os
,
vtkIndent
indent
)
...
...
@@ -75,7 +71,7 @@ int vtkCGALDelaunay2::RequestData(
d3
=
1
;
}
std
::
vector
<
Delaunay
::
Point
>
pts
;
std
::
vector
<
CGAL_
Delaunay
::
Point
>
pts
;
pts
.
reserve
(
nbPts
);
for
(
const
auto
pt
:
pointRange
)
{
...
...
@@ -85,7 +81,7 @@ int vtkCGALDelaunay2::RequestData(
// CGAL Processing
// ---------------
Delaunay
delaunay
;
CGAL_
Delaunay
delaunay
;
try
{
// Add constraints (lines and polys)
...
...
@@ -94,8 +90,8 @@ int vtkCGALDelaunay2::RequestData(
// each poly
for
(
polysIt
->
GoToFirstCell
();
!
polysIt
->
IsDoneWithTraversal
();
polysIt
->
GoToNextCell
())
{
vtkIdList
*
p
=
polysIt
->
GetCurrentCell
();
std
::
list
<
Delaunay
::
Point
>
poly
;
vtkIdList
*
p
=
polysIt
->
GetCurrentCell
();
std
::
list
<
CGAL_
Delaunay
::
Point
>
poly
;
// each segment of poly
for
(
vtkIdType
i
=
0
;
i
<
p
->
GetNumberOfIds
();
i
++
)
{
...
...
@@ -105,7 +101,7 @@ int vtkCGALDelaunay2::RequestData(
{
delaunay
.
insert_constraint
(
poly
.
begin
(),
poly
.
end
(),
true
);
}
catch
(
const
std
::
exception
&
e
)
catch
(
const
CGAL_Delaunay
::
Intersection_of_constraints_
exception
&
e
)
{
// If we have an invalid constraint (for example overlaping edges)
// we just ignore the constraint and continue
...
...
@@ -120,8 +116,8 @@ int vtkCGALDelaunay2::RequestData(
for
(
linesIt
->
GoToFirstCell
();
!
linesIt
->
IsDoneWithTraversal
();
linesIt
->
GoToNextCell
())
{
// each segment of line
vtkIdList
*
l
=
linesIt
->
GetCurrentCell
();
std
::
list
<
Delaunay
::
Point
>
line
;
vtkIdList
*
l
=
linesIt
->
GetCurrentCell
();
std
::
list
<
CGAL_
Delaunay
::
Point
>
line
;
for
(
vtkIdType
i
=
1
;
i
<
l
->
GetNumberOfIds
();
i
++
)
{
line
.
emplace_back
(
pts
[
l
->
GetId
(
i
)]);
...
...
@@ -130,7 +126,7 @@ int vtkCGALDelaunay2::RequestData(
{
delaunay
.
insert_constraint
(
line
.
begin
(),
line
.
end
());
}
catch
(
const
std
::
exception
&
e
)
catch
(
const
CGAL_Delaunay
::
Intersection_of_constraints_
exception
&
e
)
{
// If we have an invalid constraint (for example overlaping edges)
// we just ignore the constraint and continue
...
...
@@ -142,7 +138,7 @@ int vtkCGALDelaunay2::RequestData(
// Add points
for
(
auto
point
:
pts
)
{
delaunay
.
push_back
(
Delaunay
::
Point
(
point
));
delaunay
.
push_back
(
CGAL_
Delaunay
::
Point
(
point
));
}
}
catch
(
std
::
exception
&
e
)
...
...
@@ -157,7 +153,7 @@ int vtkCGALDelaunay2::RequestData(
vtkNew
<
vtkPoints
>
outPts
;
const
vtkIdType
outNPts
=
delaunay
.
number_of_vertices
();
outPts
->
Allocate
(
outNPts
);
std
::
map
<
Delaunay
::
Point
,
vtkIdType
>
vmap
;
std
::
map
<
CGAL_
Delaunay
::
Point
,
vtkIdType
>
vmap
;
for
(
auto
vertex
:
delaunay
.
finite_vertex_handles
())
{
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment