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
f93785b6
Commit
f93785b6
authored
Aug 20, 2016
by
Philipp Adolf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Triangle class
parent
3ac32607
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
95 additions
and
2 deletions
+95
-2
Subdivision.pro
QTProject/Subdivision.pro
+4
-2
triangle.cpp
QTProject/triangle.cpp
+57
-0
triangle.h
QTProject/triangle.h
+34
-0
No files found.
QTProject/Subdivision.pro
View file @
f93785b6
...
...
@@ -21,7 +21,8 @@ SOURCES += main.cpp\
texture
.
cpp
\
camera
.
cpp
\
subdivision
.
cpp
\
vertex
.
cpp
vertex
.
cpp
\
triangle
.
cpp
HEADERS
+=
mainwindow
.
h
\
mainwidget
.
h
\
...
...
@@ -29,7 +30,8 @@ HEADERS += mainwindow.h \
texture
.
h
\
camera
.
h
\
subdivision
.
h
\
vertex
.
h
vertex
.
h
\
triangle
.
h
FORMS
+=
...
...
QTProject/triangle.cpp
0 → 100644
View file @
f93785b6
#include <QDebugStateSaver>
#include "triangle.h"
Triangle
::
Triangle
()
{}
Triangle
::
Triangle
(
const
Triangle
&
other
)
{
this
->
vertex_buffer_
=
other
.
vertex_buffer_
;
this
->
u_
=
other
.
u_
;
this
->
v_
=
other
.
v_
;
this
->
w_
=
other
.
w_
;
}
Triangle
::
Triangle
(
const
QVector
<
Vertex
>
&
vertex_buffer
,
int
u
,
int
v
,
int
w
)
{
this
->
vertex_buffer_
=
vertex_buffer
;
this
->
u_
=
u
;
this
->
v_
=
v
;
this
->
w_
=
w
;
}
Vertex
Triangle
::
u
()
const
{
return
vertex_buffer_
[
u_
];
}
Vertex
Triangle
::
v
()
const
{
return
vertex_buffer_
[
v_
];
}
Vertex
Triangle
::
w
()
const
{
return
vertex_buffer_
[
w_
];
}
int
Triangle
::
u_idx
()
const
{
return
u_
;
}
int
Triangle
::
v_idx
()
const
{
return
v_
;
}
int
Triangle
::
w_idx
()
const
{
return
w_
;
}
Triangle
&
Triangle
::
operator
=
(
const
Triangle
&
other
)
{
this
->
vertex_buffer_
=
other
.
vertex_buffer_
;
this
->
u_
=
other
.
u_
;
this
->
v_
=
other
.
v_
;
this
->
w_
=
other
.
w_
;
return
*
this
;
}
QDebug
operator
<<
(
QDebug
d
,
const
Triangle
&
triangle
)
{
QDebugStateSaver
saver
(
d
);
d
.
nospace
()
<<
"Triangle("
<<
triangle
.
u_idx
()
<<
", "
<<
triangle
.
v_idx
()
<<
", "
<<
triangle
.
w_idx
()
<<
"; "
<<
triangle
.
u
().
pos
<<
", "
<<
triangle
.
v
().
pos
<<
", "
<<
triangle
.
w
().
pos
<<
")"
;
return
d
;
}
QTProject/triangle.h
0 → 100644
View file @
f93785b6
#pragma once
#ifndef TRIANGLE_H
#define TRIANGLE_H
#include <QDebug>
#include <QVector>
#include "vertex.h"
class
Triangle
{
public
:
Triangle
();
Triangle
(
const
Triangle
&
other
);
Triangle
(
const
QVector
<
Vertex
>
&
vertex_buffer
,
int
u
,
int
v
,
int
w
);
Vertex
u
()
const
;
Vertex
v
()
const
;
Vertex
w
()
const
;
int
u_idx
()
const
;
int
v_idx
()
const
;
int
w_idx
()
const
;
Triangle
&
operator
=
(
const
Triangle
&
other
);
private
:
QVector
<
Vertex
>
vertex_buffer_
;
int
u_
;
int
v_
;
int
w_
;
};
QDebug
operator
<<
(
QDebug
d
,
const
Triangle
&
triangle
);
#endif
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