本文整理汇总了C++中Point2f::X方法的典型用法代码示例。如果您正苦于以下问题:C++ Point2f::X方法的具体用法?C++ Point2f::X怎么用?C++ Point2f::X使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point2f
的用法示例。
在下文中一共展示了Point2f::X方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fabs
void skelpath::convertDisNurbs2Pixles(){
int bid = branchIdofTemplatetoDraw ;
int n=tempalteIdss[bid].size() ;
std::vector<Profile2D> profiles ;
for( int i=0; i<n; ++i ){
Profile2D profile = profiles2d[bid][tempalteIdss[bid][i] ] ;
profiles.push_back(profile) ;
}
Box2f box = GlobalFun::computeBox( profiles ) ;
// convert discretized nurbs to pixels
std::vector<Profile2D> curves ;
for( int i=0; i<disNurbsss[bid].size(); ++i ){
Profile2D curve = disNurbsss[bid][i] ;
curves.push_back(curve) ;
}
disNurbsssPixels = ReconstructorUtility::cvtProf2Pixels(curves, box) ;
double halfwdth = (std::max)( (std::max)( fabs( box.max.X() ), fabs( box.min.X() ) ) , (std::max)( fabs( box.max.Y() ), fabs( box.min.Y() ) ) ) ;
Box2f box2 ;
box2.min = Point2f(-halfwdth,-halfwdth) * 1.3;
box2.max = Point2f(halfwdth,halfwdth) * 1.3;
// convert control points to pixels
std::vector<Profile2D> ctrlpoinss ;
for( int i=0; i<Nurbsss[bid].size(); ++i ){
Profile2D ctrlpoints ;
int cvnum = Nurbsss[bid][i].CVCount() - Nurbsss[bid][i].Degree() ;
for( int cpid = 0; cpid<cvnum + Nurbsss[bid][i].Degree(); ++cpid ){
ON_4dPoint p ;
Nurbsss[bid][i].GetCV(cpid, p) ;
Point2f cvp = Point2f(p[0]/p[3], p[1]/p[3]) ;
// correct out out boundary control points
if( cvp.X() < box2.min.X() ){ cvp.X() = box2.min.X() ; p[0] = box2.min.X()* p[3] ; }
if( cvp.X() > box2.max.X() ){ cvp.X() = box2.max.X() ; p[0] = box2.max.X()* p[3] ; }
if( cvp.Y() < box2.min.Y() ){ cvp.Y() = box2.min.Y() ; p[1] = box2.min.Y() * p[3] ; }
if( cvp.Y() > box2.max.Y() ){ cvp.Y() = box2.max.Y() ; p[1] = box2.max.Y() * p[3] ; }
Nurbsss[bid][i].SetCV(cpid, p) ;
if( cpid < Nurbsss[bid][i].Degree() )
Nurbsss[bid][i].GetCV(cpid+cvnum, p) ;
ctrlpoints.push_back( cvp ) ;
}
ctrlpoinss.push_back(ctrlpoints) ;
}
NurbsCVPixels = ReconstructorUtility::cvtProf2Pixels(ctrlpoinss, box) ;
}
示例2: applyFilter
bool ExtraFilter_SlicePlugin::applyFilter(QAction *filter, MeshDocument &m, RichParameterSet &parlst, vcg::CallBackPos *cb)
{
vcg::tri::UpdateBounding<CMeshO>::Box(m.mm()->cm);
switch(ID(filter))
{
case FP_WAFFLE_SLICE :
{
MeshModel* base = m.mm();
CMeshO &cmBase = base->cm;
Box3f &bbox = m.mm()->cm.bbox;
if (tri::Clean<CMeshO>::CountNonManifoldEdgeFF(cmBase)>0 || (tri::Clean<CMeshO>::CountNonManifoldVertexFF(cmBase,false) != 0))
{
Log("Mesh is not two manifold, cannot apply filter");
return false;
}
if(parlst.getFloat("spacing") >= 1)
{
Log("the selected distance between the planes is greater than 1. The filter had no effect");
return false;
}
Point3f planeAxis(0,0,0);
Axis axis = (Axis) parlst.getEnum("planeAxis");
planeAxis[axis] = 1.0f;
float length = parlst.getFloat("length");
bool hideBase = parlst.getBool("hideBase");
bool hideEdge = parlst.getBool("hideEdge");
bool hidePlanes = parlst.getBool("hidePlanes");
bool hideExtrudes = parlst.getBool("hideExtrudes");
// set common SVG Properties
const float maxdim=m.mm()->cm.bbox.Dim()[m.mm()->cm.bbox.MaxDim()];
Point3f sizeCm=m.mm()->cm.bbox.Dim()*(length/maxdim);
// to check for dimensions with custom axis
Axis axisOrthog, axisJoint;
Point2f sizeCmOrth;
switch(axis)
{
case X:
{
axisOrthog = (Axis) Succ<X>::value;
axisJoint = (Axis) Succ<Succ<X>::value>::value;
pr.sizeCm = Point2f(sizeCm[1],sizeCm[2]);
sizeCmOrth.X()=sizeCm[0];
sizeCmOrth.Y()=sizeCm[2];
}
break;
case Y:
{
axisOrthog = (Axis) Succ<Y>::value;
axisJoint = (Axis) Succ<Succ<Y>::value>::value;
pr.sizeCm = Point2f(sizeCm[0],sizeCm[2]);
sizeCmOrth.X()=sizeCm[0];
sizeCmOrth.Y()=sizeCm[1];
}
break;
case Z:
{
axisOrthog = (Axis) Succ<Z>::value;
axisJoint = (Axis) Succ<Succ<Z>::value>::value;
pr.sizeCm = Point2f(sizeCm[0],sizeCm[1]);
sizeCmOrth.X()=sizeCm[1];
sizeCmOrth.Y()=sizeCm[2];
}
break;
}
Log("sizecm %fx%f",pr.sizeCm[0],pr.sizeCm[1]);
vector<CMeshO*> ev;
const float planeDist = maxdim * parlst.getFloat("spacing");
const int planeNum = (planeDist == 0) ? 1 : ( ((bbox.Dim()*planeAxis)/planeDist)+1 ); //evito la divisione per 0
const float lengthDiag = bbox.Diag()/2.0;
Segment2f lati[3]; //the rectangle is made up of three segments, the fourth side is ignored, so I never use it
const float eps =planeDist*parlst.getFloat("eps");
float epsTmp;
float start;
int rectNum;
if(parlst.getFloat("eps") < 1)
{
start = - (planeNum/2) * planeDist; //I have to go back from the center of half the length
epsTmp = eps/2.0;
generateRectSeg(0, epsTmp, bbox.Diag()*2, lati);
rectNum = planeNum;
}
else
{
start = 0;
epsTmp = bbox.Diag();
generateRectSeg(0, bbox.Diag()*2, bbox.Diag()*2, lati);
rectNum = 1;
Log("thickness is greater than 1: the extrusions will overlap");
//.........这里部分代码省略.........