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
Philip Trettner
polymesh
Commits
e4c7c8b6
Commit
e4c7c8b6
authored
Jun 25, 2018
by
Philip Trettner
Browse files
added missing inline keywords
parent
4175cad3
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/polymesh/Mesh.hh
View file @
e4c7c8b6
...
...
@@ -286,7 +286,7 @@ private:
/// ======== IMPLEMENTATION ========
vertex_index
Mesh
::
add_vertex
()
inline
vertex_index
Mesh
::
add_vertex
()
{
/// TODO: properties
...
...
@@ -295,7 +295,7 @@ vertex_index Mesh::add_vertex()
return
idx
;
}
face_index
Mesh
::
add_face
(
const
vertex_handle
*
v_handles
,
size_t
vcnt
)
inline
face_index
Mesh
::
add_face
(
const
vertex_handle
*
v_handles
,
size_t
vcnt
)
{
mFaceInsertCache
.
resize
(
vcnt
);
for
(
auto
i
=
0u
;
i
<
vcnt
;
++
i
)
...
...
@@ -303,7 +303,7 @@ face_index Mesh::add_face(const vertex_handle *v_handles, size_t vcnt)
return
add_face
(
mFaceInsertCache
.
data
(),
vcnt
);
}
face_index
Mesh
::
add_face
(
const
vertex_index
*
v_indices
,
size_t
vcnt
)
inline
face_index
Mesh
::
add_face
(
const
vertex_index
*
v_indices
,
size_t
vcnt
)
{
mFaceInsertCache
.
resize
(
vcnt
);
for
(
auto
i
=
0u
;
i
<
vcnt
;
++
i
)
...
...
@@ -311,7 +311,7 @@ face_index Mesh::add_face(const vertex_index *v_indices, size_t vcnt)
return
add_face
(
mFaceInsertCache
.
data
(),
vcnt
);
}
face_index
Mesh
::
add_face
(
const
halfedge_handle
*
half_loop
,
size_t
vcnt
)
inline
face_index
Mesh
::
add_face
(
const
halfedge_handle
*
half_loop
,
size_t
vcnt
)
{
mFaceInsertCache
.
resize
(
vcnt
);
for
(
auto
i
=
0u
;
i
<
vcnt
;
++
i
)
...
...
@@ -319,7 +319,7 @@ face_index Mesh::add_face(const halfedge_handle *half_loop, size_t vcnt)
return
add_face
(
mFaceInsertCache
.
data
(),
vcnt
);
}
face_index
Mesh
::
add_face
(
const
halfedge_index
*
half_loop
,
size_t
vcnt
)
inline
face_index
Mesh
::
add_face
(
const
halfedge_index
*
half_loop
,
size_t
vcnt
)
{
assert
(
vcnt
>=
3
&&
"no support for less-than-triangular faces"
);
/// TODO: properties
...
...
@@ -352,7 +352,7 @@ face_index Mesh::add_face(const halfedge_index *half_loop, size_t vcnt)
return
fidx
;
}
edge_index
Mesh
::
add_or_get_edge
(
vertex_index
v_from
,
vertex_index
v_to
)
inline
edge_index
Mesh
::
add_or_get_edge
(
vertex_index
v_from
,
vertex_index
v_to
)
{
assert
(
v_from
!=
v_to
);
...
...
@@ -420,7 +420,7 @@ edge_index Mesh::add_or_get_edge(vertex_index v_from, vertex_index v_to)
return
eidx
;
}
halfedge_index
Mesh
::
add_or_get_halfedge
(
vertex_index
v_from
,
vertex_index
v_to
)
inline
halfedge_index
Mesh
::
add_or_get_halfedge
(
vertex_index
v_from
,
vertex_index
v_to
)
{
auto
e
=
add_or_get_edge
(
v_from
,
v_to
);
auto
h0
=
halfedge_of
(
e
,
0
);
...
...
@@ -428,7 +428,7 @@ halfedge_index Mesh::add_or_get_halfedge(vertex_index v_from, vertex_index v_to)
return
mHalfedges
[
h0
.
value
].
to_vertex
==
v_to
?
h0
:
h1
;
}
void
Mesh
::
make_adjacent
(
halfedge_index
he_in
,
halfedge_index
he_out
)
inline
void
Mesh
::
make_adjacent
(
halfedge_index
he_in
,
halfedge_index
he_out
)
{
// see http://kaba.hilvi.org/homepage/blog/halfedge/halfedge.htm ::makeAdjacent
auto
&
in
=
mHalfedges
[
he_in
.
value
];
...
...
@@ -463,7 +463,7 @@ void Mesh::make_adjacent(halfedge_index he_in, halfedge_index he_out)
h
.
prev_halfedge
=
he_d
;
}
halfedge_index
Mesh
::
find_free_incident
(
halfedge_index
in_begin
,
halfedge_index
in_end
)
const
inline
halfedge_index
Mesh
::
find_free_incident
(
halfedge_index
in_begin
,
halfedge_index
in_end
)
const
{
assert
(
mHalfedges
[
in_begin
.
value
].
to_vertex
==
mHalfedges
[
in_end
.
value
].
to_vertex
);
...
...
@@ -484,13 +484,13 @@ halfedge_index Mesh::find_free_incident(halfedge_index in_begin, halfedge_index
return
halfedge_index
::
invalid
();
}
halfedge_index
Mesh
::
find_free_incident
(
vertex_index
v
)
const
inline
halfedge_index
Mesh
::
find_free_incident
(
vertex_index
v
)
const
{
auto
in_begin
=
opposite
(
mVertices
[
v
.
value
].
outgoing_halfedge
);
return
find_free_incident
(
in_begin
,
in_begin
);
}
halfedge_index
Mesh
::
find_halfedge
(
vertex_index
from
,
vertex_index
to
)
const
inline
halfedge_index
Mesh
::
find_halfedge
(
vertex_index
from
,
vertex_index
to
)
const
{
auto
he_begin
=
mVertices
[
from
.
value
].
outgoing_halfedge
;
if
(
!
he_begin
.
is_valid
())
...
...
@@ -513,23 +513,23 @@ halfedge_index Mesh::find_halfedge(vertex_index from, vertex_index to) const
return
halfedge_index
::
invalid
();
// not found
}
bool
Mesh
::
is_boundary
(
vertex_index
idx
)
const
inline
bool
Mesh
::
is_boundary
(
vertex_index
idx
)
const
{
auto
const
&
v
=
mVertices
[
idx
.
value
];
return
v
.
outgoing_halfedge
.
is_valid
()
&&
is_boundary
(
v
.
outgoing_halfedge
);
}
bool
Mesh
::
is_boundary
(
halfedge_index
idx
)
const
inline
bool
Mesh
::
is_boundary
(
halfedge_index
idx
)
const
{
return
mHalfedges
[
idx
.
value
].
is_free
();
}
halfedge_index
Mesh
::
opposite
(
halfedge_index
he
)
const
inline
halfedge_index
Mesh
::
opposite
(
halfedge_index
he
)
const
{
return
halfedge_index
(
he
.
value
^
1
);
}
vertex_index
Mesh
::
next_valid_idx_from
(
vertex_index
idx
)
const
inline
vertex_index
Mesh
::
next_valid_idx_from
(
vertex_index
idx
)
const
{
for
(
auto
i
=
idx
.
value
;
i
<
(
int
)
mVertices
.
size
();
++
i
)
if
(
mVertices
[
i
].
is_valid
())
...
...
@@ -537,7 +537,7 @@ vertex_index Mesh::next_valid_idx_from(vertex_index idx) const
return
vertex_index
(
mVertices
.
size
());
// end index
}
vertex_index
Mesh
::
prev_valid_idx_from
(
vertex_index
idx
)
const
inline
vertex_index
Mesh
::
prev_valid_idx_from
(
vertex_index
idx
)
const
{
for
(
auto
i
=
idx
.
value
;
i
>=
0
;
--
i
)
if
(
mVertices
[
i
].
is_valid
())
...
...
@@ -545,7 +545,7 @@ vertex_index Mesh::prev_valid_idx_from(vertex_index idx) const
return
{};
// invalid
}
edge_index
Mesh
::
next_valid_idx_from
(
edge_index
idx
)
const
inline
edge_index
Mesh
::
next_valid_idx_from
(
edge_index
idx
)
const
{
for
(
auto
i
=
idx
.
value
<<
1
;
i
<
(
int
)
mHalfedges
.
size
();
i
+=
2
)
if
(
mHalfedges
[
i
].
is_valid
())
...
...
@@ -553,7 +553,7 @@ edge_index Mesh::next_valid_idx_from(edge_index idx) const
return
edge_index
(
mHalfedges
.
size
()
>>
1
);
// end index
}
edge_index
Mesh
::
prev_valid_idx_from
(
edge_index
idx
)
const
inline
edge_index
Mesh
::
prev_valid_idx_from
(
edge_index
idx
)
const
{
for
(
auto
i
=
idx
.
value
<<
1
;
i
>=
0
;
i
-=
2
)
if
(
mHalfedges
[
i
].
is_valid
())
...
...
@@ -561,7 +561,7 @@ edge_index Mesh::prev_valid_idx_from(edge_index idx) const
return
{};
// invalid
}
face_index
Mesh
::
next_valid_idx_from
(
face_index
idx
)
const
inline
face_index
Mesh
::
next_valid_idx_from
(
face_index
idx
)
const
{
for
(
auto
i
=
idx
.
value
;
i
<
(
int
)
mFaces
.
size
();
++
i
)
if
(
mFaces
[
i
].
is_valid
())
...
...
@@ -569,7 +569,7 @@ face_index Mesh::next_valid_idx_from(face_index idx) const
return
face_index
(
mFaces
.
size
());
// end index
}
face_index
Mesh
::
prev_valid_idx_from
(
face_index
idx
)
const
inline
face_index
Mesh
::
prev_valid_idx_from
(
face_index
idx
)
const
{
for
(
auto
i
=
idx
.
value
;
i
>=
0
;
--
i
)
if
(
mFaces
[
i
].
is_valid
())
...
...
@@ -577,7 +577,7 @@ face_index Mesh::prev_valid_idx_from(face_index idx) const
return
{};
// invalid
}
halfedge_index
Mesh
::
next_valid_idx_from
(
halfedge_index
idx
)
const
inline
halfedge_index
Mesh
::
next_valid_idx_from
(
halfedge_index
idx
)
const
{
for
(
auto
i
=
idx
.
value
;
i
<
(
int
)
mHalfedges
.
size
();
++
i
)
if
(
mHalfedges
[
i
].
is_valid
())
...
...
@@ -585,7 +585,7 @@ halfedge_index Mesh::next_valid_idx_from(halfedge_index idx) const
return
halfedge_index
(
mHalfedges
.
size
());
// end index
}
halfedge_index
Mesh
::
prev_valid_idx_from
(
halfedge_index
idx
)
const
inline
halfedge_index
Mesh
::
prev_valid_idx_from
(
halfedge_index
idx
)
const
{
for
(
auto
i
=
idx
.
value
;
i
>=
0
;
--
i
)
if
(
mHalfedges
[
i
].
is_valid
())
...
...
@@ -595,49 +595,49 @@ halfedge_index Mesh::prev_valid_idx_from(halfedge_index idx) const
/// ======== ITERATOR IMPLEMENTATION ========
valid_vertex_iterator
&
valid_vertex_iterator
::
operator
++
()
inline
valid_vertex_iterator
&
valid_vertex_iterator
::
operator
++
()
{
handle
.
idx
.
value
++
;
handle
.
idx
=
handle
.
mesh
->
next_valid_idx_from
(
handle
.
idx
);
return
*
this
;
}
vertex_iterator
&
vertex_iterator
::
operator
++
()
inline
vertex_iterator
&
vertex_iterator
::
operator
++
()
{
handle
.
idx
.
value
++
;
return
*
this
;
}
valid_face_iterator
&
valid_face_iterator
::
operator
++
()
inline
valid_face_iterator
&
valid_face_iterator
::
operator
++
()
{
handle
.
idx
.
value
++
;
handle
.
idx
=
handle
.
mesh
->
next_valid_idx_from
(
handle
.
idx
);
return
*
this
;
}
face_iterator
&
face_iterator
::
operator
++
()
inline
face_iterator
&
face_iterator
::
operator
++
()
{
handle
.
idx
.
value
++
;
return
*
this
;
}
valid_edge_iterator
&
valid_edge_iterator
::
operator
++
()
inline
valid_edge_iterator
&
valid_edge_iterator
::
operator
++
()
{
handle
.
idx
.
value
++
;
handle
.
idx
=
handle
.
mesh
->
next_valid_idx_from
(
handle
.
idx
);
return
*
this
;
}
edge_iterator
&
edge_iterator
::
operator
++
()
inline
edge_iterator
&
edge_iterator
::
operator
++
()
{
handle
.
idx
.
value
++
;
return
*
this
;
}
valid_halfedge_iterator
&
valid_halfedge_iterator
::
operator
++
()
inline
valid_halfedge_iterator
&
valid_halfedge_iterator
::
operator
++
()
{
handle
.
idx
.
value
++
;
handle
.
idx
=
handle
.
mesh
->
next_valid_idx_from
(
handle
.
idx
);
return
*
this
;
}
halfedge_iterator
&
halfedge_iterator
::
operator
++
()
inline
halfedge_iterator
&
halfedge_iterator
::
operator
++
()
{
handle
.
idx
.
value
++
;
return
*
this
;
...
...
@@ -647,79 +647,79 @@ halfedge_iterator &halfedge_iterator::operator++()
// - Vertices -
int
vertex_collection
::
size
()
const
inline
int
vertex_collection
::
size
()
const
{
return
mesh
->
size_vertices
();
}
void
vertex_collection
::
reserve
(
int
capacity
)
const
inline
void
vertex_collection
::
reserve
(
int
capacity
)
const
{
mesh
->
reserve_vertices
(
capacity
);
}
vertex_handle
vertex_collection
::
add
()
const
inline
vertex_handle
vertex_collection
::
add
()
const
{
return
mesh
->
handle_of
(
mesh
->
add_vertex
());
}
vertex_iterator
vertex_collection
::
begin
()
const
inline
vertex_iterator
vertex_collection
::
begin
()
const
{
return
mesh
->
vertices_begin
();
}
vertex_iterator
vertex_collection
::
end
()
const
inline
vertex_iterator
vertex_collection
::
end
()
const
{
return
mesh
->
vertices_end
();
}
int
valid_vertex_collection
::
size
()
const
inline
int
valid_vertex_collection
::
size
()
const
{
return
mesh
->
size_valid_vertices
();
}
valid_vertex_iterator
valid_vertex_collection
::
begin
()
const
inline
valid_vertex_iterator
valid_vertex_collection
::
begin
()
const
{
return
mesh
->
valid_vertices_begin
();
}
valid_vertex_iterator
valid_vertex_collection
::
end
()
const
inline
valid_vertex_iterator
valid_vertex_collection
::
end
()
const
{
return
mesh
->
valid_vertices_end
();
}
// - Faces -
int
face_collection
::
size
()
const
inline
int
face_collection
::
size
()
const
{
return
mesh
->
size_faces
();
}
void
face_collection
::
reserve
(
int
capacity
)
const
inline
void
face_collection
::
reserve
(
int
capacity
)
const
{
mesh
->
reserve_faces
(
capacity
);
}
face_handle
face_collection
::
add
(
const
vertex_handle
*
v_handles
,
size_t
vcnt
)
const
inline
face_handle
face_collection
::
add
(
const
vertex_handle
*
v_handles
,
size_t
vcnt
)
const
{
return
mesh
->
handle_of
(
mesh
->
add_face
(
v_handles
,
vcnt
));
}
face_handle
face_collection
::
add
(
const
halfedge_handle
*
half_loop
,
size_t
vcnt
)
const
inline
face_handle
face_collection
::
add
(
const
halfedge_handle
*
half_loop
,
size_t
vcnt
)
const
{
return
mesh
->
handle_of
(
mesh
->
add_face
(
half_loop
,
vcnt
));
}
face_handle
face_collection
::
add
(
std
::
vector
<
vertex_handle
>
const
&
v_handles
)
const
inline
face_handle
face_collection
::
add
(
std
::
vector
<
vertex_handle
>
const
&
v_handles
)
const
{
return
add
(
v_handles
.
data
(),
v_handles
.
size
());
}
face_handle
face_collection
::
add
(
std
::
vector
<
halfedge_handle
>
const
&
half_loop
)
const
inline
face_handle
face_collection
::
add
(
std
::
vector
<
halfedge_handle
>
const
&
half_loop
)
const
{
return
add
(
half_loop
.
data
(),
half_loop
.
size
());
}
face_handle
face_collection
::
add
(
vertex_handle
v0
,
vertex_handle
v1
,
vertex_handle
v2
)
const
inline
face_handle
face_collection
::
add
(
vertex_handle
v0
,
vertex_handle
v1
,
vertex_handle
v2
)
const
{
halfedge_index
hs
[
3
]
=
{
mesh
->
add_or_get_halfedge
(
v0
.
idx
,
v1
.
idx
),
//
...
...
@@ -729,7 +729,7 @@ face_handle face_collection::add(vertex_handle v0, vertex_handle v1, vertex_hand
return
mesh
->
handle_of
(
mesh
->
add_face
(
hs
,
3
));
}
face_handle
face_collection
::
add
(
vertex_handle
v0
,
vertex_handle
v1
,
vertex_handle
v2
,
vertex_handle
v3
)
const
inline
face_handle
face_collection
::
add
(
vertex_handle
v0
,
vertex_handle
v1
,
vertex_handle
v2
,
vertex_handle
v3
)
const
{
halfedge_index
hs
[
4
]
=
{
mesh
->
add_or_get_halfedge
(
v0
.
idx
,
v1
.
idx
),
//
...
...
@@ -740,20 +740,20 @@ face_handle face_collection::add(vertex_handle v0, vertex_handle v1, vertex_hand
return
mesh
->
handle_of
(
mesh
->
add_face
(
hs
,
4
));
}
face_handle
face_collection
::
add
(
halfedge_handle
h0
,
halfedge_handle
h1
,
halfedge_handle
h2
)
const
inline
face_handle
face_collection
::
add
(
halfedge_handle
h0
,
halfedge_handle
h1
,
halfedge_handle
h2
)
const
{
halfedge_index
hs
[
3
]
=
{
h0
.
idx
,
h1
.
idx
,
h2
.
idx
};
return
mesh
->
handle_of
(
mesh
->
add_face
(
hs
,
3
));
}
face_handle
face_collection
::
add
(
halfedge_handle
h0
,
halfedge_handle
h1
,
halfedge_handle
h2
,
halfedge_handle
h3
)
const
inline
face_handle
face_collection
::
add
(
halfedge_handle
h0
,
halfedge_handle
h1
,
halfedge_handle
h2
,
halfedge_handle
h3
)
const
{
halfedge_index
hs
[
4
]
=
{
h0
.
idx
,
h1
.
idx
,
h2
.
idx
,
h3
.
idx
};
return
mesh
->
handle_of
(
mesh
->
add_face
(
hs
,
4
));
}
template
<
size_t
N
>
face_handle
face_collection
::
add
(
const
vertex_handle
(
&
v_handles
)[
N
])
const
inline
face_handle
face_collection
::
add
(
const
vertex_handle
(
&
v_handles
)[
N
])
const
{
halfedge_index
hs
[
N
];
for
(
auto
i
=
0u
;
i
<
N
;
++
i
)
...
...
@@ -762,7 +762,7 @@ face_handle face_collection::add(const vertex_handle (&v_handles)[N]) const
}
template
<
size_t
N
>
face_handle
face_collection
::
add
(
const
halfedge_handle
(
&
half_loop
)[
N
])
const
inline
face_handle
face_collection
::
add
(
const
halfedge_handle
(
&
half_loop
)[
N
])
const
{
halfedge_index
hs
[
N
];
for
(
auto
i
=
0u
;
i
<
N
;
++
i
)
...
...
@@ -770,111 +770,111 @@ face_handle face_collection::add(const halfedge_handle (&half_loop)[N]) const
return
mesh
->
handle_of
(
mesh
->
add_face
(
hs
,
N
));
}
face_iterator
face_collection
::
begin
()
const
inline
face_iterator
face_collection
::
begin
()
const
{
return
mesh
->
faces_begin
();
}
face_iterator
face_collection
::
end
()
const
inline
face_iterator
face_collection
::
end
()
const
{
return
mesh
->
faces_end
();
}
int
valid_face_collection
::
size
()
const
inline
int
valid_face_collection
::
size
()
const
{
return
mesh
->
size_valid_faces
();
}
valid_face_iterator
valid_face_collection
::
begin
()
const
inline
valid_face_iterator
valid_face_collection
::
begin
()
const
{
return
mesh
->
valid_faces_begin
();
}
valid_face_iterator
valid_face_collection
::
end
()
const
inline
valid_face_iterator
valid_face_collection
::
end
()
const
{
return
mesh
->
valid_faces_end
();
}
// - Edges -
int
edge_collection
::
size
()
const
inline
int
edge_collection
::
size
()
const
{
return
mesh
->
size_edges
();
}
void
edge_collection
::
reserve
(
int
capacity
)
const
inline
void
edge_collection
::
reserve
(
int
capacity
)
const
{
mesh
->
reserve_edges
(
capacity
);
}
edge_handle
edge_collection
::
add_or_get
(
vertex_handle
v_from
,
vertex_handle
v_to
)
inline
edge_handle
edge_collection
::
add_or_get
(
vertex_handle
v_from
,
vertex_handle
v_to
)
{
return
mesh
->
handle_of
(
mesh
->
add_or_get_edge
(
v_from
.
idx
,
v_to
.
idx
));
}
edge_iterator
edge_collection
::
begin
()
const
inline
edge_iterator
edge_collection
::
begin
()
const
{
return
mesh
->
edges_begin
();
}
edge_iterator
edge_collection
::
end
()
const
inline
edge_iterator
edge_collection
::
end
()
const
{
return
mesh
->
edges_end
();
}
int
valid_edge_collection
::
size
()
const
inline
int
valid_edge_collection
::
size
()
const
{
return
mesh
->
size_valid_edges
();
}
valid_edge_iterator
valid_edge_collection
::
begin
()
const
inline
valid_edge_iterator
valid_edge_collection
::
begin
()
const
{
return
mesh
->
valid_edges_begin
();
}
valid_edge_iterator
valid_edge_collection
::
end
()
const
inline
valid_edge_iterator
valid_edge_collection
::
end
()
const
{
return
mesh
->
valid_edges_end
();
}
// - Halfedges -
int
halfedge_collection
::
size
()
const
inline
int
halfedge_collection
::
size
()
const
{
return
mesh
->
size_halfedges
();
}
void
halfedge_collection
::
reserve
(
int
capacity
)
const
inline
void
halfedge_collection
::
reserve
(
int
capacity
)
const
{
mesh
->
reserve_halfedges
(
capacity
);
}
halfedge_handle
halfedge_collection
::
add_or_get
(
vertex_handle
v_from
,
vertex_handle
v_to
)
inline
halfedge_handle
halfedge_collection
::
add_or_get
(
vertex_handle
v_from
,
vertex_handle
v_to
)
{
return
mesh
->
handle_of
(
mesh
->
add_or_get_halfedge
(
v_from
.
idx
,
v_to
.
idx
));
}
halfedge_iterator
halfedge_collection
::
begin
()
const
inline
halfedge_iterator
halfedge_collection
::
begin
()
const
{
return
mesh
->
halfedges_begin
();
}
halfedge_iterator
halfedge_collection
::
end
()
const
inline
halfedge_iterator
halfedge_collection
::
end
()
const
{
return
mesh
->
halfedges_end
();
}
int
valid_halfedge_collection
::
size
()
const
inline
int
valid_halfedge_collection
::
size
()
const
{
return
mesh
->
size_valid_halfedges
();
}
valid_halfedge_iterator
valid_halfedge_collection
::
begin
()
const
inline
valid_halfedge_iterator
valid_halfedge_collection
::
begin
()
const
{
return
mesh
->
valid_halfedges_begin
();
}
valid_halfedge_iterator
valid_halfedge_collection
::
end
()
const
inline
valid_halfedge_iterator
valid_halfedge_collection
::
end
()
const
{
return
mesh
->
valid_halfedges_end
();
}
...
...
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