summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2008-06-23 10:05:47 +0200
committerSamuel Rødal <sroedal@trolltech.com>2008-06-23 10:05:47 +0200
commitf726310976201bf033ac2e39e2d6da7fbf018405 (patch)
treea5014421dda4d02ea186e9180fb1a69973a5fd43
parent5fa5be3907db58381409c9c672854a5850e7b2bf (diff)
Remove stale code.
-rw-r--r--model.cpp54
1 files changed, 2 insertions, 52 deletions
diff --git a/model.cpp b/model.cpp
index 54b5223..70760a5 100644
--- a/model.cpp
+++ b/model.cpp
@@ -97,19 +97,6 @@ Model::Model(const QString &filename)
}
}
-#if 0
- for (int i = 0; i < m_pointIndices.size(); ++i) {
- Point3d p1 = pointData.at(m_pointIndices.at(i));
- for (int j = 0; j < m_pointIndices.at(i); ++j) {
- Point3d p2 = pointData.at(j);
- if (p1.x == p2.x && p1.y == p2.y && p1.z == p2.z) {
- m_pointIndices[i] = j;
- break;
- }
- }
- }
-#endif
-
Point3d bounds = max - min;
qreal scale = 1 / qMax(bounds.x, qMax(bounds.y, bounds.z));
@@ -125,11 +112,6 @@ Model::Model(const QString &filename)
p.z *= scale;
}
- QVector<int> counts(normalData.size());
-
- for (int i = 0; i < counts.size(); ++i)
- counts[i] = 0;
-
for (int i = 0; i < m_pointIndices.size(); i += 3) {
const Point3d a = pointData.at(m_pointIndices.at(i));
const Point3d b = pointData.at(m_pointIndices.at(i+1));
@@ -140,43 +122,11 @@ Model::Model(const QString &filename)
for (int j = 0; j < 3; ++j) {
Point3d old = normalData.at(m_pointIndices.at(i + j));
normalData[m_pointIndices.at(i + j)] = old + normal;
- ++counts[m_pointIndices.at(i + j)];
}
}
- for (int i = 0; i < normalData.size(); ++i) {
- float r = 1. / counts.at(i);
- normalData[i] = normalData.at(i) * r;//.normalize();
- }
-
-#if 0
- Point3d normal;
- for (int i = 0; i < m_pointIndices.size(); ++i) {
-#if 0
- if ((i % 3) == 0) {
- Point3d a = pointData.at(m_pointIndices.at(i));
- Point3d b = pointData.at(m_pointIndices.at(i+1));
- Point3d c = pointData.at(m_pointIndices.at(i+2));
-
- normal = cross(c - a, b - a).normalize();
-
- //float len = normal.x * normal.x +normal.y * normal.y +normal.z * normal.z;
- }
-#endif
-
- m_points << pointData.at(m_pointIndices.at(i));
- m_normals << normalData.at(m_pointIndices.at(i)).normalize();
-
-#if 0
- Point3d p = m_points.last();
- Point3d n = m_normals.last();
-
- printf("Index: %d, point: %f %f %f, normal: %f %f %f\n", m_pointIndices.at(i),
- p.x, p.y, p.z,
- n.x, n.y, n.z);
-#endif
- }
-#endif
+ for (int i = 0; i < normalData.size(); ++i)
+ normalData[i] = normalData.at(i).normalize();
m_points = pointData;
m_normals = normalData;