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
b21bdb93
Commit
b21bdb93
authored
Sep 15, 2016
by
Philipp Adolf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use pointer to vertex buffer in Triangle
Fixes
#5
parent
4e5f6931
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
11 deletions
+11
-11
subdivision.cpp
QTProject/subdivision.cpp
+5
-5
triangle.cpp
QTProject/triangle.cpp
+4
-4
triangle.h
QTProject/triangle.h
+2
-2
No files found.
QTProject/subdivision.cpp
View file @
b21bdb93
...
@@ -155,11 +155,11 @@ Subdivision::Tables Subdivision::precomputeTables(Input input) {
...
@@ -155,11 +155,11 @@ Subdivision::Tables Subdivision::precomputeTables(Input input) {
QVector
<
Triangle
>
triangles
;
QVector
<
Triangle
>
triangles
;
for
(
int
i
=
0
;
i
<
ib
.
length
();
i
+=
3
)
{
for
(
int
i
=
0
;
i
<
ib
.
length
();
i
+=
3
)
{
triangles
.
push_back
(
Triangle
(
vb
,
ib
[
i
],
ib
[
i
+
1
],
ib
[
i
+
2
]));
triangles
.
push_back
(
Triangle
(
&
vb
,
ib
[
i
],
ib
[
i
+
1
],
ib
[
i
+
2
]));
}
}
QVector
<
Triangle
>
triangles_regular
;
QVector
<
Triangle
>
triangles_regular
;
for
(
int
i
=
0
;
i
<
ib_regular
.
length
();
i
+=
3
)
{
for
(
int
i
=
0
;
i
<
ib_regular
.
length
();
i
+=
3
)
{
triangles
.
push_back
(
Triangle
(
vb
,
ib_regular
[
i
],
ib_regular
[
i
+
1
],
ib_regular
[
i
+
2
]));
triangles
.
push_back
(
Triangle
(
&
vb
,
ib_regular
[
i
],
ib_regular
[
i
+
1
],
ib_regular
[
i
+
2
]));
}
}
precomputeEdgeTable
(
tables
,
triangles
,
triangles_regular
,
(
unsigned
int
)
vb
.
length
());
precomputeEdgeTable
(
tables
,
triangles
,
triangles_regular
,
(
unsigned
int
)
vb
.
length
());
...
@@ -458,14 +458,14 @@ QVector<unsigned int> Subdivision::getPatchIndexBuffer(QVector<unsigned int> ib_
...
@@ -458,14 +458,14 @@ QVector<unsigned int> Subdivision::getPatchIndexBuffer(QVector<unsigned int> ib_
}
}
}
}
Triangle
t367
(
vb
,
i3
,
i6
,
i7
);
Triangle
t367
(
&
vb
,
i3
,
i6
,
i7
);
for
(
int
j
=
i
+
3
;
j
<
ib_combined
.
length
()
-
2
;
j
+=
3
){
for
(
int
j
=
i
+
3
;
j
<
ib_combined
.
length
()
-
2
;
j
+=
3
){
unsigned
int
j0
=
ib_combined
[
j
];
unsigned
int
j0
=
ib_combined
[
j
];
unsigned
int
j1
=
ib_combined
[
j
+
1
];
unsigned
int
j1
=
ib_combined
[
j
+
1
];
unsigned
int
j2
=
ib_combined
[
j
+
2
];
unsigned
int
j2
=
ib_combined
[
j
+
2
];
Triangle
tj
(
vb
,
j0
,
j1
,
j2
);
Triangle
tj
(
&
vb
,
j0
,
j1
,
j2
);
if
(
t367
.
hasSharedEdge
(
tj
)){
if
(
t367
.
hasSharedEdge
(
tj
)){
QVector
<
Triangle
>
neighbors
=
adj
.
value
(
tj
,
QVector
<
Triangle
>
());
QVector
<
Triangle
>
neighbors
=
adj
.
value
(
tj
,
QVector
<
Triangle
>
());
...
@@ -488,7 +488,7 @@ QVector<unsigned int> Subdivision::getPatchIndexBuffer(QVector<unsigned int> ib_
...
@@ -488,7 +488,7 @@ QVector<unsigned int> Subdivision::getPatchIndexBuffer(QVector<unsigned int> ib_
i3
=
ib_regular
[
i
];
i3
=
ib_regular
[
i
];
i6
=
ib_regular
[
i
+
1
];
i6
=
ib_regular
[
i
+
1
];
i7
=
ib_regular
[
i
+
2
];
i7
=
ib_regular
[
i
+
2
];
Triangle
ti
(
vb
,
i3
,
i6
,
i7
);
Triangle
ti
(
&
vb
,
i3
,
i6
,
i7
);
bool
found0
,
found1
,
found5
,
found8
,
found9
,
found11
;
bool
found0
,
found1
,
found5
,
found8
,
found9
,
found11
;
QVector
<
Triangle
>
neighbors
=
adj
.
value
(
ti
,
QVector
<
Triangle
>
());
QVector
<
Triangle
>
neighbors
=
adj
.
value
(
ti
,
QVector
<
Triangle
>
());
for
(
int
j
=
0
;
j
<
neighbors
.
length
();
j
++
){
for
(
int
j
=
0
;
j
<
neighbors
.
length
();
j
++
){
...
...
QTProject/triangle.cpp
View file @
b21bdb93
...
@@ -13,7 +13,7 @@ Triangle::Triangle(const Triangle &other) {
...
@@ -13,7 +13,7 @@ Triangle::Triangle(const Triangle &other) {
this
->
w_
=
other
.
w_
;
this
->
w_
=
other
.
w_
;
}
}
Triangle
::
Triangle
(
const
QVector
<
Vertex
>
&
vertex_buffer
,
unsigned
int
u
,
unsigned
int
v
,
unsigned
int
w
)
{
Triangle
::
Triangle
(
const
QVector
<
Vertex
>
*
vertex_buffer
,
unsigned
int
u
,
unsigned
int
v
,
unsigned
int
w
)
{
this
->
vertex_buffer_
=
vertex_buffer
;
this
->
vertex_buffer_
=
vertex_buffer
;
this
->
u_
=
u
;
this
->
u_
=
u
;
this
->
v_
=
v
;
this
->
v_
=
v
;
...
@@ -21,15 +21,15 @@ Triangle::Triangle(const QVector<Vertex> &vertex_buffer, unsigned int u, unsigne
...
@@ -21,15 +21,15 @@ Triangle::Triangle(const QVector<Vertex> &vertex_buffer, unsigned int u, unsigne
}
}
Vertex
Triangle
::
u
()
const
{
Vertex
Triangle
::
u
()
const
{
return
vertex_buffer_
[
u_
];
return
(
*
vertex_buffer_
)
[
u_
];
}
}
Vertex
Triangle
::
v
()
const
{
Vertex
Triangle
::
v
()
const
{
return
vertex_buffer_
[
v_
];
return
(
*
vertex_buffer_
)
[
v_
];
}
}
Vertex
Triangle
::
w
()
const
{
Vertex
Triangle
::
w
()
const
{
return
vertex_buffer_
[
w_
];
return
(
*
vertex_buffer_
)
[
w_
];
}
}
unsigned
int
Triangle
::
u_idx
()
const
{
unsigned
int
Triangle
::
u_idx
()
const
{
...
...
QTProject/triangle.h
View file @
b21bdb93
...
@@ -23,7 +23,7 @@ class Triangle {
...
@@ -23,7 +23,7 @@ class Triangle {
Triangle
();
Triangle
();
Triangle
(
const
Triangle
&
other
);
Triangle
(
const
Triangle
&
other
);
Triangle
(
const
QVector
<
Vertex
>
&
vertex_buffer
,
unsigned
int
u
,
unsigned
int
v
,
unsigned
int
w
);
Triangle
(
const
QVector
<
Vertex
>
*
vertex_buffer
,
unsigned
int
u
,
unsigned
int
v
,
unsigned
int
w
);
Vertex
u
()
const
;
Vertex
u
()
const
;
Vertex
v
()
const
;
Vertex
v
()
const
;
...
@@ -48,7 +48,7 @@ class Triangle {
...
@@ -48,7 +48,7 @@ class Triangle {
bool
next_clockwise
(
Edge
first
,
Edge
next
)
const
;
bool
next_clockwise
(
Edge
first
,
Edge
next
)
const
;
private
:
private
:
QVector
<
Vertex
>
vertex_buffer_
;
const
QVector
<
Vertex
>
*
vertex_buffer_
;
unsigned
int
u_
;
unsigned
int
u_
;
unsigned
int
v_
;
unsigned
int
v_
;
unsigned
int
w_
;
unsigned
int
w_
;
...
...
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