本文整理汇总了C++中PointSet::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ PointSet::push_back方法的具体用法?C++ PointSet::push_back怎么用?C++ PointSet::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PointSet
的用法示例。
在下文中一共展示了PointSet::push_back方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadConcept
void ReadConcept(Inputor& in, PointSet &pointSet,
unsigned int recordType)
{
string str;
pointSet.reserve(in._num);
double x,y,z;
double I;
double r,g,b;
PointRec::Reset_I();
do
{
switch(recordType){
case XYZ:
in.getLine(str, '\n');
sscanf(str.c_str(), "%lf %lf %lf", &x, &y, &z);
pointSet.push_back(PointRec(x,y,z));
break;
case XYZI:
in.getLine(str, '\n');
sscanf(str.c_str(), "%lf %lf %lf %lf", &x, &y, &z, &I);
pointSet.push_back(PointRec(x,y,z,I));
PointRec::Update_I(I);
break;
case XYZRGB:
in.getLine(str, '\n');
sscanf(str.c_str(), "%lf %lf %lf %lf %lf %lf", &x, &y, &z, &r, &g, &b);
pointSet.push_back(PointRec(x,y,z,-1, r, g, b));
break;
case XYZIRGB:
in.getLine(str, '\n');
sscanf(str.c_str(), "%lf %lf %lf %lf %lf %lf %lf", &x, &y, &z, &I, &r, &g, &b);
pointSet.push_back(PointRec(x,y,z, I, r, g, b));
PointRec::Update_I(I);
break;
}
in.frame();
}while(!in.isEnd());
}
示例2: PointSet
void
KML_Model::parseCoords( xml_node<>* node, KMLContext& cx )
{
PointSet* point = new PointSet();
xml_node<>* location = node->first_node("location", 0, false);
if (location)
{
double latitude = as<double>(getValue(location, "latitude"), 0.0);
double longitude = as<double>(getValue(location, "longitude"), 0.0);
double altitude = as<double>(getValue(location, "altitude"), 0.0);
point->push_back( osg::Vec3d(longitude, latitude, altitude));
}
_geom = point;
}
示例3: PointSet
void
KML_Model::parseCoords( const Config& conf, KMLContext& cx )
{
PointSet* point = new PointSet();
Config location = conf.child("location");
if (!location.empty())
{
double latitude = location.value("latitude", 0.0);
double longitude = location.value("longitude", 0.0);
double altitude = location.value("altitude", 0.0);
point->push_back( osg::Vec3d(longitude, latitude, altitude));
}
_geom = point;
}
示例4: loadPointSet
void loadPointSet(const std::string& filename, PointSet& ps)
{
std::fstream fin(filename.c_str(), std::ios_base::in);
if (!fin)
{
std::cout << "cannot open the file!" << std::endl;
return;
}
std::vector<Scalar> m_values;
Scalar tmp = 0;
size_t i = 0, j = 0;
while (fin >> tmp)
{
m_values.push_back(tmp);
}
size_t points_size = m_values.size() / Dim;
if (points_size * Dim != m_values.size())
{
std::cout << "File is broken! Or Dimension is incorrect!" << std::endl;
return;
}
for (size_t i = 0; i < points_size; ++ i)
{
if (Dim == 3)
ps.push_back(PointType(m_values[3*i], m_values[3*i+1], m_values[3*i+2]));
else
ps.push_back(PointType(m_values[2*i], m_values[2*i+1]));
}
fin.close();
}
示例5: PointSet
FilterContext
CentroidFilter::push(FeatureList& features, FilterContext& context )
{
for( FeatureList::iterator i = features.begin(); i != features.end(); ++i )
{
Feature* f = i->get();
Geometry* geom = f->getGeometry();
if ( !geom )
continue;
PointSet* newGeom = new PointSet();
newGeom->push_back( geom->getBounds().center() );
f->setGeometry( newGeom );
}
return context;
}
示例6:
void GradientDescent<DIM, POS, VAL>::optimize(PointSet<DIM, POS, VAL>& _pts)
{
PointSet<DIM, POS, POS> data = _pts;
int iSz = _pts.size();
for(int d=0; d<DIM; d++)
{
Vector<DIM, POS> shift;
shift[d] += m_shift;
for(int i=0; i<iSz; i++)
{
data.push_back(Point<DIM, POS, POS>(_pts[i].pos() + shift, 0));
}
}
evalFunction(data);
m_max = 0.0;
m_mean = 0.0;
if(iSz != 0)
{
for(int i=0; i<iSz; i++)
{
Vector<DIM, POS> motion;
for(int d=0; d<DIM; d++)
{
POS p = (data[i].val() - data[i+iSz*(d+1)].val()) / m_shift;
_pts[i].pos()[d] -= p;
motion[d] = p;
}
POS norm = motion.norm();
m_mean += norm;
if(m_max < norm) m_max = norm;
}
m_mean /= iSz;
}
}