本文整理汇总了C++中Landscape::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ Landscape::push_back方法的具体用法?C++ Landscape::push_back怎么用?C++ Landscape::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Landscape
的用法示例。
在下文中一共展示了Landscape::push_back方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _imageToLandscape
Landscape* DynamicModelNoColor::_imageToLandscape(Image* img)
{
Landscape* land = new Landscape();
float begin = 0;
bool color = img->at(0);
uint i = 0;
for (i = 0; i < img->size(); i++)
{
if ((bool)img->at(i) != color)
{
if (color)
{
land->push_back(new LandscapeElem(false, (i + begin - 1 - VIEW_ANGLE) / 2. / 360. * PI,
(i - begin) / 360. * PI));
}
begin = i;
color = img->at(i);
}
}
if (color)
{
land->push_back(new LandscapeElem(false, (i + begin - 1 - VIEW_ANGLE) / 2. / 360. * PI,
(i - begin) / 360. * PI));
}
return land;
}
示例2: _imageToLandscape
Landscape* CCmodel::_imageToLandscape(Image* img)
{
Landscape* land = new Landscape();
int lastPixelColor = img->at(0);
int lastObjBegin = 0;
uint i = 0;
for (; i < img->size(); ++i)
{
if (img->at(i) == lastPixelColor)
continue;
if (img->at(i) != BLACK && lastPixelColor != BLACK)
{
lastPixelColor = img->at(i);
continue;
}
LandscapeElem* object = new LandscapeElem(lastPixelColor == BLACK,
((((lastObjBegin + i - 1) / 2.) - VIEW_ANGLE / 2) / 360.) * 2 * PI,
((float)(i - lastObjBegin) / 360.) * 2 * PI);
land->push_back(object);
lastObjBegin = i;
lastPixelColor = img->at(i);
}
LandscapeElem* object = new LandscapeElem(lastPixelColor == BLACK,
((((lastObjBegin + i - 1) / 2.) - VIEW_ANGLE / 2) / 360.) * 2 * PI,
((float)(i - lastObjBegin) / 360.) * 2 * PI);
land->push_back(object);
return land;
}
示例3: _imageToLandscape
Landscape* DynamicModelColor::_imageToLandscape(Image* img)
{
Landscape* land = new Landscape();
float begin = 0;
int currColor = img->at(0);
uint i = 0;
for (i = 0; i < img->size(); i++)
{
if (img->at(i) != currColor)
{
if (currColor == RED)
{
land->push_back(new LandscapeElem(false, (i + begin - 1 - VIEW_ANGLE) / 2. / 360. * PI,
(i - begin) / 360. * PI, HUERED, SATRED, VALUERED));
}
else if (currColor == BLUE)
{
land->push_back(new LandscapeElem(false, (i + begin - 1 - VIEW_ANGLE) / 2. / 360. * PI,
(i - begin) / 360. * PI, HUEBLUE, SATBLUE, VALUEBLUE));
}
else if (currColor == GREEN)
{
land->push_back(new LandscapeElem(false, (i + begin - 1 - VIEW_ANGLE) / 2. / 360. * PI,
(i - begin) / 360. * PI, HUEGREEN, SATGREEN, VALUEGREEN));
}
begin = i;
currColor = img->at(i);
}
}
if (currColor == RED)
{
land->push_back(new LandscapeElem(false, (i + begin - 1 - VIEW_ANGLE) / 2. / 360. * PI,
(i - begin) / 360. * PI, HUERED, SATRED, VALUERED));
}
else if (currColor == BLUE)
{
land->push_back(new LandscapeElem(false, (i + begin - 1 - VIEW_ANGLE) / 2. / 360. * PI,
(i - begin) / 360. * PI, HUEBLUE, SATBLUE, VALUEBLUE));
}
else if (currColor == GREEN)
{
land->push_back(new LandscapeElem(false, (i + begin - 1 - VIEW_ANGLE) / 2. / 360. * PI,
(i - begin) / 360. * PI, HUEGREEN, SATGREEN, VALUEGREEN));
}
return land;
}