Changeset 2832 for trunk/packages/vizservers/nanovis
- Timestamp:
- Mar 9, 2012 11:50:51 AM (12 years ago)
- Location:
- trunk/packages/vizservers/nanovis
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/nanovis/NvFlowVisRenderer.h
r2817 r2832 24 24 25 25 class NvFlowVisRenderer { 26 enum {27 MAX_PARTICLE_RENDERER = 4,28 };29 30 int _psys_width;31 int _psys_height;32 CGcontext context;33 34 std::map<std::string, NvVectorField*> _vectorFieldMap;35 36 bool _activated;37 38 //NvLIC* licRenderer[3];39 26 public: 40 27 NvFlowVisRenderer(int w, int h, CGcontext context); 28 41 29 ~NvFlowVisRenderer(); 42 30 43 31 void initialize(); 32 44 33 void initialize(const std::string& vfName); 34 45 35 void advect(); 36 46 37 void reset(); 38 47 39 void render(); 48 40 49 void addVectorField(Volume *volPtr, const Vector3& ori, float scaleX,50 41 void addVectorField(Volume *volPtr, const Vector3& ori, float scaleX, 42 float scaleY, float scaleZ, float max); 51 43 52 void addVectorField(const std::string& vfName, Volume* volPtr, const Vector3& ori, float scaleX, float scaleY, float scaleZ, float max); 44 void addVectorField(const std::string& vfName, Volume *volPtr, const Vector3& ori, 45 float scaleX, float scaleY, float scaleZ, float max); 46 53 47 void removeVectorField(const std::string& vfName); 54 48 55 49 void addPlane(const std::string& vfName, const std::string& name); 50 56 51 void removePlane(const std::string& vfName, const std::string& name); 57 52 … … 66 61 */ 67 62 void setPlanePos(const std::string& vfName, const std::string& name, float pos); 63 68 64 void setParticleColor(const std::string& vfName, const std::string& name, const Vector4& color); 65 69 66 void activatePlane(const std::string& vfName, const std::string& name); 67 70 68 void deactivatePlane(const std::string& vfName, const std::string& name); 71 69 72 70 void activateVectorField(const std::string& vfName); 71 73 72 void deactivateVectorField(const std::string& vfName); 74 73 … … 76 75 // DEVICE SHAPE 77 76 void addDeviceShape(const std::string& vfName, const std::string& name, const NvDeviceShape& shape); 77 78 78 void removeDeviceShape(const std::string& vfName, const std::string& name); 79 79 80 void activateDeviceShape(const std::string& vfName); 81 80 82 void deactivateDeviceShape(const std::string& vfName); 83 81 84 void activateDeviceShape(const std::string& vfName, const std::string& name); 85 82 86 void deactivateDeviceShape(const std::string& vfName, const std::string& name); 83 bool active(void) { 87 88 bool active() 89 { 84 90 return _activated; 85 91 } 86 void active(bool state) { 92 93 void active(bool state) 94 { 87 95 _activated = state; 88 96 } 97 98 private: 99 int _psys_width; 100 int _psys_height; 101 CGcontext context; 102 103 std::map<std::string, NvVectorField *> _vectorFieldMap; 104 105 bool _activated; 89 106 }; 90 107 -
trunk/packages/vizservers/nanovis/PCASplit.cpp
r2822 r2832 1 1 /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2 2 #include <stdio.h> 3 #include "PCASplit.h"4 3 5 4 #define WANT_STREAM // include.h will get stream fns … … 10 9 #include <newmatrc.h> 11 10 11 #include "PCASplit.h" 12 12 13 #ifdef use_namespace 13 14 using namespace NEWMAT; // access NEWMAT namespace 14 15 #endif 15 16 16 namespace PCA { 17 using namespace PCA; 17 18 18 19 PCASplit::PCASplit() : 19 _maxLevel(4), 20 _minDistance(0.5f), 21 _distanceScale(0.2f), 22 _indexCount(0), 20 _maxLevel(4), 21 _minDistance(0.5f), 22 _distanceScale(0.2f), 23 _indexCount(0), 23 24 _finalMaxLevel(0) 24 25 { … … 38 39 39 40 void 40 PCASplit::computeCentroid(Point *data, int count, Vector3& mean)41 { 42 float sumx = 0, sumy = 0, sumz = 0;41 PCASplit::computeCentroid(Point *data, int count, Vector3& mean) 42 { 43 float sumx = 0, sumy = 0, sumz = 0; 43 44 float size = 0; 44 45 float sumsize = 0; … … 55 56 56 57 void 57 PCASplit::computeCovariant(Point *data, int count, const Vector3& mean,58 float*m)58 PCASplit::computeCovariant(Point *data, int count, const Vector3& mean, 59 float *m) 59 60 { 60 61 memset(m, 0, sizeof(float) * 9); … … 82 83 83 84 void 84 PCASplit::computeDistortion(Point *data, int count, const Vector3& mean,85 PCASplit::computeDistortion(Point *data, int count, const Vector3& mean, 85 86 float& distortion, float& finalSize) 86 87 { … … 91 92 float distance; 92 93 for (int i = 0; i < count; ++i) { 93 94 95 96 97 98 99 100 101 102 103 104 105 106 94 // sum 95 distance = mean.distanceSquare(data[i].position.x, data[i].position.y, data[i].position.z); 96 distortion += distance; 97 98 if (data[i].size > maxSize) { 99 maxSize = data[i].size; 100 } 101 102 /* 103 finalSize += data[i].size * sqrt(distance); 104 */ 105 if (distance > finalSize) { 106 finalSize = distance; 107 } 107 108 } 108 109 // equation 2 … … 110 111 finalSize = sqrt (finalSize) + maxSize; 111 112 } 112 113 113 114 void 114 115 PCASplit::init() … … 118 119 } 119 120 120 Cluster *121 PCASplit::createClusterBlock(ClusterListNode *clusterList, int count, int level)121 Cluster * 122 PCASplit::createClusterBlock(ClusterListNode *clusterList, int count, int level) 122 123 { 123 124 static int cc = 0; 124 125 cc += count; 125 Cluster *clusterBlock = new Cluster[count];126 Cluster *clusterBlock = new Cluster[count]; 126 127 127 128 _clusterHeader->numOfClusters[level - 1] = count; … … 129 130 130 131 TRACE("Cluster created %d [in level %d]:total %d\n", count, level, cc); 131 132 132 133 int i = 0; 133 ClusterListNode *clusterNode = clusterList;134 ClusterListNode *clusterNode = clusterList; 134 135 while (clusterNode) { 135 136 137 138 139 140 136 clusterBlock[i].centroid = clusterList->data->centroid_t; 137 clusterBlock[i].level = level; 138 clusterBlock[i].scale = clusterList->data->scale_t; 139 140 clusterNode = clusterNode->next; 141 ++i; 141 142 } 142 143 if (count != i) { 143 144 ERROR("Problem walking clusterList: count: %d, i: %d\n", count, i); 144 145 } 145 146 return clusterBlock; 146 147 } 147 148 148 ClusterAccel* PCASplit::doIt(Point* data, int count) 149 ClusterAccel * 150 PCASplit::doIt(Point *data, int count) 149 151 { 150 152 init(); 151 153 152 154 _clusterHeader = new ClusterAccel(_maxLevel); 153 154 Cluster *root = new Cluster;155 Cluster_t *cluster_t = new Cluster_t();155 156 Cluster *root = new Cluster; 157 Cluster_t *cluster_t = new Cluster_t(); 156 158 cluster_t->points_t = data; 157 159 cluster_t->numOfPoints_t = count; 158 160 root->level = 1; 159 161 160 162 _clusterHeader->root = root; 161 163 _clusterHeader->numOfClusters[0] = 1; 162 164 _clusterHeader->startPointerCluster[0] = root; 163 165 164 166 Vector3 mean; 165 167 float distortion, scale; 166 168 167 169 computeCentroid(cluster_t->points_t, cluster_t->numOfPoints_t, mean); 168 170 computeDistortion(cluster_t->points_t, cluster_t->numOfPoints_t, mean, 169 171 distortion, scale); 170 172 171 173 cluster_t->centroid_t = mean; 172 174 cluster_t->scale_t = scale; 173 175 174 176 float mindistance = _minDistance; 175 177 int level = 2; 176 178 177 ClusterListNode *clustNodeList = &(_memClusterChunk2[0]);179 ClusterListNode *clustNodeList = &(_memClusterChunk2[0]); 178 180 clustNodeList->data = cluster_t; 179 181 clustNodeList->next = 0; 180 182 181 183 _curRoot = root; 182 184 do { … … 192 194 193 195 clustNodeList = _curClusterNode; 194 195 196 } while (level <= _maxLevel); 196 197 … … 199 200 200 201 void 201 PCASplit::addLeafCluster(Cluster_t *cluster)202 { 203 ClusterListNode *clusterNode =204 202 PCASplit::addLeafCluster(Cluster_t *cluster) 203 { 204 ClusterListNode *clusterNode = 205 &_curMemClusterChunk[_memClusterChunkIndex++]; 205 206 clusterNode->data = cluster; 206 207 clusterNode->next = _curClusterNode; … … 210 211 211 212 void 212 PCASplit::split(Point *data, int count, float limit)213 PCASplit::split(Point *data, int count, float limit) 213 214 { 214 215 Vector3 mean; … … 218 219 float scale, distortion; 219 220 computeDistortion(data, count, mean, distortion, scale); 220 221 221 222 //if (distortion < limit) 222 223 if (scale < limit) { 223 Cluster_t *cluster_t = new Cluster_t();224 Cluster_t *cluster_t = new Cluster_t(); 224 225 cluster_t->centroid_t = mean; 225 226 cluster_t->points_t = data; … … 229 230 return; 230 231 } 231 232 232 233 computeCovariant(data, count, mean, m); 233 234 234 235 SymmetricMatrix A(3); 235 236 for (int i = 1; i <= 3; ++i) { … … 238 239 } 239 240 } 240 241 Matrix U; DiagonalMatrix D; 241 242 Matrix U; 243 DiagonalMatrix D; 242 244 eigenvalues(A,D,U); 243 245 Vector3 emax(U(1, 3), U(2, 3), U(3, 3)); 244 246 245 247 int left = 0, right = count - 1; 246 248 247 249 Point p; 248 250 for (;left < right;) { 249 while (left < count && emax.dot(data[left].position - mean) >= 0.0f) { 250 ++left; 251 } 252 while (right >= 0 && emax.dot(data[right].position - mean) < 0.0f) { 253 --right; 254 } 255 if (left > right) { 256 break; 257 } 258 259 p = data[left]; 260 data[left] = data[right]; 261 data[right] = p; 262 ++left, --right; 263 264 } 265 251 while (left < count && emax.dot(data[left].position - mean) >= 0.0f) { 252 ++left; 253 } 254 while (right >= 0 && emax.dot(data[right].position - mean) < 0.0f) { 255 --right; 256 } 257 if (left > right) { 258 break; 259 } 260 261 p = data[left]; 262 data[left] = data[right]; 263 data[right] = p; 264 ++left, --right; 265 } 266 266 267 if (left == 0 || right == count - 1) { 267 268 268 TRACE("error\n"); 269 exit(1); 269 270 } else { 270 271 272 } 273 } 274 275 void 276 PCASplit::analyze(ClusterListNode * clusterNode, Cluster*parent, int level,271 split(data, left, limit); 272 split(data + left, count - left, limit); 273 } 274 } 275 276 void 277 PCASplit::analyze(ClusterListNode *clusterNode, Cluster *parent, int level, 277 278 float limit) 278 279 { 279 280 if (level > _maxLevel) { 280 281 return; 281 282 } 282 283 if (level > _finalMaxLevel) { 283 284 } 285 284 _finalMaxLevel = level; 285 } 286 286 287 init(); 287 288 288 ClusterListNode *clNode = clusterNode;289 289 ClusterListNode *clNode = clusterNode; 290 290 291 // initialize the indexCount of indices 291 292 _indexCount = 0; 292 293 while (clNode) { 293 294 295 296 297 298 } 299 294 if (clNode->data) { 295 split(clNode->data->points_t, clNode->data->numOfPoints_t, limit); 296 _indices[_indexCount++] = _curClusterCount; 297 } 298 clNode = clNode->next; 299 } 300 300 301 //Vector3 mean; 301 302 //computeCentroid(cluster->points, cluster->numOfPoints, mean); 302 303 303 304 // the process values of split are in _curClusterNode and _curClusterCount 304 ClusterListNode *curClusterNode = _curClusterNode;305 ClusterListNode *curClusterNode = _curClusterNode; 305 306 unsigned int curClusterNodeCount = _curClusterCount; 306 307 307 308 if (curClusterNodeCount) { 308 309 309 // create and init centroid 310 Cluster* retClusterBlock = 311 createClusterBlock(curClusterNode, curClusterNodeCount, level); 312 313 _curRoot = retClusterBlock; 314 315 if (level == _maxLevel) { 316 ClusterListNode* node = curClusterNode; 317 if (_indexCount > 0) { 318 // for parent 319 Point* points = new Point[curClusterNodeCount]; 320 321 parent[0].setChildren(retClusterBlock, _indices[0]); 322 parent[0].setPoints(points, _indices[0]); 323 324 for (unsigned int i = 0, in = 0; i < curClusterNodeCount; ++i) { 325 if (i >= _indices[in]) { 326 in++; 327 parent[in].setChildren(retClusterBlock + _indices[in - 1], _indices[in] - _indices[in - 1]); 328 parent[in].setPoints(points + _indices[in - 1], _indices[in] - _indices[in - 1]); 329 } 330 331 retClusterBlock[i].scale = node->data->scale_t; 332 retClusterBlock[i].centroid = node->data->centroid_t; 333 retClusterBlock[i].points = node->data->points_t; 334 retClusterBlock[i].numOfPoints = node->data->numOfPoints_t; 335 retClusterBlock[i].color.set(float(rand()) / RAND_MAX, 336 float(rand()) / RAND_MAX, 337 float(rand()) / RAND_MAX, 338 0.2); 339 340 points[i].position = node->data->centroid_t; 341 points[i].color.set(1.0f, 1.0f, 1.0f, 0.2f); 342 points[i].size = node->data->scale_t; 343 344 node = node->next; 345 } 346 } 347 } else { 348 Point* points = new Point[curClusterNodeCount]; 349 ClusterListNode* node = curClusterNode; 350 351 if (_indexCount > 0) { 352 parent[0].setPoints(points, _indices[0]); 353 parent[0].setChildren(retClusterBlock, _indices[0]); 354 for (int k = 1; k < _indexCount; ++k) { 355 parent[k].setPoints(points + _indices[k - 1], 356 _indices[k] - _indices[k - 1]); 357 parent[k].setChildren(retClusterBlock + _indices[k - 1], 358 _indices[k] - _indices[k - 1]); 359 } 360 361 // set points of sub-clusters 362 for (unsigned int i = 0; i < curClusterNodeCount; ++i) { 363 points[i].position = node->data->centroid_t; 364 points[i].color.set(1.0f, 1.0f, 1.0f, 0.2f); 365 points[i].size = node->data->scale_t; 366 node = node->next; 367 } 368 369 } 370 } 371 } 372 } 373 374 } /*namespace PCA */ 375 310 Cluster *retClusterBlock = 311 createClusterBlock(curClusterNode, curClusterNodeCount, level); 312 313 _curRoot = retClusterBlock; 314 315 if (level == _maxLevel) { 316 ClusterListNode *node = curClusterNode; 317 if (_indexCount > 0) { 318 // for parent 319 Point *points = new Point[curClusterNodeCount]; 320 321 parent[0].setChildren(retClusterBlock, _indices[0]); 322 parent[0].setPoints(points, _indices[0]); 323 324 for (unsigned int i = 0, in = 0; i < curClusterNodeCount; ++i) { 325 if (i >= _indices[in]) { 326 in++; 327 parent[in].setChildren(retClusterBlock + _indices[in - 1], _indices[in] - _indices[in - 1]); 328 parent[in].setPoints(points + _indices[in - 1], _indices[in] - _indices[in - 1]); 329 } 330 331 retClusterBlock[i].scale = node->data->scale_t; 332 retClusterBlock[i].centroid = node->data->centroid_t; 333 retClusterBlock[i].points = node->data->points_t; 334 retClusterBlock[i].numOfPoints = node->data->numOfPoints_t; 335 retClusterBlock[i].color.set(float(rand()) / RAND_MAX, 336 float(rand()) / RAND_MAX, 337 float(rand()) / RAND_MAX, 338 0.2); 339 340 points[i].position = node->data->centroid_t; 341 points[i].color.set(1.0f, 1.0f, 1.0f, 0.2f); 342 points[i].size = node->data->scale_t; 343 344 node = node->next; 345 } 346 } 347 } else { 348 Point *points = new Point[curClusterNodeCount]; 349 ClusterListNode *node = curClusterNode; 350 351 if (_indexCount > 0) { 352 parent[0].setPoints(points, _indices[0]); 353 parent[0].setChildren(retClusterBlock, _indices[0]); 354 for (int k = 1; k < _indexCount; ++k) { 355 parent[k].setPoints(points + _indices[k - 1], 356 _indices[k] - _indices[k - 1]); 357 parent[k].setChildren(retClusterBlock + _indices[k - 1], 358 _indices[k] - _indices[k - 1]); 359 } 360 361 // set points of sub-clusters 362 for (unsigned int i = 0; i < curClusterNodeCount; ++i) { 363 points[i].position = node->data->centroid_t; 364 points[i].color.set(1.0f, 1.0f, 1.0f, 0.2f); 365 points[i].size = node->data->scale_t; 366 node = node->next; 367 } 368 } 369 } 370 } 371 } 372 -
trunk/packages/vizservers/nanovis/PCASplit.h
r2798 r2832 1 1 /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2 #ifndef __PCA_SPLIT_H__3 #define __PCA_SPLIT_H__2 #ifndef PCA_SPLIT_H 3 #define PCA_SPLIT_H 4 4 5 5 #include <memory.h> 6 6 7 #include "Vector3.h" 7 8 #include "Vector4.h" … … 9 10 namespace PCA { 10 11 11 class Point { 12 public : 13 Vector3 position; 14 // histogram Index; 15 //unsigned char color; 16 Vector4 color; 17 float size; 12 class Point 13 { 14 public: 15 Point() : 16 size(1.0f), 17 value(0.0f) 18 {} 19 20 Vector3 position; 21 // histogram Index; 22 //unsigned char color; 23 Vector4 color; 24 float size; 18 25 float value; 19 public :20 Point() : size(1.0f), value(0.0f) {}21 26 }; 22 27 28 class Cluster 29 { 30 public: 31 Cluster() : 32 color(1.0f, 1.0f, 1.0f, 1.0f), 33 scale(0.0f), 34 numOfChildren(0), 35 numOfPoints(0), 36 points(0), 37 children(0), 38 vbo(0)/*, minValue(0.0f), maxValue(0.0f)*/ 39 , level(0) 40 { 41 } 23 42 43 void setChildren(Cluster *children, int count) 44 { 45 this->children = children; 46 numOfChildren = count; 47 } 48 void setPoints(Point *points, int count) 49 { 50 this->points = points; 51 numOfPoints = count; 52 } 24 53 25 class Cluster { 26 public : 27 Vector3 centroid; 28 Vector4 color; 29 float scale; 54 Vector3 centroid; 55 Vector4 color; 56 float scale; 30 57 31 int numOfChildren; 32 int numOfPoints; 33 Point* points; 34 Cluster* children; 35 unsigned int vbo; 36 int level; 37 38 public : 39 40 Cluster() : 41 color(1.0f, 1.0f, 1.0f, 1.0f), 42 scale(0.0f), 43 numOfChildren(0), 44 numOfPoints(0), 45 points(0), 46 children(0), 47 vbo(0)/*, minValue(0.0f), maxValue(0.0f)*/ 48 , level(0) 49 { 50 } 51 52 void setChildren(Cluster* children, int count) 53 { 54 this->children = children; 55 numOfChildren = count; 56 } 57 void setPoints(Point* points, int count) 58 { 59 this->points = points; 60 numOfPoints = count; 61 } 62 58 int numOfChildren; 59 int numOfPoints; 60 Point *points; 61 Cluster *children; 62 unsigned int vbo; 63 int level; 63 64 }; 64 65 65 class ClusterAccel { 66 public : 67 Cluster* root; 68 int maxLevel; 69 Cluster** startPointerCluster; 70 int* numOfClusters; 71 unsigned int* _vbo; 72 public : 73 ClusterAccel(int maxlevel) 74 : root(0), maxLevel(maxlevel) 75 { 76 startPointerCluster = new Cluster*[maxLevel]; 77 numOfClusters = new int[maxLevel]; 78 _vbo = new unsigned int[maxLevel]; 79 memset(_vbo, 0, sizeof(unsigned int) * maxLevel); 80 } 66 class ClusterAccel 67 { 68 public: 69 ClusterAccel(int maxlevel) 70 : root(0), 71 maxLevel(maxlevel) 72 { 73 startPointerCluster = new Cluster *[maxLevel]; 74 numOfClusters = new int[maxLevel]; 75 _vbo = new unsigned int[maxLevel]; 76 memset(_vbo, 0, sizeof(unsigned int) * maxLevel); 77 } 78 79 Cluster *root; 80 int maxLevel; 81 Cluster **startPointerCluster; 82 int *numOfClusters; 83 unsigned int *_vbo; 81 84 }; 82 85 83 class Cluster_t { 84 public : 85 Vector3 centroid_t; 86 int numOfPoints_t; 87 float scale_t; 88 Point* points_t; 86 class Cluster_t 87 { 88 public: 89 Cluster_t() : 90 numOfPoints_t(0), 91 scale_t(0.0f), 92 points_t(0) 93 {} 89 94 90 Cluster_t() : numOfPoints_t(0), scale_t(0.0f), points_t(0) 91 {} 95 Vector3 centroid_t; 96 int numOfPoints_t; 97 float scale_t; 98 Point *points_t; 92 99 }; 93 100 94 class ClusterListNode { 95 public : 96 Cluster_t* data; 97 ClusterListNode* next; 98 public : 99 ClusterListNode(Cluster_t* d, ClusterListNode* n) 100 : data(d), next(n) 101 {} 101 class ClusterListNode 102 { 103 public: 104 ClusterListNode(Cluster_t *d, ClusterListNode *n) : 105 data(d), 106 next(n) 107 {} 102 108 103 ClusterListNode() 104 : data(0), next(0) 105 {} 109 ClusterListNode() : 110 data(NULL), 111 next(NULL) 112 {} 113 114 Cluster_t *data; 115 ClusterListNode *next; 106 116 }; 107 117 118 class PCASplit 119 { 120 public: 121 enum { 122 MAX_INDEX = 8000000 123 }; 108 124 109 class PCASplit { 110 enum { 111 MAX_INDEX =8000000 112 }; 113 private : 114 ClusterListNode* _curClusterNode; 115 ClusterListNode* _memClusterChunk1; 116 ClusterListNode* _memClusterChunk2; 117 ClusterListNode* _curMemClusterChunk; 125 PCASplit(); 118 126 119 int _memClusterChunkIndex;127 ~PCASplit(); 120 128 121 Cluster* _curRoot;129 ClusterAccel *doIt(Point *data, int count); 122 130 123 int _curClusterCount; 124 int _maxLevel; 125 float _minDistance; 126 float _distanceScale; 127 unsigned int* _indices; 128 int _indexCount; 129 int _finalMaxLevel; 131 void setMinDistance(float minDistance) 132 { 133 _minDistance = minDistance; 134 } 130 135 131 ClusterAccel* _clusterHeader; 132 public : 133 PCASplit(); 134 ~PCASplit(); 135 public : 136 ClusterAccel* doIt(Point* data, int count); 137 void setMinDistance(const float minDistance); 138 void setMaxLevel(int maxLevel); 136 void setMaxLevel(int maxLevel) 137 { 138 _maxLevel = maxLevel; 139 } 139 140 140 private : 141 void init(); 142 void analyze(ClusterListNode* cluster, Cluster* parent, int level, float limit); 143 void addLeafCluster(Cluster_t* cluster); 144 Cluster* createClusterBlock(ClusterListNode* clusterList, int count, int level); 145 void split(Point* data, int count, float maxDistortion); 146 float getMaxDistortionSquare(ClusterListNode* clusterList, int count); 147 public : 148 static void computeDistortion(Point* data, int count, const Vector3& mean, float& distortion, float& maxSize); 149 static void computeCentroid(Point* data, int count, Vector3& mean); 150 static void computeCovariant(Point* data, int count, const Vector3& mean, float* m); 141 static void computeDistortion(Point *data, int count, const Vector3& mean, float& distortion, float& maxSize); 142 143 static void computeCentroid(Point *data, int count, Vector3& mean); 144 145 static void computeCovariant(Point *data, int count, const Vector3& mean, float *m); 146 147 private: 148 void init(); 149 150 void analyze(ClusterListNode *cluster, Cluster *parent, int level, float limit); 151 152 void addLeafCluster(Cluster_t *cluster); 153 154 Cluster *createClusterBlock(ClusterListNode *clusterList, int count, int level); 155 156 void split(Point *data, int count, float maxDistortion); 157 158 float getMaxDistortionSquare(ClusterListNode *clusterList, int count); 159 160 ClusterAccel *_clusterHeader; 161 162 ClusterListNode *_curClusterNode; 163 ClusterListNode *_memClusterChunk1; 164 ClusterListNode *_memClusterChunk2; 165 ClusterListNode *_curMemClusterChunk; 166 167 int _memClusterChunkIndex; 168 169 Cluster *_curRoot; 170 171 int _curClusterCount; 172 int _maxLevel; 173 float _minDistance; 174 float _distanceScale; 175 unsigned int *_indices; 176 int _indexCount; 177 int _finalMaxLevel; 151 178 }; 152 153 inline void PCASplit::setMinDistance(const float minDistance)154 {155 _minDistance = minDistance;156 }157 158 inline void PCASplit::setMaxLevel(int maxLevel)159 {160 _maxLevel = maxLevel;161 }162 179 163 180 }
Note: See TracChangeset
for help on using the changeset viewer.