Fix build
parent
4bdbdd496a
commit
3e1fde4260
|
@ -49,6 +49,7 @@ install:
|
||||||
|
|
||||||
# (Mac) Install Qt5
|
# (Mac) Install Qt5
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then HOMEBREW_VERBOSE_USING_DOTS=1 brew reinstall --verbose qt; fi
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then HOMEBREW_VERBOSE_USING_DOTS=1 brew reinstall --verbose qt; fi
|
||||||
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export PATH="/usr/local/opt/qt/bin:$(brew --prefix)/bin:$PATH"; fi
|
||||||
|
|
||||||
# (Linux) Install Qt5
|
# (Linux) Install Qt5
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install qt59base qt59tools --force-yes; fi
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install qt59base qt59tools --force-yes; fi
|
||||||
|
|
|
@ -61,7 +61,7 @@ If you have done programming code changes, including the example code listed in
|
||||||
|
|
||||||
License
|
License
|
||||||
-----------
|
-----------
|
||||||
Dust3D software binaries and source code use MIT License, which means you can use it freely no matter for personal or for commercial purpose. However, Dust3D's UI built on Qt5, the Mesh Union Algorithm based on CGAL library, and there are other algorithms such as Gift Wrapping, Bmesh, and so on which implemented in the meshlite repository, all these, may have other license restrictions.
|
Dust3D software binaries and source code use MIT License, which means you can use it freely no matter for personal or for commercial purpose.
|
||||||
|
|
||||||
Acknowledgements
|
Acknowledgements
|
||||||
-------------------
|
-------------------
|
||||||
|
|
|
@ -305,8 +305,8 @@ HEADERS += thirdparty/nodemesh/nodemesh/builder.h
|
||||||
SOURCES += thirdparty/nodemesh/nodemesh/combiner.cpp
|
SOURCES += thirdparty/nodemesh/nodemesh/combiner.cpp
|
||||||
HEADERS += thirdparty/nodemesh/nodemesh/combiner.h
|
HEADERS += thirdparty/nodemesh/nodemesh/combiner.h
|
||||||
|
|
||||||
SOURCES += thirdparty/nodemesh/nodemesh/util.cpp
|
SOURCES += thirdparty/nodemesh/nodemesh/misc.cpp
|
||||||
HEADERS += thirdparty/nodemesh/nodemesh/util.h
|
HEADERS += thirdparty/nodemesh/nodemesh/misc.h
|
||||||
|
|
||||||
SOURCES += thirdparty/nodemesh/nodemesh/positionkey.cpp
|
SOURCES += thirdparty/nodemesh/nodemesh/positionkey.cpp
|
||||||
HEADERS += thirdparty/nodemesh/nodemesh/positionkey.h
|
HEADERS += thirdparty/nodemesh/nodemesh/positionkey.h
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
#include <nodemesh/builder.h>
|
#include <nodemesh/builder.h>
|
||||||
#include <nodemesh/modifier.h>
|
#include <nodemesh/modifier.h>
|
||||||
#include <nodemesh/util.h>
|
#include <nodemesh/misc.h>
|
||||||
#include <nodemesh/recombiner.h>
|
#include <nodemesh/recombiner.h>
|
||||||
#include "meshgenerator.h"
|
#include "meshgenerator.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#include <nodemesh/box.h>
|
#include <nodemesh/box.h>
|
||||||
#include <nodemesh/util.h>
|
#include <nodemesh/misc.h>
|
||||||
#include <nodemesh/cgalmesh.h>
|
#include <nodemesh/cgalmesh.h>
|
||||||
#include <CGAL/Simple_cartesian.h>
|
#include <CGAL/Simple_cartesian.h>
|
||||||
#include <CGAL/subdivision_method_3.h>
|
#include <CGAL/subdivision_method_3.h>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include <nodemesh/stitcher.h>
|
#include <nodemesh/stitcher.h>
|
||||||
#include <nodemesh/box.h>
|
#include <nodemesh/box.h>
|
||||||
#include <nodemesh/combiner.h>
|
#include <nodemesh/combiner.h>
|
||||||
#include <nodemesh/util.h>
|
#include <nodemesh/misc.h>
|
||||||
|
|
||||||
#define WRAP_STEP_BACK_FACTOR 0.1 // 0.1 ~ 0.9
|
#define WRAP_STEP_BACK_FACTOR 0.1 // 0.1 ~ 0.9
|
||||||
#define WRAP_WELD_FACTOR 0.01 // Allowed distance: WELD_FACTOR * radius
|
#define WRAP_WELD_FACTOR 0.01 // Allowed distance: WELD_FACTOR * radius
|
||||||
|
@ -31,9 +31,9 @@ size_t Builder::addNode(const QVector3D &position, float radius, const std::vect
|
||||||
size_t Builder::addEdge(size_t firstNodeIndex, size_t secondNodeIndex)
|
size_t Builder::addEdge(size_t firstNodeIndex, size_t secondNodeIndex)
|
||||||
{
|
{
|
||||||
size_t edgeIndex = m_edges.size();
|
size_t edgeIndex = m_edges.size();
|
||||||
m_edges.push_back(Edge {
|
Edge edge;
|
||||||
.nodes = {firstNodeIndex, secondNodeIndex}
|
edge.nodes = {firstNodeIndex, secondNodeIndex};
|
||||||
});
|
m_edges.push_back(edge);
|
||||||
m_nodes[firstNodeIndex].edges.push_back(edgeIndex);
|
m_nodes[firstNodeIndex].edges.push_back(edgeIndex);
|
||||||
m_nodes[secondNodeIndex].edges.push_back(edgeIndex);
|
m_nodes[secondNodeIndex].edges.push_back(edgeIndex);
|
||||||
//qDebug() << "addEdge" << firstNodeIndex << secondNodeIndex;
|
//qDebug() << "addEdge" << firstNodeIndex << secondNodeIndex;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#include <nodemesh/combiner.h>
|
#include <nodemesh/combiner.h>
|
||||||
#include <nodemesh/util.h>
|
#include <nodemesh/misc.h>
|
||||||
#include <nodemesh/positionkey.h>
|
#include <nodemesh/positionkey.h>
|
||||||
#include <nodemesh/cgalmesh.h>
|
#include <nodemesh/cgalmesh.h>
|
||||||
#include <CGAL/Polygon_mesh_processing/corefinement.h>
|
#include <CGAL/Polygon_mesh_processing/corefinement.h>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include <nodemesh/util.h>
|
#include <nodemesh/misc.h>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
|
@ -6,25 +6,28 @@
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
namespace nodemesh
|
#ifndef M_PI
|
||||||
{
|
#define M_PI 3.14159265358979323846
|
||||||
|
#endif
|
||||||
|
|
||||||
float radianToDegree(float r)
|
using namespace nodemesh;
|
||||||
|
|
||||||
|
float nodemesh::radianToDegree(float r)
|
||||||
{
|
{
|
||||||
return r * 180.0 / M_PI;
|
return r * 180.0 / M_PI;
|
||||||
}
|
}
|
||||||
|
|
||||||
float angleBetween(const QVector3D &v1, const QVector3D &v2)
|
float nodemesh::angleBetween(const QVector3D &v1, const QVector3D &v2)
|
||||||
{
|
{
|
||||||
return atan2(QVector3D::crossProduct(v1, v2).length(), QVector3D::dotProduct(v1, v2));
|
return atan2(QVector3D::crossProduct(v1, v2).length(), QVector3D::dotProduct(v1, v2));
|
||||||
}
|
}
|
||||||
|
|
||||||
float degreeBetween(const QVector3D &v1, const QVector3D &v2)
|
float nodemesh::degreeBetween(const QVector3D &v1, const QVector3D &v2)
|
||||||
{
|
{
|
||||||
return radianToDegree(angleBetween(v1, v2));
|
return radianToDegree(angleBetween(v1, v2));
|
||||||
}
|
}
|
||||||
|
|
||||||
float degreeBetweenIn360(const QVector3D &a, const QVector3D &b, const QVector3D &direct)
|
float nodemesh::degreeBetweenIn360(const QVector3D &a, const QVector3D &b, const QVector3D &direct)
|
||||||
{
|
{
|
||||||
auto angle = radianToDegree(angleBetween(a, b));
|
auto angle = radianToDegree(angleBetween(a, b));
|
||||||
auto c = QVector3D::crossProduct(a, b);
|
auto c = QVector3D::crossProduct(a, b);
|
||||||
|
@ -34,7 +37,7 @@ float degreeBetweenIn360(const QVector3D &a, const QVector3D &b, const QVector3D
|
||||||
return angle;
|
return angle;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector3D polygonNormal(const std::vector<QVector3D> &vertices, const std::vector<size_t> &polygon)
|
QVector3D nodemesh::polygonNormal(const std::vector<QVector3D> &vertices, const std::vector<size_t> &polygon)
|
||||||
{
|
{
|
||||||
QVector3D normal;
|
QVector3D normal;
|
||||||
for (size_t i = 0; i < polygon.size(); ++i) {
|
for (size_t i = 0; i < polygon.size(); ++i) {
|
||||||
|
@ -48,7 +51,7 @@ QVector3D polygonNormal(const std::vector<QVector3D> &vertices, const std::vecto
|
||||||
return normal.normalized();
|
return normal.normalized();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pointInTriangle(const QVector3D &a, const QVector3D &b, const QVector3D &c, const QVector3D &p)
|
bool nodemesh::pointInTriangle(const QVector3D &a, const QVector3D &b, const QVector3D &c, const QVector3D &p)
|
||||||
{
|
{
|
||||||
auto u = b - a;
|
auto u = b - a;
|
||||||
auto v = c - a;
|
auto v = c - a;
|
||||||
|
@ -69,7 +72,7 @@ bool pointInTriangle(const QVector3D &a, const QVector3D &b, const QVector3D &c,
|
||||||
return r + t <= 1.0;
|
return r + t <= 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void triangulate(const std::vector<QVector3D> &vertices, const std::vector<std::vector<size_t>> &faces, std::vector<std::vector<size_t>> &triangles)
|
void nodemesh::triangulate(const std::vector<QVector3D> &vertices, const std::vector<std::vector<size_t>> &faces, std::vector<std::vector<size_t>> &triangles)
|
||||||
{
|
{
|
||||||
std::vector<std::vector<size_t>> rings;
|
std::vector<std::vector<size_t>> rings;
|
||||||
for (const auto &face: faces) {
|
for (const auto &face: faces) {
|
||||||
|
@ -129,7 +132,7 @@ void triangulate(const std::vector<QVector3D> &vertices, const std::vector<std::
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void exportMeshAsObj(const std::vector<QVector3D> &vertices, const std::vector<std::vector<size_t>> &faces, const QString &filename, const std::set<size_t> *excludeFacesOfVertices)
|
void nodemesh::exportMeshAsObj(const std::vector<QVector3D> &vertices, const std::vector<std::vector<size_t>> &faces, const QString &filename, const std::set<size_t> *excludeFacesOfVertices)
|
||||||
{
|
{
|
||||||
QFile file(filename);
|
QFile file(filename);
|
||||||
if (file.open(QIODevice::WriteOnly)) {
|
if (file.open(QIODevice::WriteOnly)) {
|
||||||
|
@ -157,7 +160,7 @@ void exportMeshAsObj(const std::vector<QVector3D> &vertices, const std::vector<s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void exportMeshAsObjWithNormals(const std::vector<QVector3D> &vertices, const std::vector<std::vector<size_t>> &faces, const QString &filename,
|
void nodemesh::exportMeshAsObjWithNormals(const std::vector<QVector3D> &vertices, const std::vector<std::vector<size_t>> &faces, const QString &filename,
|
||||||
const std::vector<QVector3D> &triangleVertexNormals)
|
const std::vector<QVector3D> &triangleVertexNormals)
|
||||||
{
|
{
|
||||||
QFile file(filename);
|
QFile file(filename);
|
||||||
|
@ -182,14 +185,14 @@ void exportMeshAsObjWithNormals(const std::vector<QVector3D> &vertices, const st
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float areaOfTriangle(const QVector3D &a, const QVector3D &b, const QVector3D &c)
|
float nodemesh::areaOfTriangle(const QVector3D &a, const QVector3D &b, const QVector3D &c)
|
||||||
{
|
{
|
||||||
auto ab = b - a;
|
auto ab = b - a;
|
||||||
auto ac = c - a;
|
auto ac = c - a;
|
||||||
return 0.5 * QVector3D::crossProduct(ab, ac).length();
|
return 0.5 * QVector3D::crossProduct(ab, ac).length();
|
||||||
}
|
}
|
||||||
|
|
||||||
void angleSmooth(const std::vector<QVector3D> &vertices,
|
void nodemesh::angleSmooth(const std::vector<QVector3D> &vertices,
|
||||||
const std::vector<std::vector<size_t>> &triangles,
|
const std::vector<std::vector<size_t>> &triangles,
|
||||||
const std::vector<QVector3D> &triangleNormals,
|
const std::vector<QVector3D> &triangleNormals,
|
||||||
float thresholdAngleDegrees,
|
float thresholdAngleDegrees,
|
||||||
|
@ -247,7 +250,7 @@ void angleSmooth(const std::vector<QVector3D> &vertices,
|
||||||
item.normalize();
|
item.normalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void recoverQuads(const std::vector<QVector3D> &vertices, const std::vector<std::vector<size_t>> &triangles, const std::set<std::pair<PositionKey, PositionKey>> &sharedQuadEdges, std::vector<std::vector<size_t>> &triangleAndQuads)
|
void nodemesh::recoverQuads(const std::vector<QVector3D> &vertices, const std::vector<std::vector<size_t>> &triangles, const std::set<std::pair<PositionKey, PositionKey>> &sharedQuadEdges, std::vector<std::vector<size_t>> &triangleAndQuads)
|
||||||
{
|
{
|
||||||
std::vector<PositionKey> verticesPositionKeys;
|
std::vector<PositionKey> verticesPositionKeys;
|
||||||
for (const auto &position: vertices) {
|
for (const auto &position: vertices) {
|
||||||
|
@ -293,7 +296,7 @@ void recoverQuads(const std::vector<QVector3D> &vertices, const std::vector<std:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t weldSeam(const std::vector<QVector3D> &sourceVertices, const std::vector<std::vector<size_t>> &sourceTriangles,
|
size_t nodemesh::weldSeam(const std::vector<QVector3D> &sourceVertices, const std::vector<std::vector<size_t>> &sourceTriangles,
|
||||||
float allowedSmallestDistance, const std::set<PositionKey> &excludePositions,
|
float allowedSmallestDistance, const std::set<PositionKey> &excludePositions,
|
||||||
std::vector<QVector3D> &destVertices, std::vector<std::vector<size_t>> &destTriangles)
|
std::vector<QVector3D> &destVertices, std::vector<std::vector<size_t>> &destTriangles)
|
||||||
{
|
{
|
||||||
|
@ -421,7 +424,7 @@ size_t weldSeam(const std::vector<QVector3D> &sourceVertices, const std::vector<
|
||||||
return weldedCount;
|
return weldedCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isManifold(const std::vector<std::vector<size_t>> &faces)
|
bool nodemesh::isManifold(const std::vector<std::vector<size_t>> &faces)
|
||||||
{
|
{
|
||||||
std::set<std::pair<size_t, size_t>> halfEdges;
|
std::set<std::pair<size_t, size_t>> halfEdges;
|
||||||
for (const auto &face: faces) {
|
for (const auto &face: faces) {
|
||||||
|
@ -439,7 +442,7 @@ bool isManifold(const std::vector<std::vector<size_t>> &faces)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void trim(std::vector<QVector3D> *vertices, bool normalize)
|
void nodemesh::trim(std::vector<QVector3D> *vertices, bool normalize)
|
||||||
{
|
{
|
||||||
float xLow = std::numeric_limits<float>::max();
|
float xLow = std::numeric_limits<float>::max();
|
||||||
float xHigh = std::numeric_limits<float>::lowest();
|
float xHigh = std::numeric_limits<float>::lowest();
|
||||||
|
@ -488,5 +491,3 @@ void trim(std::vector<QVector3D> *vertices, bool normalize)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef NODEMESH_UTIL_H
|
#ifndef NODEMESH_MISC_H
|
||||||
#define NODEMESH_UTIL_H
|
#define NODEMESH_MISC_H
|
||||||
#include <QVector3D>
|
#include <QVector3D>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <set>
|
#include <set>
|
|
@ -1,6 +1,6 @@
|
||||||
#include <nodemesh/recombiner.h>
|
#include <nodemesh/recombiner.h>
|
||||||
#include <nodemesh/positionkey.h>
|
#include <nodemesh/positionkey.h>
|
||||||
#include <nodemesh/util.h>
|
#include <nodemesh/misc.h>
|
||||||
#include <nodemesh/wrapper.h>
|
#include <nodemesh/wrapper.h>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#include <nodemesh/stitcher.h>
|
#include <nodemesh/stitcher.h>
|
||||||
#include <nodemesh/util.h>
|
#include <nodemesh/misc.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#include <nodemesh/wrapper.h>
|
#include <nodemesh/wrapper.h>
|
||||||
#include <nodemesh/util.h>
|
#include <nodemesh/misc.h>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ void Wrapper::addStartup(size_t p1, size_t p2, const QVector3D &baseNormal)
|
||||||
{
|
{
|
||||||
if (m_items.empty())
|
if (m_items.empty())
|
||||||
addItem(p1, p2, baseNormal);
|
addItem(p1, p2, baseNormal);
|
||||||
m_generatedFaceEdgesMap.insert({WrapItemKey {.p1 = p2, .p2 = p1}, {0, false}});
|
m_generatedFaceEdgesMap.insert({WrapItemKey {p2, p1}, {0, false}});
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector3D Wrapper::calculateFaceVector(size_t p1, size_t p2, const QVector3D &baseNormal)
|
QVector3D Wrapper::calculateFaceVector(size_t p1, size_t p2, const QVector3D &baseNormal)
|
||||||
|
@ -112,14 +112,20 @@ void Wrapper::addItem(size_t p1, size_t p2, const QVector3D &baseNormal)
|
||||||
if (isEdgeGenerated(p1, p2) || isEdgeGenerated(p2, p1))
|
if (isEdgeGenerated(p1, p2) || isEdgeGenerated(p2, p1))
|
||||||
return;
|
return;
|
||||||
auto index = m_items.size();
|
auto index = m_items.size();
|
||||||
m_items.push_back(WrapItem {.p3 = 0, .p1 = p1, .p2 = p2, .baseNormal = baseNormal, .processed = false});
|
WrapItem item;
|
||||||
m_itemsMap.insert({WrapItemKey {.p1 = p1, .p2 = p2}, index});
|
item.p3 = 0;
|
||||||
|
item.p1 = p1;
|
||||||
|
item.p2 = p2;
|
||||||
|
item.baseNormal = baseNormal;
|
||||||
|
item.processed = false;
|
||||||
|
m_items.push_back(item);
|
||||||
|
m_itemsMap.insert({WrapItemKey {p1, p2}, index});
|
||||||
m_itemsList.push_front(index);
|
m_itemsList.push_front(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<size_t, bool> Wrapper::findItem(size_t p1, size_t p2)
|
std::pair<size_t, bool> Wrapper::findItem(size_t p1, size_t p2)
|
||||||
{
|
{
|
||||||
auto key = WrapItemKey {.p1 = p1, .p2 = p2};
|
auto key = WrapItemKey {p1, p2};
|
||||||
auto findResult = m_itemsMap.find(key);
|
auto findResult = m_itemsMap.find(key);
|
||||||
if (findResult == m_itemsMap.end()) {
|
if (findResult == m_itemsMap.end()) {
|
||||||
return {0, false};
|
return {0, false};
|
||||||
|
@ -129,7 +135,7 @@ std::pair<size_t, bool> Wrapper::findItem(size_t p1, size_t p2)
|
||||||
|
|
||||||
bool Wrapper::isEdgeGenerated(size_t p1, size_t p2)
|
bool Wrapper::isEdgeGenerated(size_t p1, size_t p2)
|
||||||
{
|
{
|
||||||
auto key = WrapItemKey {.p1 = p1, .p2 = p2};
|
auto key = WrapItemKey {p1, p2};
|
||||||
if (m_generatedFaceEdgesMap.find(key) == m_generatedFaceEdgesMap.end())
|
if (m_generatedFaceEdgesMap.find(key) == m_generatedFaceEdgesMap.end())
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
|
@ -187,8 +193,8 @@ std::pair<size_t, bool> Wrapper::peekItem()
|
||||||
|
|
||||||
bool Wrapper::isEdgeClosed(size_t p1, size_t p2)
|
bool Wrapper::isEdgeClosed(size_t p1, size_t p2)
|
||||||
{
|
{
|
||||||
return m_generatedFaceEdgesMap.find(WrapItemKey {.p1 = p1, .p2 = p2}) != m_generatedFaceEdgesMap.end() &&
|
return m_generatedFaceEdgesMap.find(WrapItemKey {p1, p2}) != m_generatedFaceEdgesMap.end() &&
|
||||||
m_generatedFaceEdgesMap.find(WrapItemKey {.p1 = p2, .p2 = p1}) != m_generatedFaceEdgesMap.end();
|
m_generatedFaceEdgesMap.find(WrapItemKey {p2, p1}) != m_generatedFaceEdgesMap.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Wrapper::isVertexClosed(size_t vertexIndex)
|
bool Wrapper::isVertexClosed(size_t vertexIndex)
|
||||||
|
@ -223,12 +229,12 @@ void Wrapper::generate()
|
||||||
m_sourceVertices[p2].position,
|
m_sourceVertices[p2].position,
|
||||||
m_sourceVertices[p3].position);
|
m_sourceVertices[p3].position);
|
||||||
auto faceIndex = m_generatedFaces.size();
|
auto faceIndex = m_generatedFaces.size();
|
||||||
m_generatedFaces.push_back(Face3 {.p1 = p1, .p2 = p2, .p3 = p3, .normal = baseNormal, .index = faceIndex});
|
m_generatedFaces.push_back(Face3 {p1, p2, p3, baseNormal, faceIndex});
|
||||||
addItem(p3, p2, baseNormal);
|
addItem(p3, p2, baseNormal);
|
||||||
addItem(p1, p3, baseNormal);
|
addItem(p1, p3, baseNormal);
|
||||||
m_generatedFaceEdgesMap.insert({WrapItemKey {.p1 = p1, .p2 = p2}, {faceIndex, true}});
|
m_generatedFaceEdgesMap.insert({WrapItemKey {p1, p2}, {faceIndex, true}});
|
||||||
m_generatedFaceEdgesMap.insert({WrapItemKey {.p1 = p2, .p2 = p3}, {faceIndex, true}});
|
m_generatedFaceEdgesMap.insert({WrapItemKey {p2, p3}, {faceIndex, true}});
|
||||||
m_generatedFaceEdgesMap.insert({WrapItemKey {.p1 = p3, .p2 = p1}, {faceIndex, true}});
|
m_generatedFaceEdgesMap.insert({WrapItemKey {p3, p1}, {faceIndex, true}});
|
||||||
m_generatedVertexEdgesMap[p1].push_back(p2);
|
m_generatedVertexEdgesMap[p1].push_back(p2);
|
||||||
m_generatedVertexEdgesMap[p1].push_back(p3);
|
m_generatedVertexEdgesMap[p1].push_back(p3);
|
||||||
m_generatedVertexEdgesMap[p2].push_back(p3);
|
m_generatedVertexEdgesMap[p2].push_back(p3);
|
||||||
|
@ -255,7 +261,7 @@ std::pair<size_t, bool> Wrapper::findPairFace3(const Face3 &f, std::map<size_t,
|
||||||
for (size_t i = 0; i < indices.size(); ++i) {
|
for (size_t i = 0; i < indices.size(); ++i) {
|
||||||
auto j = (i + 1) % indices.size();
|
auto j = (i + 1) % indices.size();
|
||||||
auto k = (i + 2) % indices.size();
|
auto k = (i + 2) % indices.size();
|
||||||
auto findPairedFace3Id = m_generatedFaceEdgesMap.find(WrapItemKey {.p1 = indices[j], .p2 = indices[i]});
|
auto findPairedFace3Id = m_generatedFaceEdgesMap.find(WrapItemKey {indices[j], indices[i]});
|
||||||
if (findPairedFace3Id != m_generatedFaceEdgesMap.end() && findPairedFace3Id->second.second) {
|
if (findPairedFace3Id != m_generatedFaceEdgesMap.end() && findPairedFace3Id->second.second) {
|
||||||
auto pairedFace3Id = findPairedFace3Id->second.first;
|
auto pairedFace3Id = findPairedFace3Id->second.first;
|
||||||
if (usedIds.find(pairedFace3Id) != usedIds.end())
|
if (usedIds.find(pairedFace3Id) != usedIds.end())
|
||||||
|
@ -264,7 +270,7 @@ std::pair<size_t, bool> Wrapper::findPairFace3(const Face3 &f, std::map<size_t,
|
||||||
if (!almostEqual(pairedFace3.normal, f.normal))
|
if (!almostEqual(pairedFace3.normal, f.normal))
|
||||||
continue;
|
continue;
|
||||||
auto anotherIndex = anotherVertexIndexOfFace3(pairedFace3, indices[j], indices[i]);
|
auto anotherIndex = anotherVertexIndexOfFace3(pairedFace3, indices[j], indices[i]);
|
||||||
auto mergedF = Face4 {.p1 = indices[i], .p2 = anotherIndex, .p3 = indices[j], .p4 = indices[k]};
|
auto mergedF = Face4 {indices[i], anotherIndex, indices[j], indices[k]};
|
||||||
q.push_back(mergedF);
|
q.push_back(mergedF);
|
||||||
return {pairedFace3Id, true};
|
return {pairedFace3Id, true};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue