Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
Unterteilungsalgorithmen
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kai Westerkamp
Unterteilungsalgorithmen
Commits
9fe1af47
Commit
9fe1af47
authored
Sep 27, 2016
by
Philipp Adolf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
temp
parent
1e95e175
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
72 additions
and
56 deletions
+72
-56
mainwidget.cpp
QTProject/mainwidget.cpp
+1
-1
subdivision.cpp
QTProject/subdivision.cpp
+71
-55
No files found.
QTProject/mainwidget.cpp
View file @
9fe1af47
...
...
@@ -145,7 +145,7 @@ void MainWidget::initializeGL(){
subdivision
->
init
();
//loadNewMesh( "../Models/demon_head.3ds");
loadNewMesh
(
"../Models/
torus
.obj"
);
loadNewMesh
(
"../Models/
box
.obj"
);
}
void
MainWidget
::
loadNewMesh
(){
...
...
QTProject/subdivision.cpp
View file @
9fe1af47
...
...
@@ -550,74 +550,90 @@ void Subdivision::precomputeEdgeTable(Subdivision::Tables &tables, QVector<Trian
extra_it
.
next
();
Triangle
triangle
=
extra_it
.
key
();
qDebug
()
<<
triangle
;
unsigned
int
uv
,
vw
,
wu
;
int
uv
=
-
1
;
int
vw
=
-
1
;
int
wu
=
-
1
;
Edge
edge
;
Triangle
::
Neighbors
ns
=
neighbors
.
value
(
triangle
);
edge
=
{
triangle
.
u_idx
(),
triangle
.
v_idx
()
};
if
(
edge_indices
.
contains
(
edge
))
{
uv
=
edge_indices
.
value
(
edge
);
}
else
{
uv
=
offset
++
;
edge_indices
.
insert
(
edge
,
uv
);
edge
=
{
ns
.
uv
.
edge
.
a
,
ns
.
uv
.
edge
.
b
};
edge_indices
.
insert
(
edge
,
uv
);
tables
.
edge_indices
.
push_back
(
triangle
.
u_idx
());
tables
.
edge_indices
.
push_back
(
triangle
.
v_idx
());
tables
.
edge_indices
.
push_back
(
triangle
.
w_idx
());
tables
.
edge_indices
.
push_back
(
ns
.
uv
.
edge
.
c
);
if
(
ns
.
uv
.
triangle
!=
NULL
)
{
edge
=
{
triangle
.
u_idx
(),
triangle
.
v_idx
()
};
if
(
edge_indices
.
contains
(
edge
))
{
uv
=
edge_indices
.
value
(
edge
);
}
else
{
uv
=
offset
++
;
edge_indices
.
insert
(
edge
,
uv
);
edge
=
{
ns
.
uv
.
edge
.
a
,
ns
.
uv
.
edge
.
b
};
edge_indices
.
insert
(
edge
,
uv
);
tables
.
edge_indices
.
push_back
(
triangle
.
u_idx
());
tables
.
edge_indices
.
push_back
(
triangle
.
v_idx
());
tables
.
edge_indices
.
push_back
(
triangle
.
w_idx
());
tables
.
edge_indices
.
push_back
(
ns
.
uv
.
edge
.
c
);
}
}
edge
=
{
triangle
.
v_idx
(),
triangle
.
w_idx
()
};
if
(
edge_indices
.
contains
(
edge
))
{
vw
=
edge_indices
.
value
(
edge
);
}
else
{
vw
=
offset
++
;
edge_indices
.
insert
(
edge
,
vw
);
edge
=
{
ns
.
vw
.
edge
.
a
,
ns
.
vw
.
edge
.
b
};
edge_indices
.
insert
(
edge
,
vw
);
tables
.
edge_indices
.
push_back
(
triangle
.
v_idx
());
tables
.
edge_indices
.
push_back
(
triangle
.
w_idx
());
tables
.
edge_indices
.
push_back
(
triangle
.
u_idx
());
tables
.
edge_indices
.
push_back
(
ns
.
vw
.
edge
.
c
);
if
(
ns
.
vw
.
triangle
!=
NULL
)
{
edge
=
{
triangle
.
v_idx
(),
triangle
.
w_idx
()
};
if
(
edge_indices
.
contains
(
edge
))
{
vw
=
edge_indices
.
value
(
edge
);
}
else
{
vw
=
offset
++
;
edge_indices
.
insert
(
edge
,
vw
);
edge
=
{
ns
.
vw
.
edge
.
a
,
ns
.
vw
.
edge
.
b
};
edge_indices
.
insert
(
edge
,
vw
);
tables
.
edge_indices
.
push_back
(
triangle
.
v_idx
());
tables
.
edge_indices
.
push_back
(
triangle
.
w_idx
());
tables
.
edge_indices
.
push_back
(
triangle
.
u_idx
());
tables
.
edge_indices
.
push_back
(
ns
.
vw
.
edge
.
c
);
}
}
edge
=
{
triangle
.
w_idx
(),
triangle
.
u_idx
()
};
if
(
edge_indices
.
contains
(
edge
))
{
wu
=
edge_indices
.
value
(
edge
);
}
else
{
wu
=
offset
++
;
edge_indices
.
insert
(
edge
,
wu
);
edge
=
{
ns
.
wu
.
edge
.
a
,
ns
.
wu
.
edge
.
b
};
edge_indices
.
insert
(
edge
,
wu
);
tables
.
edge_indices
.
push_back
(
triangle
.
w_idx
());
tables
.
edge_indices
.
push_back
(
triangle
.
u_idx
());
tables
.
edge_indices
.
push_back
(
triangle
.
v_idx
());
tables
.
edge_indices
.
push_back
(
ns
.
wu
.
edge
.
c
);
if
(
ns
.
wu
.
triangle
!=
NULL
)
{
edge
=
{
triangle
.
w_idx
(),
triangle
.
u_idx
()
};
if
(
edge_indices
.
contains
(
edge
))
{
wu
=
edge_indices
.
value
(
edge
);
}
else
{
wu
=
offset
++
;
edge_indices
.
insert
(
edge
,
wu
);
edge
=
{
ns
.
wu
.
edge
.
a
,
ns
.
wu
.
edge
.
b
};
edge_indices
.
insert
(
edge
,
wu
);
tables
.
edge_indices
.
push_back
(
triangle
.
w_idx
());
tables
.
edge_indices
.
push_back
(
triangle
.
u_idx
());
tables
.
edge_indices
.
push_back
(
triangle
.
v_idx
());
tables
.
edge_indices
.
push_back
(
ns
.
wu
.
edge
.
c
);
}
}
tables
.
extra_triangles
.
push_back
(
triangle
.
u_idx
());
tables
.
extra_triangles
.
push_back
(
uv
);
tables
.
extra_triangles
.
push_back
(
wu
);
if
(
uv
>=
0
&&
wu
>=
0
)
{
tables
.
extra_triangles
.
push_back
(
triangle
.
u_idx
());
tables
.
extra_triangles
.
push_back
(
uv
);
tables
.
extra_triangles
.
push_back
(
wu
);
}
tables
.
extra_triangles
.
push_back
(
triangle
.
v_idx
());
tables
.
extra_triangles
.
push_back
(
vw
);
tables
.
extra_triangles
.
push_back
(
uv
);
if
(
vw
>=
0
&&
uv
>=
0
)
{
tables
.
extra_triangles
.
push_back
(
triangle
.
v_idx
());
tables
.
extra_triangles
.
push_back
(
vw
);
tables
.
extra_triangles
.
push_back
(
uv
);
}
tables
.
extra_triangles
.
push_back
(
triangle
.
w_idx
());
tables
.
extra_triangles
.
push_back
(
wu
);
tables
.
extra_triangles
.
push_back
(
vw
);
if
(
wu
>=
0
&&
vw
>=
0
)
{
tables
.
extra_triangles
.
push_back
(
triangle
.
w_idx
());
tables
.
extra_triangles
.
push_back
(
wu
);
tables
.
extra_triangles
.
push_back
(
vw
);
}
tables
.
extra_triangles
.
push_back
(
uv
);
tables
.
extra_triangles
.
push_back
(
vw
);
tables
.
extra_triangles
.
push_back
(
wu
);
if
(
uv
>=
0
&&
vw
>=
0
&&
wu
>=
0
)
{
tables
.
extra_triangles
.
push_back
(
uv
);
tables
.
extra_triangles
.
push_back
(
vw
);
tables
.
extra_triangles
.
push_back
(
wu
);
}
}
qCDebug
(
log_subdiv
)
<<
"Done with edge table. "
<<
tables
.
edge_indices
.
length
();
...
...
Write
Preview
Markdown
is supported
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