Skip to content

Commit

Permalink
fix matrix44, remove memset from octree.h
Browse files Browse the repository at this point in the history
  • Loading branch information
alemuntoni committed Oct 19, 2021
1 parent da77800 commit 341148b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions vcg/math/matrix44.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <vcg/space/point3.h>
#include <vcg/space/point4.h>
#include <vector>
#include <array>
#include <iostream>
#include <Eigen/Core>
#include <Eigen/LU>
Expand Down
14 changes: 8 additions & 6 deletions vcg/space/index/octree.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#define VCG_SPACE_INDEX_OCTREE_H

#include <stdlib.h>
#include <vector>

#ifdef __glut_h__
#include <vcg/space/color4.h>
Expand Down Expand Up @@ -212,11 +213,11 @@ namespace vcg
public:
Octree()
{
marks=0;
//marks=0;
}
~Octree()
{
if(marks) delete []marks;
//if(marks) delete []marks;
int node_count = TemplatedOctree::NodeCount();
for (int i=0; i<node_count; i++)
delete TemplatedOctree::nodes[i];
Expand Down Expand Up @@ -307,8 +308,9 @@ namespace vcg

// Allocate the mark array
global_mark = 1;
marks = new unsigned char[placeholder_count];
memset(&marks[0], 0, sizeof(unsigned char)*placeholder_count);
marks.resize(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::vector< NodePointer > filled_leaves(placeholder_count);
Expand Down Expand Up @@ -537,7 +539,7 @@ namespace vcg
/*!
* Markers used to avoid duplication of the same result during a query
*/
unsigned char *marks;
std::vector<char> marks;
unsigned char global_mark;

/*!
Expand All @@ -561,7 +563,7 @@ namespace vcg
global_mark = (global_mark+1)%255;
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++;
}
};//end of IncrementMark
Expand Down

0 comments on commit 341148b

Please sign in to comment.