本文整理汇总了C++中CFrame::getRelativeToBase方法的典型用法代码示例。如果您正苦于以下问题:C++ CFrame::getRelativeToBase方法的具体用法?C++ CFrame::getRelativeToBase怎么用?C++ CFrame::getRelativeToBase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFrame
的用法示例。
在下文中一共展示了CFrame::getRelativeToBase方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeToMemoryMappedFile
// write to memory mapped file
void CPlatform::writeToMemoryMappedFile(CRobot *robot)
{
// write text to memory-mapped file
#ifdef WIN32
if(pFile && hMutex)
#else
if(shmId != -1)
#endif
{
CFrame *frame = NULL;
CMatrix frameMatrix;
if( (global.viewType >= 0) && (global.viewType <= global.robotInput.framesCount) ) {
frame = global.robotInput.frames[global.viewType];
frameMatrix = frame->getRelativeToBase();
frameMatrix.invert();
}
Polyeder pos[POLYCOUNT];
CVec tmp, tmp2;
CMatrix mat(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0);;
CMatrix *pMat;
CMatrix matleg, tmp1;
int i, j;
float tmpf;
for(i=0; i<robot->geometry.length; i++) {
if(robot->geometry.geometry[i].frame != NULL) {
mat = robot->geometry.geometry[i].frame->getRelativeToBase();
}
else {
mat.set(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0);
}
pMat = (CMatrix*)&mat;
pMat->mul(frameMatrix, *pMat);
transformPolyeder(pos[i], robot->geometry.geometry[i], pMat);
}
// set color
for(i=0; i<robot->geometry.length; i++) {
pos[i].red = (unsigned char)(255*robot->geometry.geometry[i].color[0]);
pos[i].green = (unsigned char)(255*robot->geometry.geometry[i].color[1]);
pos[i].blue = (unsigned char)(255*robot->geometry.geometry[i].color[2]);
}
int sensorCount = 0;
// test: show distance sensor values as hyperplanes -->
/*
i = 0;
if (robot->geometry.geometry[i].frame != NULL)
{
mat = robot->geometry.geometry[i].frame->getRelativeToBase();
} else
mat.set(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0);
pMat = (CMatrix*)&mat;
pMat->mul(frameMatrix, *pMat);
CBox tmpBox;
float distFactor = 20.0;
float distOffset = 10.0;
float distMin = 3.0;
// center
//printf("%d\n", global.robotWrapper.Axs1s[0].getDistLeft());
if (global.robotWrapper.Axs1s[0].getDistCenter() > distMin)
{
tmpBox.center.y = robot->geometry.geometry[i].center.y + getDistanceValue((float)global.robotWrapper.Axs1s[0].getDistCenter(), distOffset, distFactor);
tmpBox.center.z = robot->geometry.geometry[i].center.z -150;
tmpBox.center.x = robot->geometry.geometry[i].center.x;
tmpBox.extents.x = 300;
tmpBox.extents.y = 10;
tmpBox.extents.z = 300;
transformPolyeder(pos[robot->geometry.length + sensorCount], tmpBox, pMat);
pos[robot->geometry.length + sensorCount].red = 255;
pos[robot->geometry.length + sensorCount].green = 0;
pos[robot->geometry.length + sensorCount].blue = 0;
sensorCount++;
}
// left
//printf("%g\n", getDistanceValue((float)global.robotWrapper.Axs1s[0].getDistLeft(), distOffset, distFactor));
if (global.robotWrapper.Axs1s[0].getDistLeft() > distMin)
{
tmpBox.center.x = robot->geometry.geometry[i].center.x + getDistanceValue((float)global.robotWrapper.Axs1s[0].getDistLeft(), distOffset, distFactor);
tmpBox.center.z = robot->geometry.geometry[i].center.z -150;
tmpBox.center.y = robot->geometry.geometry[i].center.y;
tmpBox.extents.x = 10;
tmpBox.extents.y = 300;
tmpBox.extents.z = 300;
//.........这里部分代码省略.........