示例#1
0
bool
WriterCompareTriangle::operator()(const std::pair<Triangle, int> & t1,
                                  const std::pair<Triangle, int> & t2) const
{
    const osg::Geometry *g = geode.getDrawable( t1.second )->asGeometry();

    const osg::Vec3Array * vecs= static_cast<const osg::Vec3Array *>(g->getVertexArray());
    const osg::BoundingBox::vec_type v1( (*vecs)[t1.first.t1] );

    if (t1.second != t2.second)
    {
        const osg::Geometry *g = geode.getDrawable( t2.second )->asGeometry();
        vecs = static_cast<const osg::Vec3Array *>(g->getVertexArray());
    };
    const osg::BoundingBox::vec_type v2( (*vecs)[t2.first.t1] );
    int val1 = inWhichBox(v1);
    int val2 = inWhichBox(v2);

    return (val1 < val2);
}
示例#2
0
bool 
WriterCompareTriangle::operator()(const std::pair<Triangle, int>& t1, 
                                  const std::pair<Triangle, int>& t2) const
{
    const osg::Geometry* g = geode.getDrawable( t1.second )->asGeometry();

    const osg::Vec3Array* vecs= static_cast<const osg::Vec3Array*>(g->getVertexArray());
    const osg::Vec3::value_type x1 = (*vecs)[t1.first.t1].x();
    const osg::Vec3::value_type y1 = (*vecs)[t1.first.t1].y();
    const osg::Vec3::value_type z1 = (*vecs)[t1.first.t1].z();

    if (t1.second != t2.second)
    {
        const osg::Geometry* g = geode.getDrawable( t2.second )->asGeometry();
        vecs = static_cast<const osg::Vec3Array*>(g->getVertexArray());
    }
    const osg::Vec3::value_type x2 = (*vecs)[t2.first.t1].x();
    const osg::Vec3::value_type y2 = (*vecs)[t2.first.t1].y();
    const osg::Vec3::value_type z2 = (*vecs)[t2.first.t1].z();
    int val1 = inWhichBox(x1,y1,z1);
    int val2 = inWhichBox(x2,y2,z2);

    return (val1 < val2);
}
示例#3
0
int WriterCompareTriangle::inWhichBox(const osg::BoundingBox::vec_type & point) const {
    return inWhichBox(point.x(), point.y(), point.z());
}