今天做了一个小测试发现OpenInventor的一个特点,在实际绘图的过程中比如 如下代码
SoSeparator *pCubeRoot = new SoSeparator;
SoTranslation *myTranslation = new SoTranslation;
SoRotation *myRotation = new SoRotation;
pCubeRoot->AddChild(myTranslation);
pCubeRoot->AddChild(myRotation);
pCubeRoot->AddChild(new SoCube);
系统首先执行平移操作,然后执行旋转操作,此时的旋转是以SoCube的模型中心为中心进行的旋转上述代码更改如下:
SoSeparator *pCubeRoot = new SoSeparator;
SoTranslation *myTranslation = new SoTranslation;
SoRotation *myRotationNext = new SoRotation;
SoRotation *myRotation = new SoRotation;
pCubeRoot->AddChild(myTranslation);
pCubeRoot->AddChild(myRotationNext);
pCubeRoot->AddChild(myRotation);
pCubeRoot->AddChild(new SoCube);
发现系统先做平移,然后做myRotaton旋转,然后才做myRotationNext。
竟然和实际顺序是反的。