本文整理汇总了C++中DPoint::setPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ DPoint::setPosition方法的具体用法?C++ DPoint::setPosition怎么用?C++ DPoint::setPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DPoint
的用法示例。
在下文中一共展示了DPoint::setPosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getSet
// Function to get the initial set
Set getSet(int PointType, bool Repetitions){
Set imgPoints = Set();
DPoint *p;
vector<float> position = vector<float>();
CImg<float> imgAux = img;
// Create the new pointer for the diferents points
switch(PointType){
case 0:
p = new DPoint();
break;
case 1:
case 2:
case 3:
imgAux.RGBtoLab();
p = new CIELABPoint();
break;
case 7:
case 8:
p = new RGBAPoint();
break;
}
// Load the image in the pointers
for(int i = 0; i < imgAux.height(); i++){
for(int j = 0; j < imgAux.width(); j++){
position.push_back(imgAux(j, i, 0, 0));
position.push_back(imgAux(j, i, 0, 1));
position.push_back(imgAux(j, i, 0, 2));
p->setPosition(position);
imgPoints.addPoint(p);
position.erase(position.begin(), position.end());
switch(PointType){
case 0:
p = new DPoint();
break;
case 1:
case 2:
case 3:
p = new CIELABPoint();
break;
case 7:
case 8:
p = new RGBAPoint();
break;
}
}
}
// If we don't need to remove repeated points we return the set
if(Repetitions){
return imgPoints;
}
// We take out the repeated points and return the set
else{
vector<DPoint*> aux = imgPoints.getPoints();
list<DPoint*> removequals = list<DPoint*>(aux.begin(), aux.end());
removequals.sort(compareDPoint);
removequals.unique(sameDPoint);
vector<DPoint*> vecaux = vector<DPoint*>(removequals.begin(), removequals.end());
Set setAux = Set();
for(int i = 0; i < vecaux.size(); i++){
setAux.addPoint(vecaux[i]);
}
return setAux;
}
}