有一种将立方体映射到此处描述的球体的特殊方法:http: //mathproofs.blogspot.com/2005/07/mapping-cube-to-sphere.html
这不是你的基本"标准化点和你已完成"的方法,并提供更均匀间隔的映射.
我试图做出从球体坐标到立方体坐标的映射的逆过程,并且无法得出工作方程式.这是一个相当复杂的方程组,有很多平方根.
任何数学天才都希望对此有所了解?
这是c ++代码中的等式:
sx = x * sqrtf(1.0f - y * y * 0.5f - z * z * 0.5f + y * y * z * z / 3.0f);
sy = y * sqrtf(1.0f - z * z * 0.5f - x * x * 0.5f + z * z * x * x / 3.0f);
sz = z * sqrtf(1.0f - x * x * 0.5f - y * y * 0.5f …Run Code Online (Sandbox Code Playgroud) 我试图通过创建大量对象来了解我将会遇到什么样的内存.我知道每个对象 - 在创建时 - 将在HEAP中为成员变量提供空间,并且我认为属于该类型对象的每个函数的所有代码都存在于内存中的代码段中 - 永久存在.
是对的吗?
因此,如果我在C++中创建100个对象,我可以估计我将需要空间用于对象拥有的所有成员变量乘以100(这里可能的对齐问题),然后我需要代码段中的空间用于单个副本的该类型对象的每个成员函数的代码(不是代码的100个副本).
虚拟函数,多态,继承因素以某种方式进入吗?
动态链接库中的对象怎么样?我假设dll获得自己的堆栈,堆,代码和数据段.
简单示例(可能在语法上不正确):
// parent class
class Bar
{
public:
Bar() {};
~Bar() {};
// pure virtual function
virtual void doSomething() = 0;
protected:
// a protected variable
int mProtectedVar;
}
// our object class that we'll create multiple instances of
class Foo : public Bar
{
public:
Foo() {};
~Foo() {};
// implement pure virtual function
void doSomething() { mPrivate = 0; }
// a couple public functions …Run Code Online (Sandbox Code Playgroud) 在文档中,运行meteor在您自己的服务器上的过程
meteor bundle bundle.tgz
Run Code Online (Sandbox Code Playgroud)
然后提取这个tarball ..
tar -xzvf bundle.tgz
Run Code Online (Sandbox Code Playgroud)
然后启动节点服务器
MONGO_URL=mongodb://localhost:27017/<dbname> PORT=<server_port> ROOT_URL=http://sub.example.com/ node bundle/main.js
Run Code Online (Sandbox Code Playgroud)
我试图永远使用以保持节点服务器,但当我运行以下命令(细节模糊)时,永远进程不会返回,我必须CTRL + C才能返回到命令行 - 非常不可取喜欢.
MONGO_URL=mongodb://localhost:27017/<dbname> PORT=<server_port> ROOT_URL=http://sub.example.com/ forever bundle/main.js
Run Code Online (Sandbox Code Playgroud)
如果我附加一个&符号来在后台运行该进程,那么我会回到命令行,一切看起来都很好,但永远不会生成任何日志或pid文件,最终永远的进程会死掉.