Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
Scotty3D
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
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
Courses
Scotty3D
Commits
faf9e4cf
Commit
faf9e4cf
authored
4 years ago
by
TheNumbat
Browse files
Options
Downloads
Patches
Plain Diff
fix macos build; add wrapper for erase
parent
9bc17c6e
Branches
Branches containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/geometry/halfedge.h
+18
-0
18 additions, 0 deletions
src/geometry/halfedge.h
src/gui/model.cpp
+0
-1
0 additions, 1 deletion
src/gui/model.cpp
src/student/meshedit.cpp
+138
-124
138 additions, 124 deletions
src/student/meshedit.cpp
with
156 additions
and
125 deletions
src/geometry/halfedge.h
+
18
−
0
View file @
faf9e4cf
...
...
@@ -190,6 +190,14 @@ public:
// Student Local Operations | student/meshedit.cpp
//////////////////////////////////////////////////////////////////////////////////////////
// Note: if you erase elements in these methods, they will not be erased from the
// element lists until do_erase or validate are called. This is to facilitate checking
// for dangling references to elements that will be erased.
// The rest of the codebase will automatically call validate() after each op,
// but you may need to be aware of this when implementing global ops.
// Specifically, when you need to collapse an edge in iostropic_remesh() or simplify(),
// you should call collapse_edge_erase() instead of collapse_edge()
/*
Merge all faces incident on a given vertex, returning a
pointer to the merged face.
...
...
@@ -260,6 +268,16 @@ public:
void
bevel_face_positions
(
const
std
::
vector
<
Vec3
>
&
start_positions
,
FaceRef
face
,
float
tangent_offset
,
float
normal_offset
);
/*
Collapse an edge, returning a pointer to the collapsed vertex
** Also deletes the erased elements **
*/
std
::
optional
<
VertexRef
>
collapse_edge_erase
(
EdgeRef
e
)
{
auto
r
=
collapse_edge
(
e
);
do_erase
();
return
r
;
}
//////////////////////////////////////////////////////////////////////////////////////////
// Student Global Operations | student/meshedit.cpp
//////////////////////////////////////////////////////////////////////////////////////////
...
...
This diff is collapsed.
Click to expand it.
src/gui/model.cpp
+
0
−
1
View file @
faf9e4cf
...
...
@@ -226,7 +226,6 @@ void Model::vertex_viz(Halfedge_Mesh::VertexRef v, float &size, Mat4 &transform)
auto
he
=
v
->
halfedge
();
do
{
Vec3
n
=
he
->
twin
()
->
vertex
()
->
pos
;
float
len
=
he
->
edge
()
->
length
();
min
=
std
::
min
(
min
,
len
);
avg
+=
len
;
...
...
This diff is collapsed.
Click to expand it.
src/student/meshedit.cpp
+
138
−
124
View file @
faf9e4cf
...
...
@@ -235,7 +235,7 @@ void Halfedge_Mesh::bevel_edge_positions(const std::vector<Vec3> &start_position
new_halfedges and vertex positions
in orig. So, you can write loops of the form
for(size_t i = 0; i < new_halfedges.size();
hs
++)
for(size_t i = 0; i < new_halfedges.size();
i
++)
{
Vec3 pi = start_positions[i]; // get the original vertex
position corresponding to vertex i
...
...
@@ -430,6 +430,13 @@ bool Halfedge_Mesh::isotropic_remesh() {
// -> Now flip each edge if it improves vertex degree
// -> Finally, apply some tangential smoothing to the vertex positions
// Note: if you erase elements in a local operation, they will not be actually deleted
// until do_erase or validate are called. This is to facilitate checking
// for dangling references to elements that will be erased.
// The rest of the codebase will automatically call validate() after each op,
// but here simply calling collapse_edge() will not erase the elements.
// You should use collapse_edge_erase() instead for the desired behavior.
return
false
;
}
...
...
@@ -549,5 +556,12 @@ bool Halfedge_Mesh::simplify() {
// a quadric to the collapsed vertex, and to pop the collapsed edge off the
// top of the queue.
// Note: if you erase elements in a local operation, they will not be actually deleted
// until do_erase or validate are called. This is to facilitate checking
// for dangling references to elements that will be erased.
// The rest of the codebase will automatically call validate() after each op,
// but here simply calling collapse_edge() will not erase the elements.
// You should use collapse_edge_erase() instead for the desired behavior.
return
false
;
}
This diff is collapsed.
Click to expand it.
Preview
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!
Save comment
Cancel
Please
register
or
sign in
to comment