fix matrix44, remove memset from octree.h

This commit is contained in:
alemuntoni 2021-10-19 14:16:53 +02:00
parent da77800d02
commit 341148b961
2 changed files with 9 additions and 6 deletions

View File

@ -29,6 +29,7 @@
#include <vcg/space/point3.h> #include <vcg/space/point3.h>
#include <vcg/space/point4.h> #include <vcg/space/point4.h>
#include <vector> #include <vector>
#include <array>
#include <iostream> #include <iostream>
#include <Eigen/Core> #include <Eigen/Core>
#include <Eigen/LU> #include <Eigen/LU>

View File

@ -25,6 +25,7 @@
#define VCG_SPACE_INDEX_OCTREE_H #define VCG_SPACE_INDEX_OCTREE_H
#include <stdlib.h> #include <stdlib.h>
#include <vector>
#ifdef __glut_h__ #ifdef __glut_h__
#include <vcg/space/color4.h> #include <vcg/space/color4.h>
@ -212,11 +213,11 @@ namespace vcg
public: public:
Octree() Octree()
{ {
marks=0; //marks=0;
} }
~Octree() ~Octree()
{ {
if(marks) delete []marks; //if(marks) delete []marks;
int node_count = TemplatedOctree::NodeCount(); int node_count = TemplatedOctree::NodeCount();
for (int i=0; i<node_count; i++) for (int i=0; i<node_count; i++)
delete TemplatedOctree::nodes[i]; delete TemplatedOctree::nodes[i];
@ -307,8 +308,9 @@ public:
// Allocate the mark array // Allocate the mark array
global_mark = 1; global_mark = 1;
marks = new unsigned char[placeholder_count]; marks.resize(placeholder_count);
memset(&marks[0], 0, sizeof(unsigned char)*placeholder_count); std::fill(marks.begin(), marks.end(), 0);
//memset(&marks[0], 0, sizeof(unsigned char)*placeholder_count);
std::sort(placeholders.begin(), placeholders.end(), ObjectSorter< NodeType >()); std::sort(placeholders.begin(), placeholders.end(), ObjectSorter< NodeType >());
std::vector< NodePointer > filled_leaves(placeholder_count); std::vector< NodePointer > filled_leaves(placeholder_count);
@ -537,7 +539,7 @@ OBJECT_RETRIEVER:
/*! /*!
* Markers used to avoid duplication of the same result during a query * Markers used to avoid duplication of the same result during a query
*/ */
unsigned char *marks; std::vector<char> marks;
unsigned char global_mark; unsigned char global_mark;
/*! /*!
@ -561,7 +563,7 @@ OBJECT_RETRIEVER:
global_mark = (global_mark+1)%255; global_mark = (global_mark+1)%255;
if (global_mark == 0) if (global_mark == 0)
{ {
memset(&marks[0], 0, sizeof(unsigned char)*int(sorted_dataset.size())); std::fill(marks.begin(), marks.begin() + sorted_dataset.size(), 0);
global_mark++; global_mark++;
} }
};//end of IncrementMark };//end of IncrementMark