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
a8bc7b1f
Commit
a8bc7b1f
authored
Sep 27, 2016
by
Philipp Adolf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract code into getAllVertices
parent
25fccdc3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
10 deletions
+24
-10
subdivision.cpp
QTProject/subdivision.cpp
+23
-10
subdivision.h
QTProject/subdivision.h
+1
-0
No files found.
QTProject/subdivision.cpp
View file @
a8bc7b1f
...
@@ -1057,19 +1057,32 @@ bool Subdivision::containsVertex(QVector<Vertex> &vertices, Vertex vertex) {
...
@@ -1057,19 +1057,32 @@ bool Subdivision::containsVertex(QVector<Vertex> &vertices, Vertex vertex) {
return
false
;
return
false
;
}
}
QVector
<
Vertex
>
Subdivision
::
getAllVertices
(
const
QVector
<
Triangle
>
&
triangles
)
{
QVector
<
Vertex
>
result
;
QVectorIterator
<
Triangle
>
i
(
triangles
);
while
(
i
.
hasNext
())
{
Triangle
extra_triangle
=
i
.
next
();
if
(
!
containsVertex
(
result
,
extra_triangle
.
u
()))
result
.
push_back
(
extra_triangle
.
u
());
if
(
!
containsVertex
(
result
,
extra_triangle
.
v
()))
result
.
push_back
(
extra_triangle
.
v
());
if
(
!
containsVertex
(
result
,
extra_triangle
.
w
()))
result
.
push_back
(
extra_triangle
.
w
());
}
return
result
;
}
QVector3D
Subdivision
::
updateIrregularVertexForDraw
(
Vertex
currentCorner
,
QVector
<
Triangle
>
neighboring_triangles
)
{
QVector3D
Subdivision
::
updateIrregularVertexForDraw
(
Vertex
currentCorner
,
QVector
<
Triangle
>
neighboring_triangles
)
{
QVector
<
Vertex
>
surroundingVertex
;
QVector
<
Vertex
>
surroundingVertex
;
QVectorIterator
<
Triangle
>
extra
(
neighboring_triangles
);
surroundingVertex
=
getAllVertices
(
neighboring_triangles
);
while
(
extra
.
hasNext
())
{
QMutableVectorIterator
<
Vertex
>
i
(
surroundingVertex
);
Triangle
extra_triangle
=
extra
.
next
();
while
(
i
.
hasNext
())
{
if
(
currentCorner
.
samePos
(
i
.
next
()))
{
if
(
!
currentCorner
.
samePos
(
extra_triangle
.
u
())
&&
!
containsVertex
(
surroundingVertex
,
extra_triangle
.
u
()))
i
.
remove
();
surroundingVertex
.
push_back
(
extra_triangle
.
u
());
break
;
if
(
!
currentCorner
.
samePos
(
extra_triangle
.
v
())
&&
!
containsVertex
(
surroundingVertex
,
extra_triangle
.
v
()))
}
surroundingVertex
.
push_back
(
extra_triangle
.
v
());
if
(
!
currentCorner
.
samePos
(
extra_triangle
.
w
())
&&
!
containsVertex
(
surroundingVertex
,
extra_triangle
.
w
()))
surroundingVertex
.
push_back
(
extra_triangle
.
w
());
}
}
QVector3D
newPos
(
0.0
,
0.0
,
0.0
);
QVector3D
newPos
(
0.0
,
0.0
,
0.0
);
...
...
QTProject/subdivision.h
View file @
a8bc7b1f
...
@@ -72,6 +72,7 @@ private:
...
@@ -72,6 +72,7 @@ private:
void
runEdgeShader
(
GLuint
size
,
GLuint
vb_handle
,
GLuint
edge_indices_handle
,
GLuint
output_handle
,
GLuint
offset_handle
);
void
runEdgeShader
(
GLuint
size
,
GLuint
vb_handle
,
GLuint
edge_indices_handle
,
GLuint
output_handle
,
GLuint
offset_handle
);
void
updateIrregularForDraw
(
const
QVector
<
Triangle
>
&
triangles
,
QMap
<
Triangle
,
Triangle
::
Neighbors
>
&
neighbors
,
Result
&
result
);
void
updateIrregularForDraw
(
const
QVector
<
Triangle
>
&
triangles
,
QMap
<
Triangle
,
Triangle
::
Neighbors
>
&
neighbors
,
Result
&
result
);
bool
containsVertex
(
QVector
<
Vertex
>
&
vertices
,
Vertex
vertex
);
bool
containsVertex
(
QVector
<
Vertex
>
&
vertices
,
Vertex
vertex
);
QVector
<
Vertex
>
getAllVertices
(
const
QVector
<
Triangle
>
&
triangles
);
QVector3D
updateIrregularVertexForDraw
(
Vertex
currentCorner
,
QVector
<
Triangle
>
neighboring_triangles
);
QVector3D
updateIrregularVertexForDraw
(
Vertex
currentCorner
,
QVector
<
Triangle
>
neighboring_triangles
);
QVector
<
unsigned
int
>
patchIBToTriangleIB
(
QVector
<
unsigned
int
>
ib
);
QVector
<
unsigned
int
>
patchIBToTriangleIB
(
QVector
<
unsigned
int
>
ib
);
...
...
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