本文整理汇总了C++中Matrix44f::SetTranslate方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix44f::SetTranslate方法的具体用法?C++ Matrix44f::SetTranslate怎么用?C++ Matrix44f::SetTranslate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix44f
的用法示例。
在下文中一共展示了Matrix44f::SetTranslate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main( )
{
MyMesh m;
vcg::tri::Icosahedron(m);
vcg::tri::UpdateNormal<MyMesh>::PerVertexNormalizedPerFaceNormalized(m);
vcg::tri::UpdateBounding<MyMesh>::Box(m);
// As a simple test we get a few random points on a mesh,
// we rot and trans them
// and we fit them
std::vector<vcg::Point3f> ExactVec;
std::vector<vcg::Point3f> PerturbVec;
tri::MontecarloSampling(m,ExactVec,10);
PerturbVec=ExactVec;
Matrix44f RotM;
Matrix44f TraM;
Point3f dir;
vcg::math::MarsenneTwisterRNG rnd;
vcg::math::GeneratePointInUnitBallUniform<float>(rnd);
RotM.SetRotateDeg(rand()%360,dir);
TraM.SetTranslate(1,2,3);
Matrix44f RigidM = RotM*TraM;
for(size_t i=0;i<ExactVec.size();++i)
PerturbVec[i]=RigidM*ExactVec[i];
Quaternionf q;
Point3f tr;
Matrix44f res;
ComputeRigidMatchMatrix(PerturbVec,ExactVec,res);
res.print();
RigidM.print();
return 0;
}
示例2: GetCurrentPVMatrix
void ShadowMap::GetCurrentPVMatrix(){
float matP[16];
float matMV[16];
glGetFloatv(GL_PROJECTION_MATRIX, matP);
glGetFloatv(GL_MODELVIEW_MATRIX, matMV);
Matrix44f A(matSM[0]);
Matrix44f B(matMV);
Matrix44f C(matP);
A=vcg::Transpose( A );
B=vcg::Transpose( B );
C=vcg::Transpose( C );
Matrix44f P = C*B;
P=vcg::Invert( P );
Matrix44f res = A*P;
Matrix44f mul;
Matrix44f add;
GLint vp[4];
glGetIntegerv(GL_VIEWPORT, vp);
mul.SetScale(Point3f(2.0f/vp[2], 2.0f/vp[3], 2));
add.SetTranslate(Point3f(-1,-1,-1));
//Matrix44f mulHS;
//mulHS.SetScale(Point3f(HSratio,HSratio,1) );
res=res*add*mul;
for (int i=0; i<4; i++)
for (int j=0; j<4; j++)
matFinal[i][j]=res[j][i];
}
示例3: applyFilter
//.........这里部分代码省略.........
return true;
}
break;
case FF_ISOSURFACE :
{
SimpleVolume<SimpleVoxel> volume;
typedef vcg::tri::TrivialWalker<CMeshO, SimpleVolume<SimpleVoxel> > MyWalker;
typedef vcg::tri::MarchingCubes<CMeshO, MyWalker> MyMarchingCubes;
MyWalker walker;
Box3d rbb;
rbb.min[0]=par.getFloat("minX");
rbb.min[1]=par.getFloat("minY");
rbb.min[2]=par.getFloat("minZ");
rbb.max[0]=par.getFloat("maxX");
rbb.max[1]=par.getFloat("maxY");
rbb.max[2]=par.getFloat("maxZ");
double step=par.getFloat("voxelSize");
Point3i siz= Point3i::Construct((rbb.max-rbb.min)*(1.0/step));
Parser p;
double x,y,z;
p.DefineVar("x", &x);
p.DefineVar("y", &y);
p.DefineVar("z", &z);
std::string expr = par.getString("expr").toStdString();
p.SetExpr(expr);
Log("Filling a Volume of %i %i %i",siz[0],siz[1],siz[2]);
volume.Init(siz);
for(double i=0;i<siz[0];i++)
for(double j=0;j<siz[1];j++)
for(double k=0;k<siz[2];k++)
{
x = rbb.min[0]+step*i;
y = rbb.min[1]+step*j;
z = rbb.min[2]+step*k;
try {
volume.Val(i,j,k)=p.Eval();
} catch(Parser::exception_type &e) {
errorMessage = e.GetMsg().c_str();
return false;
}
}
// MARCHING CUBES
Log("[MARCHING CUBES] Building mesh...");
MyMarchingCubes mc(m.cm, walker);
walker.BuildMesh<MyMarchingCubes>(m.cm, volume, mc, 0);
Matrix44f tr; tr.SetIdentity(); tr.SetTranslate(rbb.min[0],rbb.min[1],rbb.min[2]);
Matrix44f sc; sc.SetIdentity(); sc.SetScale(step,step,step);
tr=tr*sc;
tri::UpdatePosition<CMeshO>::Matrix(m.cm,tr);
tri::UpdateNormals<CMeshO>::PerVertexNormalizedPerFace(m.cm);
tri::UpdateBounding<CMeshO>::Box(m.cm); // updates bounding box
return true;
}
break;
case FF_REFINE :
{
std::string condSelect = par.getString("condSelect").toStdString();
std::string expr1 = par.getString("x").toStdString();
std::string expr2 = par.getString("y").toStdString();
std::string expr3 = par.getString("z").toStdString();
bool errorMidPoint = false;
bool errorEdgePred = false;
std::string msg = "";
// check parsing errors while creating two func obj
// display error message
MidPointCustom<CMeshO> mid = MidPointCustom<CMeshO>(m.cm,expr1,expr2,expr3,errorMidPoint,msg);
CustomEdge<CMeshO> edge = CustomEdge<CMeshO>(condSelect,errorEdgePred,msg);
if(errorMidPoint || errorEdgePred)
{
errorMessage = msg.c_str();
return false;
}
// Refine current mesh.
// Only edge specified with CustomEdge pred are selected
// and the new vertex is choosen with MidPointCustom created above
RefineE<CMeshO, MidPointCustom<CMeshO>, CustomEdge<CMeshO> >
(m.cm, mid, edge, false, cb);
m.clearDataMask( MeshModel::MM_VERTMARK);
vcg::tri::UpdateNormals<CMeshO>::PerVertexNormalizedPerFace(m.cm);
return true;
}
break;
default : assert (0);
}
return false;
}