예제 #1
0
bool MeshListGeometry::equals(const MeshListGeometry& meshList, double epsilon /*= 1e-6*/) const {
    if (getMeshCount() != meshList.getMeshCount())
        return false;
    for (size_t i=0; i<getMeshCount(); i++) {
        if (!meshes_[i].equals(meshList.meshes_[i], epsilon))
            return false;
    }
    return true;
}
예제 #2
0
void MeshListGeometry::getBoundingBox(tgt::vec3& llf, tgt::vec3& urb) const {
    llf = tgt::vec3(FLT_MAX);
    urb = tgt::vec3(-FLT_MAX);
    for (size_t i = 0; i < getMeshCount(); ++i) {
        const MeshGeometry& mesh = getMesh(i);
        for (size_t j = 0; j < mesh.getFaceCount(); ++j) {
            const FaceGeometry& face = mesh.getFace(j);
            for (size_t k = 0; k < face.getVertexCount(); ++k) {
                const VertexGeometry& vertex = face.getVertex(k);
                const tgt::vec3& coords = vertex.getCoords();

                llf.x = std::min(llf.x, coords.x);
                urb.x = std::max(urb.x, coords.x);
                llf.y = std::min(llf.y, coords.y);
                urb.y = std::max(urb.y, coords.y);
                llf.z = std::min(llf.z, coords.z);
                urb.z = std::max(urb.z, coords.z);
            }
        }
    }
}