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
38d1d37b
Commit
38d1d37b
authored
Sep 28, 2016
by
Philipp Adolf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Store sharpness in Triangle
parent
a4af0079
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
5 deletions
+53
-5
triangle.cpp
QTProject/triangle.cpp
+33
-1
triangle.h
QTProject/triangle.h
+20
-4
No files found.
QTProject/triangle.cpp
View file @
38d1d37b
...
@@ -10,13 +10,22 @@ Triangle::Triangle(const Triangle &other) {
...
@@ -10,13 +10,22 @@ Triangle::Triangle(const Triangle &other) {
this
->
u_
=
other
.
u_
;
this
->
u_
=
other
.
u_
;
this
->
v_
=
other
.
v_
;
this
->
v_
=
other
.
v_
;
this
->
w_
=
other
.
w_
;
this
->
w_
=
other
.
w_
;
this
->
sharpness_uv
=
other
.
sharpness_uv
;
this
->
sharpness_vw
=
other
.
sharpness_vw
;
this
->
sharpness_wu
=
other
.
sharpness_wu
;
}
}
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
,
unsigned
int
sharpness_uv
,
unsigned
int
sharpness_vw
,
unsigned
int
sharpness_wu
)
{
this
->
vertex_buffer_
=
vertex_buffer
;
this
->
vertex_buffer_
=
vertex_buffer
;
this
->
u_
=
u
;
this
->
u_
=
u
;
this
->
v_
=
v
;
this
->
v_
=
v
;
this
->
w_
=
w
;
this
->
w_
=
w
;
this
->
sharpness_uv
=
sharpness_uv
;
this
->
sharpness_vw
=
sharpness_vw
;
this
->
sharpness_wu
=
sharpness_wu
;
}
}
Vertex
Triangle
::
u
()
const
{
Vertex
Triangle
::
u
()
const
{
...
@@ -43,6 +52,16 @@ unsigned int Triangle::w_idx() const {
...
@@ -43,6 +52,16 @@ unsigned int Triangle::w_idx() const {
return
w_
;
return
w_
;
}
}
unsigned
int
Triangle
::
get_sharpness_uv
()
const
{
return
sharpness_uv
;
}
unsigned
int
Triangle
::
get_sharpness_vw
()
const
{
return
sharpness_vw
;
}
unsigned
int
Triangle
::
get_sharpness_wu
()
const
{
return
sharpness_wu
;
}
bool
Triangle
::
get_shared_edge
(
Triangle
other
,
Edge
&
edge_a
,
Edge
&
edge_b
)
const
{
bool
Triangle
::
get_shared_edge
(
Triangle
other
,
Edge
&
edge_a
,
Edge
&
edge_b
)
const
{
if
(
get_shared_edge_
(
other
,
edge_a
,
edge_b
))
{
if
(
get_shared_edge_
(
other
,
edge_a
,
edge_b
))
{
return
true
;
return
true
;
...
@@ -132,6 +151,9 @@ Triangle &Triangle::operator=(const Triangle &other) {
...
@@ -132,6 +151,9 @@ Triangle &Triangle::operator=(const Triangle &other) {
this
->
u_
=
other
.
u_
;
this
->
u_
=
other
.
u_
;
this
->
v_
=
other
.
v_
;
this
->
v_
=
other
.
v_
;
this
->
w_
=
other
.
w_
;
this
->
w_
=
other
.
w_
;
this
->
sharpness_uv
=
other
.
sharpness_uv
;
this
->
sharpness_vw
=
other
.
sharpness_vw
;
this
->
sharpness_wu
=
other
.
sharpness_wu
;
return
*
this
;
return
*
this
;
}
}
...
@@ -192,6 +214,16 @@ void ibToTriangles(QVector<Vertex> *vb, QVector<unsigned int> &ib, QVector<Trian
...
@@ -192,6 +214,16 @@ void ibToTriangles(QVector<Vertex> *vb, QVector<unsigned int> &ib, QVector<Trian
}
}
}
}
void
Triangle
::
set_sharpness
(
Triangle
::
Edge
::
Name
name
,
unsigned
int
value
){
if
(
name
==
Edge
::
Name
::
uv
){
sharpness_uv
=
value
;
}
else
if
(
name
==
Edge
::
Name
::
vw
){
sharpness_vw
=
value
;
}
else
if
(
name
==
Edge
::
Name
::
wu
){
sharpness_wu
=
value
;
}
}
void
trianglesToIB
(
const
QVector
<
Triangle
>
&
triangles
,
QVector
<
unsigned
int
>
&
ib
)
{
void
trianglesToIB
(
const
QVector
<
Triangle
>
&
triangles
,
QVector
<
unsigned
int
>
&
ib
)
{
ib
.
reserve
(
ib
.
length
()
+
triangles
.
length
()
*
3
);
ib
.
reserve
(
ib
.
length
()
+
triangles
.
length
()
*
3
);
QVectorIterator
<
Triangle
>
it
(
triangles
);
QVectorIterator
<
Triangle
>
it
(
triangles
);
...
...
QTProject/triangle.h
View file @
38d1d37b
...
@@ -5,6 +5,8 @@
...
@@ -5,6 +5,8 @@
#include <QDebug>
#include <QDebug>
#include <QVector>
#include <QVector>
#include "vertex.h"
#include "vertex.h"
#include "mesh.h"
class
Triangle
{
class
Triangle
{
public
:
public
:
...
@@ -16,9 +18,9 @@ class Triangle {
...
@@ -16,9 +18,9 @@ class Triangle {
};
};
Name
name
;
Name
name
;
unsigned
int
a
;
unsigned
int
a
;
//index der Kante im Dreieck
unsigned
int
b
;
unsigned
int
b
;
//index der Kante im Dreieck
unsigned
int
c
;
unsigned
int
c
;
//gegenüberliegender Vertex index
};
};
struct
Neighbor
{
struct
Neighbor
{
...
@@ -36,7 +38,10 @@ class Triangle {
...
@@ -36,7 +38,10 @@ 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
,
unsigned
int
sharpness_uv
=
0
,
unsigned
int
sharpness_vw
=
0
,
unsigned
int
sharpness_wu
=
0
);
Vertex
u
()
const
;
Vertex
u
()
const
;
Vertex
v
()
const
;
Vertex
v
()
const
;
...
@@ -46,6 +51,10 @@ class Triangle {
...
@@ -46,6 +51,10 @@ class Triangle {
unsigned
int
v_idx
()
const
;
unsigned
int
v_idx
()
const
;
unsigned
int
w_idx
()
const
;
unsigned
int
w_idx
()
const
;
unsigned
int
get_sharpness_uv
()
const
;
unsigned
int
get_sharpness_vw
()
const
;
unsigned
int
get_sharpness_wu
()
const
;
bool
get_shared_edge
(
Triangle
other
,
Edge
&
edge_a
,
Edge
&
edge_b
)
const
;
bool
get_shared_edge
(
Triangle
other
,
Edge
&
edge_a
,
Edge
&
edge_b
)
const
;
bool
hasSharedEdge
(
Triangle
other
);
bool
hasSharedEdge
(
Triangle
other
);
...
@@ -61,7 +70,14 @@ class Triangle {
...
@@ -61,7 +70,14 @@ class Triangle {
bool
next_ctrclockwise
(
Edge
first
,
Edge
next
)
const
;
bool
next_ctrclockwise
(
Edge
first
,
Edge
next
)
const
;
bool
next_clockwise
(
Edge
first
,
Edge
next
)
const
;
bool
next_clockwise
(
Edge
first
,
Edge
next
)
const
;
void
set_sharpness
(
Triangle
::
Edge
::
Name
name
,
unsigned
int
value
);
private
:
private
:
unsigned
int
sharpness_uv
;
unsigned
int
sharpness_vw
;
unsigned
int
sharpness_wu
;
const
QVector
<
Vertex
>
*
vertex_buffer_
;
const
QVector
<
Vertex
>
*
vertex_buffer_
;
unsigned
int
u_
;
unsigned
int
u_
;
unsigned
int
v_
;
unsigned
int
v_
;
...
...
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