Exemple #1
0
    bool isInRange(const vector3& posLeafCenter, const axisAlignedBox& octreeNode, const uint32& lod)
    {
        const vector3 sizeLeaf(t_tileContainer::voxelLength);
        const vector3 sizeLeafDoubled(sizeLeaf*2);
        const vector3 octreeNodeTwiceMinimum((octreeNode.getMinimum()/sizeLeafDoubled).getFloor()*sizeLeafDoubled);
        const axisAlignedBox octreeNodeTwice(octreeNodeTwiceMinimum, octreeNodeTwiceMinimum + octreeNode.getSize()*2.);

        const vector3 posLeafCenterScaled((posLeafCenter / sizeLeafDoubled).getFloor());

        if (lod != 0 && false)
        {
            if (octreeNode.getSize() == sizeLeaf)
            {
                const real radius(m_syncRadien[lod-1] / 2.);
                blub::sphere coll2(posLeafCenter, radius);
                if (coll2.intersects(octreeNode))
                {
                    return false;
                }
            }
        }

        const real radius(m_syncRadien[lod]);
        blub::sphere coll(posLeafCenterScaled * sizeLeafDoubled + sizeLeaf, radius);
        const bool result(coll.intersects(octreeNodeTwice));

        return result;
    }
axisAlignedBox editAxisAlignedBox::scaleAab(const axisAlignedBox& aab, const real scale)
{
    return axisAlignedBox (aab.minimum()/scale, aab.maximum()/scale);
}
string string::number(const axisAlignedBox& aab)
{
    return number(aab.getMinimum()) + "; " + number(aab.getMaximum());
}