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


C++ DynamicArray::begin方法代码示例

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


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

示例1: reset

    void RelationalState::reset(PosState & last, CartWheel3D * cw) {
        double atThresh = 1.0;
        double changeThresh = 0.0001;
        //get each human (just doing humans now
        fullClear();
        if (last.getNumVectors() == 0)
            return;
        int numThings = last.getNumVectors();
        //just binary relations for right now
        for (int i = 0; i < numThings; i++) {
            Vector3d pos1 = findPlace(i, last, cw);
            string n1 = findName(i, last);
            for (int j = 0; j < numThings; j++) {
                if (i == j)
                    continue;
                Vector3d pos2 = findPlace(j, last, cw);
                double dist = ControlUtils::eucDistance2d(pos1, pos2);
                string n2 = findName(j, last);
                double prevDist = ControlUtils::eucDistance2d(
                        *(last.getPosition(n1)), *(last.getPosition(n2)));

                //                      cout<<"rel check "<<dist<<"  "<<prevDist<<endl;
                if (dist < atThresh) {
                    addRelation(*(new Relation("At", n1, n2)));
                }

                if (fabs(dist - prevDist) > changeThresh) {
                    if (dist - prevDist < 0)
                        addRelation(*(new Relation("DistanceDecreasing", n1, n2)));
                    else
                        addRelation(*(new Relation("DistanceIncreasing", n1, n2)));
                } else {
                    addRelation(*(new Relation("DistanceConstant", n1, n2)));
                }

            }
        }

        //      typedef boost::shared_ptr<Relation> RelationPtr;

        DynamicArray<ContactPoint>* contactPoints = cw->getWorld()->getContactForces();

        for (std::vector<ContactPoint>::iterator iter = contactPoints->begin(); iter != contactPoints->end(); ++iter) {
            //              addRelation(  *( new Relation("Contact",
            //                                                                        iter->rb1->getName(),
            //                                                                        iter->rb2->getName()) )  );
            Relation contact("Contact",
                    StringUtils::split(iter->rb1->getName(), ' ')[0],
                    StringUtils::split(iter->rb2->getName(), ' ')[0]);
            if (!contains(contact))
                addRelation(*(new Relation("Contact",
                    StringUtils::split(iter->rb1->getName(), ' ')[0],
                    StringUtils::split(iter->rb2->getName(), ' ')[0])));

        }
    }
开发者ID:ninod2014,项目名称:ua-cartwheel,代码行数:56,代码来源:RelationalState.cpp

示例2: getSubNames

    /**
     * @brief Returns list of sub-configuration names.
     *
     * @return
     */
    DynamicArray<String> getSubNames() const noexcept override
    {
        DynamicArray<String> names;

        for (auto child : m_node.children())
        {
            if (std::find(names.begin(), names.end(), child.name()) == names.end())
                names.push_back(child.name());
        }

        return names;
    }
开发者ID:GustavoPB,项目名称:CeCe,代码行数:17,代码来源:Configuration.hpp

示例3: draw

void Container::draw(const simulator::Simulation& simulation, render::Context& context)
{
    DynamicArray<ViewPtr<Module>> modules;

    // Copy modules (view pointer)
    for (const auto& module : m_modules)
        modules.push_back(module.second);

    // Sort modules by rendering order
    std::sort(modules.begin(), modules.end(), [](const ViewPtr<Module>& lhs, const ViewPtr<Module>& rhs) {
        return lhs->getZOrder() < rhs->getZOrder();
    });

    // Render modules
    for (auto& module : modules)
        module->draw(simulation, context);
}
开发者ID:GustavoPB,项目名称:CeCe,代码行数:17,代码来源:Container.cpp

示例4: update

void Container::update(simulator::Simulation& simulation, units::Time dt)
{
    DynamicArray<ViewPtr<Module>> modules;

    // Copy modules (view pointer)
    for (const auto& module : m_modules)
        modules.push_back(module.second);

    // Sort modules by priority. Cannot be precomputed, because priority can change in previous iteration
    std::sort(modules.begin(), modules.end(),
        [](const ViewPtr<Module>& lhs, const ViewPtr<Module>& rhs) {
            return lhs->getPriority() > rhs->getPriority();
    });

    // Update modules
    for (auto& module : modules)
        module->update(simulation, dt);
}
开发者ID:GustavoPB,项目名称:CeCe,代码行数:18,代码来源:Container.cpp


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