Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jonathan Lambrechts
seamsh
Commits
02f5c70c
Commit
02f5c70c
authored
Oct 15, 2021
by
Jonathan Lambrechts
Browse files
std::Vertices*> -> Vertex**
parent
2ffd9142
Changes
1
Hide whitespace changes
Inline
Side-by-side
seamshlib/polymesh.cc
View file @
02f5c70c
...
...
@@ -72,13 +72,16 @@ Face *face_new(HalfEdge *e) {
class
PolyMesh
{
public:
std
::
vector
<
Vertex
*
>
vertices
;
Vertex
*
*
vertices
;
HalfEdge
**
hedges
;
Face
**
faces
;
void
reset
()
{
for
(
auto
it
:
vertices
)
delete
it
;
for
(
size_t
i
=
0
;
i
<
vector_size
(
vertices
);
++
i
)
{
free
((
void
*
)
vertices
[
i
]);
}
vector_free
(
vertices
);
for
(
size_t
i
=
0
;
i
<
vector_size
(
hedges
);
++
i
)
{
free
((
void
*
)
hedges
[
i
]);
}
...
...
@@ -92,6 +95,7 @@ public:
PolyMesh
()
{
faces
=
NULL
;
hedges
=
NULL
;
vertices
=
NULL
;
}
~
PolyMesh
()
{
reset
();
}
...
...
@@ -226,13 +230,15 @@ public:
void
cleanv
()
{
std
::
vector
<
Vertex
*>
uv
;
for
(
auto
v
:
vertices
)
{
Vertex
**
uv
=
NULL
;
for
(
size_t
i
=
0
;
i
<
vector_size
(
vertices
);
++
i
)
{
Vertex
*
v
=
vertices
[
i
];
if
(
v
->
he
)
uv
.
push_back
(
v
)
;
*
vector_push
(
&
uv
)
=
v
;
else
delete
v
;
free
(
v
)
;
}
vector_free
(
vertices
);
vertices
=
uv
;
}
...
...
@@ -246,6 +252,7 @@ public:
else
free
(
h
);
}
vector_free
(
hedges
);
hedges
=
uh
;
}
...
...
@@ -259,6 +266,7 @@ public:
else
free
(
f
);
}
vector_free
(
faces
);
faces
=
uf
;
}
...
...
@@ -275,7 +283,7 @@ public:
if
(
he1m
==
nullptr
)
return
-
1
;
Vertex
*
mid
=
vertex_new
(
position
[
0
],
position
[
1
],
data
);
ve
rtices
.
push_back
(
mid
)
;
*
ve
ctor_push
(
&
vertices
)
=
mid
;
HalfEdge
*
he12
=
he0m
->
next
;
HalfEdge
*
he20
=
he0m
->
next
->
next
;
...
...
@@ -346,13 +354,13 @@ public:
{
reset
();
Vertex
*
v_mm
=
vertex_new
(
xmin
,
ymin
,
-
1
);
ve
rtices
.
push_back
(
v_mm
)
;
*
ve
ctor_push
(
&
vertices
)
=
v_mm
;
Vertex
*
v_mM
=
vertex_new
(
xmin
,
ymax
,
-
1
);
ve
rtices
.
push_back
(
v_mM
)
;
*
ve
ctor_push
(
&
vertices
)
=
v_mM
;
Vertex
*
v_MM
=
vertex_new
(
xmax
,
ymax
,
-
1
);
ve
rtices
.
push_back
(
v_MM
)
;
*
ve
ctor_push
(
&
vertices
)
=
v_MM
;
Vertex
*
v_Mm
=
vertex_new
(
xmax
,
ymin
,
-
1
);
ve
rtices
.
push_back
(
v_Mm
)
;
*
ve
ctor_push
(
&
vertices
)
=
v_Mm
;
HalfEdge
*
mm_MM
=
half_edge_new
(
v_mm
);
HalfEdge
*
MM_Mm
=
half_edge_new
(
v_MM
);
HalfEdge
*
Mm_mm
=
half_edge_new
(
v_Mm
);
...
...
@@ -383,7 +391,7 @@ public:
std
::
vector
<
HalfEdge
*>
*
_t
=
NULL
)
{
Vertex
*
v
=
vertex_new
(
x
,
y
,
-
1
);
// one more vertex
ve
rtices
.
push_back
(
v
)
;
*
ve
ctor_push
(
&
vertices
)
=
v
;
HalfEdge
*
he0
=
f
->
he
;
HalfEdge
*
he1
=
he0
->
next
;
...
...
@@ -686,6 +694,6 @@ void polymesh_add_points(PolyMesh *pm, int n, double *x, int *tags)
size_t
I
=
IND
[
i
];
f
=
Walk
(
f
,
x
[
I
*
2
],
x
[
I
*
2
+
1
]);
pm
->
split_triangle
(
i
,
x
[
I
*
2
],
x
[
I
*
2
+
1
],
f
,
delaunayEdgeCriterionPlaneIsotropic
,
nullptr
);
pm
->
vertices
[
pm
->
vertices
.
size
(
)
-
1
]
->
data
=
tags
[
I
];
pm
->
vertices
[
vector_size
(
pm
->
vertices
)
-
1
]
->
data
=
tags
[
I
];
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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