Hi, Im making a project about polygonal meshes, I have a function where I have to make like a imaginary box which covers an object like in the photo. Im using a .h file and a .cxx file where I put the implementation, I already have everything but when I compilate it somehow the compiler doesn't detect the function.
cxx file:
#include "mallas.h"
#include <iostream>
#include <fstream>
using namespace std;
std::vector<Objeto3D> objetosCargados;
void envolvente(std::string nombre_objeto) {
if (objetosCargados.empty()) {
std::cout << "Ningún objeto ha sido cargado en memoria." << std::endl;
return;
}
if (objetosCargados.empty()) {
// Caso: Generar caja envolvente global
Objeto3D env_global;
env_global.nombre = "env_global";
for (const auto& objeto : objetosCargados) {
calcularCajaEnvolvente(objeto, env_global);
}
objetosCargados.push_back(env_global);
std::cout << "La caja envolvente de los objetos en memoria se ha generado con el nombre env_global y se ha agregado a los objetos en memoria." << std::endl;
} else {
// Caso: Generar caja envolvente para un objeto específico
auto it = std::find_if(objetosCargados.begin(), objetosCargados.end(),
[&nombre_objeto](const Objeto3D& obj) { return obj.nombre == nombre_objeto; });
if (it == objetosCargados.end()) {
std::cout << "El objeto " << nombre_objeto << " no ha sido cargado en memoria." << std::endl;
} else {
Objeto3D env_objeto;
env_objeto.nombre = "env_" + nombre_objeto;
calcularCajaEnvolvente(*it, env_objeto);
objetosCargados.push_back(env_objeto);
std::cout << "La caja envolvente del objeto " << nombre_objeto << " se ha generado con el nombre "
<< env_objeto.nombre << " y se ha agregado a los objetos en memoria." << std::endl;
}
}
}