当前位置: 首页>>代码示例>>C++>>正文


C++ Objects::clear方法代码示例

本文整理汇总了C++中Objects::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ Objects::clear方法的具体用法?C++ Objects::clear怎么用?C++ Objects::clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Objects的用法示例。


在下文中一共展示了Objects::clear方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: detect

/* -----------------------------------------------------------------------------
 * Detection (FAKE)
 */
void SampleDetector::detect( const Mat& rgb, const Mat& depth, Objects& objects, int FLAGS )
{
    objects.clear();

    // Set a bounding box of a FAKE detection
    Object detection;
    detection.m_bb.x = 100 + (rand() % 20); 
    detection.m_bb.y = 100 + (rand() % 20); 
    detection.m_bb.width = 100 + (rand() % 5);
    detection.m_bb.height = 100 + (rand() % 5);
    
    detection.m_pos_2D.x = detection.m_bb.x + (detection.m_bb.width / 2);
    detection.m_pos_2D.y = detection.m_bb.y + (detection.m_bb.height / 2);
    
    detection.m_class = unknown;
    detection.m_score = 0;
detection.m_angle = 0;

detection.m_mask = Mat(cvSize(0, 0), CV_8U);

detection.m_timestamp = 0;
detection.m_speed = cv::Point3f(0,0,0);



    
    objects.push_back(detection);
}
开发者ID:HastyJ,项目名称:but_object_detection,代码行数:31,代码来源:sample_detector.cpp

示例2: clear

  void clear()
  {
    for(typename Objects::reverse_iterator i = objects.rbegin(); i != objects.rend(); ++i)
      (*i)->~T();
    objects.clear();

    // FIXME: We don't have to delete the chunks, instead we should
    // just reset the pointer to start and reuse them
    for(typename Chunks::reverse_iterator i = chunks.rbegin(); i != chunks.rend(); ++i)
    {
      delete[] *i;
    }
    chunks.clear();

    next_free = 0;
  }
开发者ID:fsantanna,项目名称:pingus,代码行数:16,代码来源:memory_pool.hpp

示例3: setParameters


//.........这里部分代码省略.........
                Algebraic_ft length = nt_traits.sqrt(delta_x * delta_x + delta_y * delta_y);
                Algebraic_ft translation_x = factor * delta_y / length;
                Algebraic_ft translation_y = - factor * delta_x / length;
                Conic_point_2 point_1(source.x() + translation_x, source.y() + translation_y);
                Conic_point_2 point_2(target.x() + translation_x, target.y() + translation_y);
                Algebraic_ft a = - delta_y;
                Algebraic_ft b = delta_x;
                Algebraic_ft c = factor * length - (source.y() * target.x() - source.x() * target.y());
                X_monotone_curve_2 x_monotone_curve(a, b, c, point_1, point_2);
                insert(arrangement, x_monotone_curve);
            }
            else
            {
                // Displaces an arc.
                Rational two(2);
                Rational four(4);

                Rational r = edge->curve().r();
                Rational s = edge->curve().s();
                Rational t = edge->curve().t();
                Rational u = edge->curve().u();
                Rational v = edge->curve().v();
                Rational w = edge->curve().w();

                Nt_traits nt_traits;
                Rational x_center = - u / (two * r);
                Rational y_center = - v / (two * r);
                Rat_point_2 rat_center(x_center, y_center);
                Conic_point_2 center(nt_traits.convert(x_center), nt_traits.convert(y_center));

                Rational radius = Rational(radius_1) + two * Rational(radius_2);

                Algebraic_ft coefficient = nt_traits.convert(radius / Rational(radius_2));

                Conic_point_2 source_1 = edge->curve().source();
                Algebraic_ft x_source_2 = center.x() + coefficient * (source_1.x() - center.x());
                Algebraic_ft y_source_2 = center.y() + coefficient * (source_1.y() - center.y());
                Conic_point_2 source_2(x_source_2, y_source_2);

                Conic_point_2 target_1 = edge->curve().target();
                Algebraic_ft x_target_2 = center.x() + coefficient * (target_1.x() - center.x());
                Algebraic_ft y_target_2 = center.y() + coefficient * (target_1.y() - center.y());
                Conic_point_2 target_2(x_target_2, y_target_2);

                Rat_circle_2 circle(rat_center, radius * radius);

                Conic_arc_2 conic_arc(circle, CGAL::COUNTERCLOCKWISE, source_2, target_2);

                insert(arrangement, conic_arc);
            }
        }

        // Add the critical curves of type II.
        for (Edge_iterator edge = inset_2->edges_begin(); edge != inset_2->edges_end(); ++edge)
        {
            double x = CGAL::to_double(edge->curve().source().x());
            double y = CGAL::to_double(edge->curve().source().y());
            double radius = radius_1 + radius_2;
            Rat_point_2 center(x, y);
            Rat_circle_2 circle(center, radius * radius);
            Conic_arc_2 conic_arc(circle);
            insert(arrangement, conic_arc);
        }

        // Remove the curves which are not include in the inset.
        Objects objects;
        Face_handle face;
        for (Edge_iterator edge = arrangement.edges_begin(); edge != arrangement.edges_end(); ++edge)
        {
            CGAL::zone(*inset_1, edge->curve(), std::back_inserter(objects));
            for (Object_iterator object = objects.begin(); object != objects.end(); ++object)
            {
                if (assign(face, *object))
                {
                    if (face->is_unbounded())
                    {
                        remove_edge(arrangement, edge);
                        break;
                    }
                }
            }
            objects.clear();
        }

        // Print essential information on the standard input.
        std::cout << "Arrangement:" << std::endl;
        std::cout << "  Number of vertices: " << arrangement.number_of_vertices() << std::endl;
        std::cout << "  Number of edges   : " << arrangement.number_of_edges() << std::endl;
        std::cout << "  Number of face    : " << arrangement.number_of_faces() << std::endl;

        this->critical_curves.push_back(arrangement);

        ++inset_1;
        ++inset_2;
    }

    // Commit changes.
    emit(criticalCurvesChanged());
    return;
}
开发者ID:Manipulators,项目名称:Manipulator,代码行数:101,代码来源:criticalcurves.cpp


注:本文中的Objects::clear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。