Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
polymesh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
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
Philip Trettner
polymesh
Commits
ab1c7279
Commit
ab1c7279
authored
6 years ago
by
Philip Trettner
Browse files
Options
Downloads
Patches
Plain Diff
fixed incorrect iterator and some compile errors
parent
47552d07
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Readme.md
+2
-1
2 additions, 1 deletion
Readme.md
src/polymesh/impl/impl_ranges.hh
+18
-3
18 additions, 3 deletions
src/polymesh/impl/impl_ranges.hh
src/polymesh/iterators.hh
+1
-1
1 addition, 1 deletion
src/polymesh/iterators.hh
with
21 additions
and
5 deletions
Readme.md
+
2
−
1
View file @
ab1c7279
...
...
@@ -23,3 +23,4 @@ Best used with glm and glow.
*
opposite edges (from vertex)
*
cotangens weights etc.
*
smoothing
*
make handle.
<primitives>
() contain only valid ones and provide an all_
<primitives>
() version
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/polymesh/impl/impl_ranges.hh
+
18
−
3
View file @
ab1c7279
...
...
@@ -40,7 +40,10 @@ template <class this_t, class ElementT>
bool
smart_range
<
this_t
,
ElementT
>::
any
()
const
{
for
(
auto
h
:
*
static_cast
<
this_t
const
*>
(
this
))
{
(
void
)
h
;
// unused
return
true
;
}
return
false
;
}
...
...
@@ -86,7 +89,10 @@ auto smart_range<this_t, ElementT>::min(FuncT &&f) const -> tmp::decayed_result_
auto
v
=
f
(
*
it_begin
);
++
it_begin
;
while
(
it_begin
!=
it_end
)
{
v
=
detail
::
helper_min
(
v
,
f
(
*
it_begin
));
++
it_begin
;
}
return
v
;
}
...
...
@@ -100,7 +106,10 @@ auto smart_range<this_t, ElementT>::max(FuncT &&f) const -> tmp::decayed_result_
auto
v
=
f
(
*
it_begin
);
++
it_begin
;
while
(
it_begin
!=
it_end
)
{
v
=
detail
::
helper_max
(
v
,
f
(
*
it_begin
));
++
it_begin
;
}
return
v
;
}
...
...
@@ -114,7 +123,10 @@ auto smart_range<this_t, ElementT>::sum(FuncT &&f) const -> tmp::decayed_result_
auto
s
=
f
(
*
it_begin
);
++
it_begin
;
while
(
it_begin
!=
it_end
)
{
s
=
s
+
f
(
*
it_begin
);
++
it_begin
;
}
return
s
;
}
...
...
@@ -132,6 +144,7 @@ auto smart_range<this_t, ElementT>::avg(FuncT &&f) const -> tmp::decayed_result_
{
s
=
s
+
f
(
*
it_begin
);
++
cnt
;
++
it_begin
;
}
return
s
/
cnt
;
}
...
...
@@ -152,6 +165,7 @@ auto smart_range<this_t, ElementT>::weighted_avg(FuncT &&f, WeightT &&w) const -
auto
ee
=
*
it_begin
;
s
=
s
+
f
(
ee
);
ws
=
ws
+
w
(
ee
);
++
it_begin
;
}
return
s
/
ws
;
}
...
...
@@ -171,6 +185,7 @@ auto smart_range<this_t, ElementT>::aabb(FuncT &&f) const -> polymesh::aabb<type
auto
vv
=
f
(
*
it_begin
);
r
.
min
=
detail
::
helper_min
(
r
.
min
,
vv
);
r
.
max
=
detail
::
helper_max
(
r
.
max
,
vv
);
++
it_begin
;
}
return
r
;
}
...
...
@@ -239,7 +254,7 @@ int smart_collection<mesh_ptr, tag, iterator>::size() const
template
<
class
mesh_ptr
,
class
tag
,
class
iterator
>
void
smart_collection
<
mesh_ptr
,
tag
,
iterator
>::
reserve
(
int
capacity
)
const
{
return
primitive
<
tag
>::
reserve
(
*
mesh
,
capacity
);
return
typename
primitive
<
tag
>::
reserve
(
*
mesh
,
capacity
);
}
template
<
class
mesh_ptr
,
class
tag
,
class
iterator
>
...
...
@@ -252,13 +267,13 @@ typename primitive<tag>::template attribute<PropT> smart_collection<mesh_ptr, ta
template
<
class
mesh_ptr
,
class
tag
,
class
iterator
>
iterator
smart_collection
<
mesh_ptr
,
tag
,
iterator
>::
begin
()
const
{
return
{{
this
->
mesh
,
primitive
<
tag
>::
index
(
0
)}};
return
{{
this
->
mesh
,
typename
primitive
<
tag
>::
index
(
0
)}};
}
template
<
class
mesh_ptr
,
class
tag
,
class
iterator
>
iterator
smart_collection
<
mesh_ptr
,
tag
,
iterator
>::
end
()
const
{
return
{{
this
->
mesh
,
primitive
<
tag
>::
index
(
primitive
<
tag
>::
all_size
(
*
this
->
mesh
))}};
return
{{
this
->
mesh
,
typename
primitive
<
tag
>::
index
(
primitive
<
tag
>::
all_size
(
*
this
->
mesh
))}};
}
template
<
class
iterator
>
...
...
This diff is collapsed.
Click to expand it.
src/polymesh/iterators.hh
+
1
−
1
View file @
ab1c7279
...
...
@@ -17,7 +17,7 @@ struct valid_primitive_iterator
using
handle_t
=
typename
primitive
<
tag
>::
handle
;
valid_primitive_iterator
()
=
default
;
valid_primitive_iterator
(
handle_t
handle
)
:
handle
(
handle
)
{
handle
.
idx
=
handle
.
mesh
->
next_valid_idx_from
(
handle
.
idx
);
}
valid_primitive_iterator
(
handle_t
handle
)
:
handle
(
handle
)
{
this
->
handle
.
idx
=
handle
.
mesh
->
next_valid_idx_from
(
handle
.
idx
);
}
handle_t
operator
*
()
const
{
return
handle
;
}
valid_primitive_iterator
&
operator
++
()
...
...
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