本文整理汇总了C++中contour函数的典型用法代码示例。如果您正苦于以下问题:C++ contour函数的具体用法?C++ contour怎么用?C++ contour使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了contour函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: contour
void MapgenV7::generateCaves(s16 max_stone_y)
{
if (max_stone_y >= node_min.Y) {
u32 index = 0;
for (s16 z = node_min.Z; z <= node_max.Z; z++)
for (s16 y = node_min.Y - 1; y <= node_max.Y + 1; y++) {
u32 i = vm->m_area.index(node_min.X, y, z);
for (s16 x = node_min.X; x <= node_max.X; x++, i++, index++) {
float d1 = contour(noise_cave1->result[index]);
float d2 = contour(noise_cave2->result[index]);
if (d1 * d2 > 0.3) {
content_t c = vm->m_data[i].getContent();
if (!ndef->get(c).is_ground_content || c == CONTENT_AIR)
continue;
vm->m_data[i] = MapNode(CONTENT_AIR);
}
}
}
}
PseudoRandom ps(blockseed + 21343);
u32 bruises_count = (ps.range(1, 4) == 1) ? ps.range(1, 2) : 0;
for (u32 i = 0; i < bruises_count; i++) {
CaveV7 cave(this, &ps);
cave.makeCave(node_min, node_max, max_stone_y);
}
}
开发者ID:nathanlol5,项目名称:minetest,代码行数:29,代码来源:mapgen_v7.cpp
示例2: contour
void MapgenFractal::generateCaves(s16 max_stone_y)
{
if (max_stone_y < node_min.Y)
return;
noise_cave1->perlinMap3D(node_min.X, node_min.Y - 1, node_min.Z);
noise_cave2->perlinMap3D(node_min.X, node_min.Y - 1, node_min.Z);
v3s16 em = vm->m_area.getExtent();
u32 index2d = 0;
for (s16 z = node_min.Z; z <= node_max.Z; z++)
for (s16 x = node_min.X; x <= node_max.X; x++, index2d++) {
bool column_is_open = false; // Is column open to overground
u32 vi = vm->m_area.index(x, node_max.Y + 1, z);
u32 index3d = (z - node_min.Z) * zstride + (csize.Y + 1) * ystride +
(x - node_min.X);
// Biome of column
Biome *biome = (Biome *)bmgr->getRaw(biomemap[index2d]);
for (s16 y = node_max.Y + 1; y >= node_min.Y - 1;
y--, index3d -= ystride, vm->m_area.add_y(em, vi, -1)) {
content_t c = vm->m_data[vi].getContent();
if (c == CONTENT_AIR || c == biome->c_water_top ||
c == biome->c_water) {
column_is_open = true;
continue;
}
// Ground
float d1 = contour(noise_cave1->result[index3d]);
float d2 = contour(noise_cave2->result[index3d]);
if (d1 * d2 > 0.3f && ndef->get(c).is_ground_content) {
// In tunnel and ground content, excavate
vm->m_data[vi] = MapNode(CONTENT_AIR);
} else if (column_is_open &&
(c == biome->c_filler || c == biome->c_stone)) {
// Tunnel entrance floor
vm->m_data[vi] = MapNode(biome->c_top);
column_is_open = false;
} else {
column_is_open = false;
}
}
}
if (node_max.Y > MGFRACTAL_LARGE_CAVE_DEPTH)
return;
PseudoRandom ps(blockseed + 21343);
u32 bruises_count = ps.range(0, 2);
for (u32 i = 0; i < bruises_count; i++) {
CaveV5 cave(this, &ps);
cave.makeCave(node_min, node_max, max_stone_y);
}
}
开发者ID:voronaam,项目名称:freeminer,代码行数:55,代码来源:mapgen_fractal.cpp
示例3: pr
void OreVein::generate(MMVManip *vm, int mapseed, u32 blockseed,
v3s16 nmin, v3s16 nmax, u8 *biomemap)
{
PcgRandom pr(blockseed + 520);
MapNode n_ore(c_ore, 0, ore_param2);
u32 sizex = (nmax.X - nmin.X + 1);
if (!noise) {
int sx = nmax.X - nmin.X + 1;
int sy = nmax.Y - nmin.Y + 1;
int sz = nmax.Z - nmin.Z + 1;
noise = new Noise(&np, mapseed, sx, sy, sz);
noise2 = new Noise(&np, mapseed + 436, sx, sy, sz);
}
bool noise_generated = false;
size_t index = 0;
for (int z = nmin.Z; z <= nmax.Z; z++)
for (int y = nmin.Y; y <= nmax.Y; y++)
for (int x = nmin.X; x <= nmax.X; x++, index++) {
u32 i = vm->m_area.index(x, y, z);
if (!vm->m_area.contains(i))
continue;
if (!CONTAINS(c_wherein, vm->m_data[i].getContent()))
continue;
if (biomemap && !biomes.empty()) {
u32 bmapidx = sizex * (z - nmin.Z) + (x - nmin.X);
std::set<u8>::iterator it = biomes.find(biomemap[bmapidx]);
if (it == biomes.end())
continue;
}
// Same lazy generation optimization as in OreBlob
if (!noise_generated) {
noise_generated = true;
noise->perlinMap3D(nmin.X, nmin.Y, nmin.Z);
noise2->perlinMap3D(nmin.X, nmin.Y, nmin.Z);
}
// randval ranges from -1..1
float randval = (float)pr.next() / (pr.RANDOM_RANGE / 2) - 1.f;
float noiseval = contour(noise->result[index]);
float noiseval2 = contour(noise2->result[index]);
if (noiseval * noiseval2 + randval * random_factor < nthresh)
continue;
vm->m_data[i] = n_ore;
}
}
开发者ID:ChunHungLiu,项目名称:freeminer,代码行数:51,代码来源:mg_ore.cpp
示例4: while
float CLevelGraph::check_position_in_direction(u32 start_vertex_id, const Fvector &start_position, const Fvector &finish_position, const float max_distance) const
{
SContour _contour;
const_iterator I,E;
int saved_index, iPrevIndex = -1, iNextNode;
Fvector start_point = start_position, temp_point = start_position, finish_point = finish_position;
float fCurDistance = 0.f, fDistance = start_position.distance_to_xz(finish_position);
u32 dwCurNode = start_vertex_id;
while (!inside(vertex(dwCurNode),finish_position) && (fCurDistance < (fDistance + EPS_L))) {
begin (dwCurNode,I,E);
saved_index = -1;
contour (_contour,dwCurNode);
for ( ; I != E; ++I) {
iNextNode = value(dwCurNode,I);
if (valid_vertex_id(iNextNode) && (iPrevIndex != iNextNode))
choose_point(start_point,finish_point,_contour, iNextNode,temp_point,saved_index);
}
if (saved_index > -1) {
fCurDistance = start_point.distance_to_xz(temp_point);
iPrevIndex = dwCurNode;
dwCurNode = saved_index;
}
else
return (max_distance);
}
if (inside(vertex(dwCurNode),finish_position) && (_abs(vertex_plane_y(*vertex(dwCurNode),finish_position.x,finish_position.z) - finish_position.y) < .5f))
return (start_point.distance_to_xz(finish_position));
else
return (max_distance);
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:33,代码来源:level_graph_vertex.cpp
示例5: displayPlanarRegions
void
displayPlanarRegions (std::vector<pcl::PlanarRegion<PointT>, Eigen::aligned_allocator<pcl::PlanarRegion<PointT> > > ®ions,
boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer)
{
char name[1024];
unsigned char red [6] = {255, 0, 0, 255, 255, 0};
unsigned char grn [6] = { 0, 255, 0, 255, 0, 255};
unsigned char blu [6] = { 0, 0, 255, 0, 255, 255};
pcl::PointCloud<PointT>::Ptr contour (new pcl::PointCloud<PointT>);
for (size_t i = 0; i < regions.size (); i++)
{
Eigen::Vector3d centroid = regions[i].getCentroid ();
Eigen::Vector4d model = regions[i].getCoefficients ();
pcl::PointXYZ pt1 = pcl::PointXYZ (centroid[0], centroid[1], centroid[2]);
pcl::PointXYZ pt2 = pcl::PointXYZ (centroid[0] + (0.5 * model[0]),
centroid[1] + (0.5 * model[1]),
centroid[2] + (0.5 * model[2]));
sprintf (name, "normal_%d", unsigned (i));
viewer->addArrow (pt2, pt1, 1.0, 0, 0, false, name);
contour->points = regions[i].getContour ();
sprintf (name, "plane_%02d", int (i));
pcl::visualization::PointCloudColorHandlerCustom <PointT> color (contour, red[i%6], grn[i%6], blu[i%6]);
if(!viewer->updatePointCloud(contour, color, name))
viewer->addPointCloud (contour, color, name);
viewer->setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 5, name);
}
}
开发者ID:tfili,项目名称:pcl,代码行数:30,代码来源:organized_segmentation_demo.cpp
示例6: toCv
vector<cv::Point2f> toCv(const ofPolyline& polyline) {
vector<cv::Point2f> contour(polyline.size());
for(int i = 0; i < polyline.size(); i++) {
contour[i].x = polyline[i].x;
contour[i].y = polyline[i].y;
}
return contour;
}
开发者ID:NickHardeman,项目名称:ofxCv,代码行数:8,代码来源:Utilities.cpp
示例7: build_graph
grace grace::contour(double (*fun)(double,double*),double x0,double x1,int nx,VTYPE &par)
{
double x[nx];
VTYPE y;
build_graph(x,y,fun,x0,x1,nx,par);
contour(x,y);
return *this;
}
开发者ID:sunpho84,项目名称:sunpho,代码行数:10,代码来源:grace_comm.cpp
示例8: pr
void OreVein::generate(MMVManip *vm, int mapseed, u32 blockseed,
v3s16 nmin, v3s16 nmax)
{
PseudoRandom pr(blockseed + 520);
MapNode n_ore(c_ore, 0, ore_param2);
if (!noise) {
int sx = nmax.X - nmin.X + 1;
int sy = nmax.Y - nmin.Y + 1;
int sz = nmax.Z - nmin.Z + 1;
noise = new Noise(&np, mapseed, sx, sy, sz);
noise2 = new Noise(&np, mapseed + 436, sx, sy, sz);
}
bool noise_generated = false;
size_t index = 0;
for (int z = nmin.Z; z <= nmax.Z; z++)
for (int y = nmin.Y; y <= nmax.Y; y++)
for (int x = nmin.X; x <= nmax.X; x++, index++) {
u32 i = vm->m_area.index(x, y, z);
if (!vm->m_area.contains(i))
continue;
if (!CONTAINS(c_wherein, vm->m_data[i].getContent()))
continue;
// Same lazy generation optimization as in OreBlob
if (!noise_generated) {
noise_generated = true;
noise->perlinMap3D(nmin.X, nmin.Y, nmin.Z);
noise2->perlinMap3D(nmin.X, nmin.Y, nmin.Z);
}
// randval ranges from -1..1
float randval = (float)pr.next() / (PSEUDORANDOM_MAX / 2) - 1.f;
float noiseval = contour(noise->result[index]);
float noiseval2 = contour(noise2->result[index]);
if (noiseval * noiseval2 + randval * random_factor < nthresh)
continue;
vm->m_data[i] = n_ore;
}
}
开发者ID:AnnXGame,项目名称:Minetest,代码行数:42,代码来源:mg_ore.cpp
示例9: contour
void MapgenV5::generateCaves(int max_stone_y)
{
if (max_stone_y < node_min.Y)
return;
noise_cave1->perlinMap3D(node_min.X, node_min.Y - 1, node_min.Z);
noise_cave2->perlinMap3D(node_min.X, node_min.Y - 1, node_min.Z);
u32 index = 0;
for (s16 z = node_min.Z; z <= node_max.Z; z++)
for (s16 y = node_min.Y - 1; y <= node_max.Y + 1; y++) {
u32 vi = vm->m_area.index(node_min.X, y, z);
for (s16 x = node_min.X; x <= node_max.X; x++, vi++, index++) {
// Don't excavate the overgenerated stone at node_max.Y + 1,
// this creates a 'roof' over the tunnel, preventing light in
// tunnels at mapchunk borders when generating mapchunks upwards.
if (y > node_max.Y)
continue;
float d1 = contour(noise_cave1->result[index]);
float d2 = contour(noise_cave2->result[index]);
if (d1 * d2 > 0.125f) {
content_t c = vm->m_data[vi].getContent();
if (!ndef->get(c).is_ground_content || c == CONTENT_AIR)
continue;
vm->m_data[vi] = MapNode(CONTENT_AIR);
}
}
}
if (node_max.Y > MGV5_LARGE_CAVE_DEPTH)
return;
PseudoRandom ps(blockseed + 21343);
u32 bruises_count = ps.range(0, 2);
for (u32 i = 0; i < bruises_count; i++) {
CaveV5 cave(this, &ps);
cave.makeCave(node_min, node_max, max_stone_y);
}
}
开发者ID:Mab879,项目名称:freeminer,代码行数:42,代码来源:mapgen_v5.cpp
示例10: rotatedRectangleContainPoint
bool rotatedRectangleContainPoint(cv::RotatedRect rectangle, cv::Point2f point) {
cv::Point2f corners[4];
rectangle.points(corners);
cv::Point2f *lastItemPointer = (corners + sizeof corners / sizeof corners[0]);
std::vector<cv::Point2f> contour(corners, lastItemPointer);
double indicator = pointPolygonTest(contour, point, false);
return indicator >= 0;
}
开发者ID:SIRLab,项目名称:VSS-Vision,代码行数:12,代码来源:FrameHelper.cpp
示例11: contour
void MapgenV7::generateCaves(int max_stone_y)
{
if (max_stone_y >= node_min.Y) {
u32 index = 0;
u32 index2d = 0;
for (s16 z = node_min.Z; z <= node_max.Z; z++) {
for (s16 y = node_min.Y - 1; y <= node_max.Y + 1; y++) {
u32 i = vm->m_area.index(node_min.X, y, z);
for (s16 x = node_min.X; x <= node_max.X;
x++, i++, index++, index2d++) {
float d1 = contour(noise_cave1->result[index]);
float d2 = contour(noise_cave2->result[index]);
if (d1 * d2 > 0.3) {
Biome *biome = (Biome *)bmgr->
getRaw(biomemap[index2d]);
content_t c = vm->m_data[i].getContent();
if (!ndef->get(c).is_ground_content ||
c == CONTENT_AIR ||
(y <= water_level &&
c != biome->c_stone &&
c != c_stone))
continue;
vm->m_data[i] = MapNode(CONTENT_AIR);
}
}
index2d -= ystride;
}
index2d += ystride;
}
}
PseudoRandom ps(blockseed + 21343);
u32 bruises_count = (ps.range(1, 4) == 1) ? ps.range(1, 2) : 0;
for (u32 i = 0; i < bruises_count; i++) {
CaveV7 cave(this, &ps);
cave.makeCave(node_min, node_max, max_stone_y);
}
}
开发者ID:mahmutelmas06,项目名称:minetest,代码行数:40,代码来源:mapgen_v7.cpp
示例12: testBrokenCurve
void testBrokenCurve() {
FTContour contour( brokenPoints, simpleConicTags, 3);
CPPUNIT_ASSERT( contour.PointCount() == 1);
FTContour shortContour( shortLine, simpleConicTags, 2);
CPPUNIT_ASSERT( shortContour.PointCount() == 6);
FTContour reallyShortContour( shortLine, simpleConicTags, 1);
CPPUNIT_ASSERT( reallyShortContour.PointCount() == 1);
FTContour brokenTagtContour( shortLine, brokenTags, 3);
CPPUNIT_ASSERT( brokenTagtContour.PointCount() == 7);
}
开发者ID:filenameexe,项目名称:scribble,代码行数:13,代码来源:FTContour-Test.cpp
示例13: noise3d_param
double noise3d_param(const OldNoiseParams ¶m, double x, double y, double z)
{
double s = param.pos_scale;
x /= s;
y /= s;
z /= s;
if(param.type == OLDNOISE_CONSTANT_ONE)
{
return 1.0;
}
else if(param.type == OLDNOISE_PERLIN)
{
return param.noise_scale*noise3d_perlin(x,y,z, param.seed,
param.octaves,
param.persistence);
}
else if(param.type == OLDNOISE_PERLIN_ABS)
{
return param.noise_scale*noise3d_perlin_abs(x,y,z, param.seed,
param.octaves,
param.persistence);
}
else if(param.type == OLDNOISE_PERLIN_CONTOUR)
{
return contour(param.noise_scale*noise3d_perlin(x,y,z,
param.seed, param.octaves,
param.persistence));
}
else if(param.type == OLDNOISE_PERLIN_CONTOUR_FLIP_YZ)
{
return contour(param.noise_scale*noise3d_perlin(x,z,y,
param.seed, param.octaves,
param.persistence));
}
else assert(0);
}
开发者ID:WantedGames,项目名称:freeminer,代码行数:37,代码来源:mapgen_v5.cpp
示例14: contour
/******************************************************************
* Fonctions secondaires appelées lors de l'extraction de la moelle
******************************************************************/
uiCoord2D PithExtractor::transHough(const Slice &slice, int width, int height, int *x, int *y, int *sliceMaxValue, int *nbContourPoints) const
{
int x_accu, y_accu, longueur, min;
int *droite;
Slice *tabaccu;
arma::fmat *orientation, *cont;
uiCoord2D coordmax;
orientation = 0;
{ // bloc de limitation de vie de la variable voisinage
// attention x represente les colonne et y les lignes
const Slice &voisinage = slice.submat( *y, *x, (uint)( (*y)+height-1 ), (uint)( (*x)+width-1 ) );
cont = contour(voisinage, &orientation);
}
tabaccu = new Slice(width, height);
tabaccu->zeros();
//verifie orientation et table d'accumlation tous les points se trouvent a 0
*nbContourPoints = 0;
for(uint i=0; i<cont->n_rows; i++){
for(uint j=0; j<cont->n_cols; j++){
if((*cont)(i,j) == 1){
*nbContourPoints += 1;
droite = drawLine(j, i, (*orientation)(i,j), width, height, &longueur);
for(int k=0; k<longueur; k++){
y_accu = droite[k]/width;
x_accu = droite[k]-(y_accu*width);
(*tabaccu) (y_accu, x_accu) ++;
}
delete [] droite;
}
}
}
// std::cerr << "nbptcontour=" << * nbptcontour << "\n";
delete cont;
delete orientation;
//min et max globaux
min = *sliceMaxValue = (*tabaccu)(0,0);
coordmax.x = coordmax.y = 0;
minSlice(*tabaccu, &min, sliceMaxValue, &coordmax);
delete tabaccu;
*x += coordmax.x;
*y += coordmax.y;
return uiCoord2D(*x, *y);
}
开发者ID:akrah,项目名称:TKDetection,代码行数:51,代码来源:pithextractor.cpp
示例15: leaf
QuadTreeNodeData::REGION_INTERSECTION_FLAG QuadTree::region_intersection(const iterator_base & it,
const std::vector<RS_Vector > & region_contour )
{
if(region_contour.size()<2) return QuadTreeNodeData::OUT_REGION;
const RS_Vector * _p_tr = it->tr();
const RS_Vector * _p_tl = it->tl();
const RS_Vector * _p_br = it->br();
const RS_Vector * _p_bl = it->bl();
//for rubset reasion
double eps = (*_p_tr - * _p_tl).x/100;
Poly leaf(Point(_p_bl->x, _p_bl->y));
leaf.add (Point(_p_br->x, _p_br->y));
leaf.add (Point(_p_tr->x, _p_tr->y));
leaf.add (Point(_p_tl->x, _p_tl->y));
Poly leaf_large(Point(_p_bl->x-eps, _p_bl->y-eps));
leaf_large.add (Point(_p_br->x+eps, _p_br->y-eps));
leaf_large.add (Point(_p_tr->x+eps, _p_tr->y+eps));
leaf_large.add (Point(_p_tl->x-eps, _p_tl->y+eps));
Poly contour(Point(region_contour[0].x, region_contour[0].y));
for(unsigned int n=1; n<region_contour.size(); ++n)
contour.add(Point(region_contour[n].x, region_contour[n].y));
if(intersect(leaf_large, contour))
{
return QuadTreeNodeData::INTERSECTION_REGION;
}
// no intersection point?
if(contour.has_point(Point(_p_bl->x, _p_bl->y)) && contour.has_point(Point(_p_tr->x, _p_tr->y)))
{
//assert(fabs(contour.area()) >= leaf.area());
return QuadTreeNodeData::IN_REGION;
}
if(leaf_large.has_point(Point(region_contour[0].x, region_contour[0].y)))
{
//assert(leaf.area() >= fabs(contour.area()));
return QuadTreeNodeData::COVER_REGION;
}
return QuadTreeNodeData::OUT_REGION;
}
开发者ID:Akaur,项目名称:qdraw,代码行数:48,代码来源:cg_quadtree.cpp
示例16: fruitProcessing
// Detects fruits from frame and updates their positions in arrays
void fruitProcessing(IplImage* frame) {
IplImage* imgYellowThresh = fruitDetect(frame);
// Process image
IplImage* con = contour(imgYellowThresh); //running contour on yellow thresholded image
// Debug start
// fruitCount is no. of objects (fruits) in image
printf("\nNo. of objects detected: %d", fruitCount);
for(int idx = 0; idx < fruitCount ; idx ++) {
printf("\nObj #%d: (%d, %d)", idx, centers[idx].x, centers[idx].y);
}
cvReleaseImage(&imgYellowThresh);
cvReleaseImage(&con);
}
开发者ID:devbhave,项目名称:bot-harvest,代码行数:17,代码来源:cutterController.cpp
示例17: contour
void ContourAreaTest::testAllocate1()
{
m_operator->initialize();
m_operator->activate();
runtime::DataContainer contour(new cvsupport::Matrix("points_i32.npy"));
m_operator->setInputData(ContourArea::INPUT_CONTOUR, contour);
runtime::DataContainer areaResult = m_operator->getOutputData(ContourArea::OUTPUT_AREA);
runtime::ReadAccess areaAccess(areaResult);
std::ofstream areaFile;
areaFile.open("ContourAreaTest_testAllocate1_area.txt");
areaFile << areaAccess.get<runtime::Float64>();
areaFile.close();
}
开发者ID:uboot,项目名称:stromx-opencv,代码行数:17,代码来源:ContourAreaTest.cpp
示例18: sobelFilter
int sobelFilter(byte *rgb, byte **gray, byte **sobel_h_res, byte **sobel_v_res, byte **contour_img, int width, int height) {
int sobel_h[] = {-1, 0, 1, -2, 0, 2, -1, 0, 1},
sobel_v[] = {1, 2, 1, 0, 0, 0, -1, -2, -1};
int rgb_size = width*height*3;
// Get gray representation of the image
int gray_size = rgbToGray(rgb, gray, rgb_size);
// Make sobel operations
itConv(*gray, gray_size, width, sobel_h, sobel_h_res);
itConv(*gray, gray_size, width, sobel_v, sobel_v_res);
// Calculate contour matrix
contour(*sobel_h_res, *sobel_v_res, gray_size, contour_img);
return gray_size;
}
开发者ID:gsmonex,项目名称:SobelFilter,代码行数:18,代码来源:sobel.c
示例19: surf
/////////////////////////////////////////////////////////////////////////////
// Contour plot of true probability
/////////////////////////////////////////////////////////////////////////////
void CTikZTwoD::Contour(const CArtificialProblem &problem, int Levels) const
{
*pout << "\\begin{scope}[Contour]\n";
CAPSurface surf(problem);
CContour contour(surf);
contour.SetBounds(-1.0, 1.0, -1.0, 1.0);
contour.SetGridSize(ContourResolution, ContourResolution);
for (int i = 1; i < Levels; i++)
{
double x = double(i) / double(Levels);
contour.SetLevel(x);
contour.PlotLines(*pout, SplineD, Scale);
}
*pout << "\\pgfusepathqstroke\n";
*pout << "\\end{scope}\n";
}
开发者ID:jdc2172,项目名称:clop,代码行数:22,代码来源:CTikZTwoD.cpp
示例20: contour
PointCloudPtr ContourGenerator::getContour(const std::vector<CoordinateT > &coordinates)
{
PointCloudPtr contour(new PointCloud);
for (int i = 0; i < coordinates.size(); i++)
{
PointT start_point;
start_point.x = coordinates.at(i).at(0);
start_point.y = coordinates.at(i).at(1);
start_point.z = 0.0;
PointT end_point;
if (i < coordinates.size() - 1)
{
end_point.x = coordinates.at(i + 1).at(0);
end_point.y = coordinates.at(i + 1).at(1);
end_point.z = 0.0;
}
else
{
end_point.x = coordinates.at(0).at(0);
end_point.y = coordinates.at(0).at(1);
end_point.z = 0.0;
}
int num_steps_per_segment = 40;
double x_step_size = (end_point.x - start_point.x) / num_steps_per_segment;
double y_step_size = (end_point.y - start_point.y) / num_steps_per_segment;
for (int j = 0; j < num_steps_per_segment; j++)
{
PointT point;
point.x = start_point.x + (j * x_step_size);
point.y = start_point.y + (j * y_step_size);
point.z = 0.0;
contour->points.push_back(point);
}
}
contour->width = contour->points.size();
contour->height = 1;
return contour;
}
开发者ID:sthoduka,项目名称:contour_generator,代码行数:41,代码来源:contour_generator.cpp
注:本文中的contour函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论