本文整理汇总了C++中Matrix44f::SetIdentity方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix44f::SetIdentity方法的具体用法?C++ Matrix44f::SetIdentity怎么用?C++ Matrix44f::SetIdentity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix44f
的用法示例。
在下文中一共展示了Matrix44f::SetIdentity方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
{
switch(argv[i][1])
{
case 'o' : p.basename=argv[i]+2;printf("Setting Basename to %s\n",MYbasename.c_str());break;
case 'C' : pmc.MP.setCacheSize(atoi(argv[i]+2));printf("Setting MaxSize of MeshCache to %i\n",atoi(argv[i]+2)); break;
case 'c' : p.NCell =atoi(argv[i]+2);printf("Setting NCell to %i\n",p.NCell); break;
case 'v' : p.SaveVolumeFlag=true; VolumeBaseName=argv[i]+2; printf("Saving Volume enabled: volume Basename to %s\n",VolumeBaseName.c_str());break;
case 'V' : p.VoxSize =atof(argv[i]+2);printf("Setting VoxSize to %f; overridden NCell\n",p.VoxSize);p.NCell=0;break;
case 'w' : p.WideNum =atoi(argv[i]+2);printf("Setting WideNum to %i\n",p.WideNum);break;
case 'W' : p.WideSize=atof(argv[i]+2);printf("Setting WideSize to %f;overridden WideNum\n",p.WideSize);break;
case 'L' : p.SmoothNum =atoi(argv[i]+2);printf("Setting Laplacian SmoothNum to %i\n",p.SmoothNum);break;
case 'R' : p.RefillNum =atoi(argv[i]+2);printf("Setting Refilling Num to %i\n",p.RefillNum);break;
case 'q' : p.QualitySmoothVox=atof(argv[i]+2);printf("Setting QualitySmoothThr to %f; \n",p.QualitySmoothVox);break;
case 'Q' : p.QualitySmoothAbs=atof(argv[i]+2);printf("Setting QualitySmoothAbsolute to %f; it will override the default %f voxel value\n",p.QualitySmoothAbs,p.QualitySmoothVox);break;
case 'l' : p.IntraSmoothFlag=true; printf("Setting Laplacian Smooth after expansion \n");break;
case 'G' : p.GeodesicQualityFlag=false; printf("Disabling Geodesic Quality\n");break;
case 'F' : p.PLYFileQualityFlag=true; p.GeodesicQualityFlag=false; printf("Enabling PlyFile (and disabling Geodesic) Quality\n");break;
case 'f' : p.FillThr=atoi(argv[i]+2);printf("Setting Fill Threshold to %i\n",p.FillThr);break;
case 'a' : p.ExpAngleDeg=atoi(argv[i]+2);printf("Setting Expanding Angle Threshold to %f Degree\n",p.ExpAngleDeg);break;
case 'O' : p.OffsetThr=atof(argv[i]+2);printf("Setting Offset Threshold to %f \n",p.OffsetThr);p.OffsetFlag=true;break;
case 's' :
p.IDiv[0]=atoi(argv[++i]); p.IDiv[1]=atoi(argv[++i]); p.IDiv[2]=atoi(argv[++i]);
p.IPosS[0]=atoi(argv[++i]);p.IPosS[1]=atoi(argv[++i]);p.IPosS[2]=atoi(argv[++i]);
p.IPosE[0]=p.IPosS[0]; p.IPosE[1]=p.IPosS[1]; p.IPosE[2]=p.IPosS[2];
if((p.IPosS[0]>=p.IDiv[0]) || (p.IPosS[1]>=p.IDiv[1]) || (p.IPosS[2]>=p.IDiv[2]))
{
printf("the subvolume you have requested is invalid (out of bounds)");
exit(-1);
}
printf("Computing ONLY subvolume [%i,%i,%i] on a %ix%ix%i\n",p.IPosS[0],p.IPosS[1],p.IPosS[2],p.IDiv[0],p.IDiv[1],p.IDiv[2]);
break;
case 'S' :
p.IDiv[0]=atoi(argv[++i]);p.IDiv[1]=atoi(argv[++i]);p.IDiv[2]=atoi(argv[++i]);
p.IPosS=Point3i(0,0,0);
p.IPosE[0]=p.IDiv[0]-1; p.IPosE[1]=p.IDiv[1]-1; p.IPosE[2]=p.IDiv[2]-1;
printf("Autocomputing ALL subvolumes on a %ix%ix%i\n",p.IDiv[0],p.IDiv[1],p.IDiv[2]);
break;
case 'K' :
p.IDiv[0]=atoi(argv[++i]); p.IDiv[1]=atoi(argv[++i]);p.IDiv[2]=atoi(argv[++i]);
p.IPosB[0]=atoi(argv[++i]);p.IPosB[1]=atoi(argv[++i]);p.IPosB[2]=atoi(argv[++i]);
p.IPosS=Point3i(0,0,0);
p.IPosE[0]=p.IDiv[0]-1; p.IPosE[1]=p.IDiv[1]-1; p.IPosE[2]=p.IDiv[2]-1;
if((p.IPosB[0]>=p.IDiv[0]) || (p.IPosB[1]>=p.IDiv[1]) || (p.IPosB[2]>=p.IDiv[2]))
{
printf("the start subvolume you have requested is invalid (out of bounds)");
exit(-1);
}
printf("Autocomputing ALL subvolumes FROM [%i,%i,%i] on a %ix%ix%i\n",p.IPosB[0],p.IPosB[1],p.IPosB[2],p.IDiv[0],p.IDiv[1],p.IDiv[2]);
break;
case 'X' :
p.IDiv[0]=atoi(argv[++i]); p.IDiv[1]=atoi(argv[++i]);p.IDiv[2]=atoi(argv[++i]);
p.IPosS[0]=atoi(argv[++i]);p.IPosS[1]=atoi(argv[++i]);p.IPosS[2]=atoi(argv[++i]);
p.IPosE[0]=atoi(argv[++i]);p.IPosE[1]=atoi(argv[++i]);p.IPosE[2]=atoi(argv[++i]);
// test if the interval is ok
int Istart,Iend;
Istart = p.IPosS[2] + (p.IPosS[1]*p.IDiv[2]) + (p.IPosS[0]*p.IDiv[2]*p.IDiv[1]);
Iend = p.IPosE[2] + (p.IPosE[1]*p.IDiv[2]) + (p.IPosE[0]*p.IDiv[2]*p.IDiv[1]);
if((Iend-Istart)<=0)
{
printf("the range you have requested is invalid (reversed or empty)");
exit(-1);
}
if((p.IPosS[0]>=p.IDiv[0]) || (p.IPosS[1]>=p.IDiv[1]) || (p.IPosS[2]>=p.IDiv[2]) ||
(p.IPosE[0]>=p.IDiv[0]) || (p.IPosE[1]>=p.IDiv[1]) || (p.IPosE[2]>=p.IDiv[2]))
{
printf("the subvolume you have requested is invalid (out of bounds)");
exit(-1);
}
printf("Autocomputing subvolumes FROM [%i,%i,%i] TO [%i,%i,%i] on a %ix%ix%i\n",p.IPosS[0],p.IPosS[1],p.IPosS[2],p.IPosE[0],p.IPosE[1],p.IPosE[2],p.IDiv[0],p.IDiv[1],p.IDiv[2]);
break;
// case 'B' : p.SafeBorder =atoi(argv[i]+2);printf("Setting SafeBorder among blocks to %i*%i (default 1)\n",p.SafeBorder,Volume<Voxelf>::BLOCKSIDE());break;
case 'p' : p.VertSplatFlag =true; printf("Enabling VertexSplatting instead of face rasterization\n");break;
case 'd' : p.VerboseLevel=atoi(argv[i]+2);printf("Enabling VerboseLevel= %i )\n",p.VerboseLevel);break;
case 'D' : p.VerboseLevel=1; p.SliceNum=atoi(argv[i]+2);printf("Enabling Debug Volume saving of %i slices (VerboseLevel=1)\n",p.SliceNum);break;
case 'M' : p.SimplificationFlag =true; p.SimplificationFlag =false;printf("NOT !!! Enabling PostReconstruction simplification BROKEN\n"); break;
default : {printf("Error unable to parse option '%s'\n",argv[i]); exit(0);}
}
++i;
}
Matrix44f Identity;
Identity.SetIdentity();
string alnfile;
while(i<argc)
{
if(strcmp(strrchr(argv[i],'.'),".txt")==0)
pmc.MP.openTXT(argv[i]);
else
pmc.MP.AddSingleMesh(argv[i]);
++i;
}
if(pmc.MP.size()==0) usage();
printf("End Parsing\n\n");
pmc.Process(ProgressBarCallback);
return 0;
}
示例2: UpdateMatrix
void EditManipulatorsPlugin::UpdateMatrix(MeshModel &model, GLArea * gla, bool applymouseoffset, bool useinputnumber)
{
Matrix44f newmatrix;
Matrix44f old_rotation;
Matrix44f old_translation;
Matrix44f old_meshcenter;
Matrix44f old_meshuncenter;
Point3f new_scale;
Point3f axis;
float mouseXoff;
float mouseYoff;
Point3f mesh_boxcenter, mesh_origin, mesh_xaxis, mesh_yaxis, mesh_zaxis;
mesh_boxcenter = model.cm.bbox.Center();
mesh_origin = original_Transform.GetColumn3(3);
mesh_xaxis = original_Transform.GetColumn3(0);
mesh_yaxis = original_Transform.GetColumn3(1);
mesh_zaxis = original_Transform.GetColumn3(2);
delta_Transform.SetIdentity();
newmatrix.SetIdentity();
if(current_manip == EditManipulatorsPlugin::ManNone)
{
model.cm.Tr = original_Transform;
}
else
{
if(current_manip_mode != EditManipulatorsPlugin::ModNone) // transform on one axis only
{
switch(current_manip_mode) // which axis is active
{
case EditManipulatorsPlugin::ModX:
axis = Point3f(1.0, 0.0, 0.0);
break;
case EditManipulatorsPlugin::ModY:
axis = Point3f(0.0, 1.0, 0.0);
break;
case EditManipulatorsPlugin::ModZ:
axis = Point3f(0.0, 0.0, 1.0);
break;
case EditManipulatorsPlugin::ModXX:
axis = mesh_xaxis;
break;
case EditManipulatorsPlugin::ModYY:
axis = mesh_yaxis;
break;
case EditManipulatorsPlugin::ModZZ:
axis = mesh_zaxis;
break;
default: axis = Point3f(1.0, 1.0, 1.0); // it should never arrive here, anyway
}
if(current_manip == EditManipulatorsPlugin::ManMove)
{
// mouse offset -> single axis translation
float xsign = ((screen_xaxis*axis)>0.0)?1.0:-1.0;
float ysign = ((screen_yaxis*axis)>0.0)?1.0:-1.0;
mouseXoff = xsign * screen_xaxis.Norm() * (currScreenOffset_X/float(gla->width()));
mouseYoff = ysign * screen_yaxis.Norm() * (currScreenOffset_Y/float(gla->height()));
displayOffset = currOffset + mouseXoff + mouseYoff;
// snapping
if(isSnapping)
{
displayOffset /= snapto;
displayOffset = floor(displayOffset+0.5);
displayOffset *= snapto;
}
if(useinputnumber)
displayOffset = inputnumber;
delta_Transform.SetTranslate(axis * displayOffset);
newmatrix = delta_Transform * original_Transform;
}
else if(current_manip == EditManipulatorsPlugin::ManRotate)
{
// mouse offset -> single axis rotation
mouseXoff = (currScreenOffset_X/float(gla->width()));
mouseYoff = (currScreenOffset_Y/float(gla->height()));
displayOffset = currOffset + (360.0 * (mouseXoff + mouseYoff));
if((displayOffset > 360.0) || (displayOffset < -360.0))
displayOffset = 360.0;
// snapping
if(isSnapping)
{
displayOffset = floor(displayOffset+0.5);
}
if(useinputnumber)
displayOffset = inputnumber;
delta_Transform.SetRotateDeg(displayOffset, axis);
//.........这里部分代码省略.........
示例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;
}