老代码
复制后
删掉public后
但是删除public之后,虽然.h和.cpp不会报错 但是我引用里面的数据会报错
以下为同理的另一段代码
.h文件
namespace SDFController
{
using namespace MeshStructures;
using namespace MyMath;
class SDF//原为public class SDF
{
public:
void CreateRay(int rayNumber, double rayAngle, ak::Model const& model);
void CreateOctree(ak::Model const& model);
void ComputeCenterAndSize(ak::Model const& model);
private:
float diagonal;
/* CAssimp* loggger;*/
HashTable<Face>* fc_list; // hashovacia tabulka facov facov哈希表
/*LinkedList<Octree>* oc_list; */ // prealokovany list octree 预分配表 octree
int kernel_size; // velkost gaussianu pri vyhladeni
LinkedList<Face>** gauss_sus;
unsigned int prealocated_space;
double randomDouble(double min, double max);
//double vectorMedian(std::vector<double>& v);
//double distanceBetween(const Vector3& u, const Vector3& v);
MyOctree *m_root;
glm::vec4 ModelCenter;
float Octree_Size;
float b_sf; // scale factor
float b_max; // diagonala v octree
glm::vec4 o_min;
glm::vec4 o_max;
unsigned int nodeCount;
unsigned int leafCount;
unsigned int triangleCount;
LinkedList<Face>* triangles;
};
}
.cpp文件
namespace SDFController
{
void SDF::CreateOctree(ak::Model const& model)
{
SDF::ComputeCenterAndSize(model);
m_root = new MyOctree(1, Octree_Size, ModelCenter);
unsigned int siz = model.triangles.size();
if (siz > 0)
{
unsigned int* mtria = new unsigned int[siz];
Face** tria = new Face * [siz];
unsigned int* mtria = new unsigned int[siz];
LinkedList<Face>::Cell<Face>* tmp2 = triangles->start;
int i = 0;
while (tmp2 != NULL)
{
tria[i] = tmp2->data;
mtria[i] = 0;
tmp2 = tmp2->next;
i++;
}
nodeCount = 0, triangleCount = 0, leafCount = 0;
m_root->Build2(tria, mtria, 0, siz, nodeCount, triangleCount, leafCount);
o_min = glm::vec4(m_root->origin.x - m_root->size, m_root->origin.y - m_root->size, m_root->origin.z - m_root->size, 1.0f);
o_max = glm::vec4(m_root->origin.x + m_root->size, m_root->origin.y + m_root->size, m_root->origin.z + m_root->size, 1.0f);
}
}
.h 文件是C++的