我正在尝试移植我最初为Linux制作的一个小程序,现在唯一给我一个错误的是这样写的任何二进制数0b01010101.
我找不到任何关于为什么这在Windows上不起作用或者如何让它在Windows上工作的信息.
这不是c ++的标准吗?
我将计算从点到三角形的最短距离(3d).我已将该点投射到三角形的平面,而不是采用该点投影的重心坐标.但我找不到一种方法来将坐标钳位在三角形内部.
搜索时,我只找到了0 <= [U,V,W]和u + V + W = 1,但如何将这种解决呢?
有谁知道为什么这会给我一个分段错误?
cell.h
struct cell{
bool filled;
bool isParent;
//float px,py,pz,s;
bool cx,cy,cz;
unsigned char r,g,b;
vect norm;
struct cell* parent;
struct cell* child;
cell(bool cxx=0, bool cyy=0, bool czz=0);
void open_read(string);
};
Run Code Online (Sandbox Code Playgroud)
cell.cpp
cell::cell(bool cxx, bool cyy, bool czz)
{
cell childs[8]; // these lines creates a segmentation fault
child = &childs[0]; // these lines creates a segmentation fault
cx=cxx;
cy=cyy;
cz=czz;
norm = vect(0,0,0);
norm.normalize();
isParent=false;
filled=true;
}
Run Code Online (Sandbox Code Playgroud)
如果这是错误的方法,那么任何人都可以指出我如何能够将单个指针存储到子[8]的第一个元素而不是存储8个指针,因为它非常占用内存.