Commit 885e3f3d by Kai Westerkamp

Merge branch 'patchRender' of…

Merge branch 'patchRender' of ssh://git.breab.org:2223/kai/Unterteilungsalgorithmen into patchRender
parents e28d3501 6fbdc2c2
......@@ -85,6 +85,7 @@ private:
/**
* @brief matchAndCompleteTriangle if vertices at indices tx ty matches vertices at indices sxsy, sysz or szsy,
* fill tz with third source vertex index.
* both s(xyz) and t(xyz) are in SAME DIRECTION: matches sx with tx, sy with ty (..)
* @param sx source triangle: first vertex index
* @param sy source triangle: second vertex index
* @param sz source triangle: third vertex index
......@@ -95,6 +96,7 @@ private:
* @return true if triangles could be matched and tz was filled.
*/
bool matchAndCompleteTriangle(unsigned int sx, unsigned int sy, unsigned int sz, unsigned int tx, unsigned int ty, unsigned int &tz, QVector<Vertex> vb);
};
#endif
......@@ -64,6 +64,11 @@ bool Triangle::get_shared_edge(Triangle other, Edge &edge_a, Edge &edge_b) const
return false;
}
bool Triangle::hasSharedEdge(Triangle other){
Edge a,b;
return get_shared_edge(other,a,b);
}
bool Triangle::get_shared_edge_(const Triangle &other, Edge &edge_a, Edge &edge_b) const {
if (u().samePos(other.u())) {
if (v().samePos(other.w())) {
......@@ -108,6 +113,21 @@ bool Triangle::get_shared_edge_(const Triangle &other, Edge &edge_a, Edge &edge_
return false;
}
//e.g. first.name = uv, next.name = vw
bool Triangle::next_ctrclockwise(Edge first, Edge next) const{
return (first.name == Triangle::Edge::Name::uv &&
next.name == Triangle::Edge::Name::vw)
||(first.name == Triangle::Edge::Name::vw &&
next.name == Triangle::Edge::Name::wu)
||(first.name == Triangle::Edge::Name::wu &&
next.name == Triangle::Edge::Name::uv);
}
//e.g. first.name = vw, next.name = uv
bool Triangle::next_clockwise(Edge first, Edge next) const{
return next_ctrclockwise(next,first);
}
Triangle &Triangle::operator=(const Triangle &other) {
this->vertex_buffer_ = other.vertex_buffer_;
this->u_ = other.u_;
......
......@@ -35,6 +35,8 @@ class Triangle {
bool get_shared_edge(Triangle other, Edge &edge_a, Edge &edge_b) const;
bool hasSharedEdge(Triangle other);
Triangle &operator=(const Triangle &other);
// == and < both ignore the vertex buffer, they only compare indices.
......@@ -42,6 +44,9 @@ class Triangle {
bool operator==(const Triangle &other) const;
bool operator<(const Triangle &other) const;
bool next_ctrclockwise(Edge first, Edge next) const;
bool next_clockwise(Edge first, Edge next) const;
private:
QVector<Vertex> vertex_buffer_;
unsigned int u_;
......
......@@ -22,11 +22,6 @@ struct Vertex
bool samePos(const Vertex& other) const;
bool operator==(const Vertex& other) const
{
return samePos(other);
}
};
#pragma pack(pop)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment