Commit 43c1093b authored by Armin Erraji's avatar Armin Erraji

Small changes is BaseImageSource.cpp and its test.

parent 508b4120
......@@ -21,7 +21,7 @@
// ITA includes
#include <ITAGeo/Base.h>
#include <ITAGeo/Halfedge/MeshModel.h>
#include <ITAGeo/Urban/RTree.h>
#include <ITAGeo/Utils.h>
using namespace std;
......
......@@ -46,7 +46,7 @@ namespace ITAPropagationPathSim
* @param[in] iSourceImageOrder Defaults to 2 (first order images of sending entity / source)
*
*/
CSource(const ITAGeo::Halfedge::CMeshModelList& vpMeshModelList,int iSourceImageOrder = ITAGeo::ORDER_2);
CSource(shared_ptr<const ITAGeo::Halfedge::CMeshModelList> vpMeshModelList,int iSourceImageOrder = ITAGeo::ORDER_2);
//! Destructor
virtual ~CSource();
......@@ -106,7 +106,7 @@ namespace ITAPropagationPathSim
//---Member variables-------------------------------------------------------------------------------------------------
//Vector of mesh models
ITAGeo::Halfedge::CMeshModelList m_vpMeshModelList;
shared_ptr<const ITAGeo::Halfedge::CMeshModelList> m_vpMeshModelList;
//! Root of image sources as image source of order 0 (commonly the emitter)
CImageNode* m_pImagesRoot;
......
......@@ -15,22 +15,22 @@ struct CITAMeshPtr
//---Constructor----------------------------------------------------------------------------------------------------------------------------
CSource::CSource(const ITAGeo::Halfedge::CMeshModelList& vpMeshModelList, const int iSourceImageOrder)
CSource::CSource(shared_ptr<const ITAGeo::Halfedge::CMeshModelList> vpMeshModelList, const int iSourceImageOrder)
{
m_vpMeshModelList.CopyFrom(vpMeshModelList);
m_vpMeshModelList = vpMeshModelList;
//Copy to mesh model vector
for(int i = 0; i< vpMeshModelList.GetNumMeshes(); i++)
for(int i = 0; i< vpMeshModelList->GetNumMeshes(); i++)
{
// Calculate mesh face normals
CITAMesh* pMesh = m_vpMeshModelList[i]->GetMesh()->pMesh;
CITAMesh* pMesh = m_vpMeshModelList->at(i)->GetMesh()->pMesh;
pMesh->request_face_normals();
pMesh->update_face_normals();
}
//Initialize image root
m_pImagesRoot = new CImageNode(ITAGeo::ORDER_0, iSourceImageOrder, vpMeshModelList);
m_pImagesRoot = new CImageNode(ITAGeo::ORDER_0, iSourceImageOrder, *vpMeshModelList);
//Set max order member variable
m_iMaxOrder = iSourceImageOrder;
......@@ -65,7 +65,7 @@ void CSource::ConstructImagesRecursive(CImageNode* pParent, const int iMaxOrder,
return;
//Iterate over all mesh models
for(auto& pMeshModel : m_vpMeshModelList)
for(auto& pMeshModel : *m_vpMeshModelList)
{
CITAMesh* pCurrentMesh = pMeshModel->GetMesh()->pMesh;
......@@ -136,7 +136,7 @@ void CSource::ConstructReflectionPathList(CImageNode * pRoot, std::shared_ptr<IT
auto iCurrentOrder = pRoot->pImage->iOrder;
if ((iOrder != iCurrentOrder) && (iCurrentOrder < iMaxOrder))
{
for each (auto& pMeshModel in m_vpMeshModelList)
for each (auto& pMeshModel in *m_vpMeshModelList)
{
for each (auto pChild in pRoot->mpImageChildren[pMeshModel->GetName()])
{
......@@ -156,7 +156,7 @@ void CSource::ConstructReflectionsPath(CImageNode* pNode, std::shared_ptr< const
return;
//Get current mesh and the corresponding face handle
auto pCurrentMesh = m_vpMeshModelList.GetMeshModel(pNode->m_sMeshModelName)->GetMesh()->pMesh;
auto pCurrentMesh = m_vpMeshModelList->GetMeshModel(pNode->m_sMeshModelName)->GetMesh()->pMesh;
auto hFace = pCurrentMesh->face_handle(iFaceIndex);
VistaVector3D v3CurrentOrigin = pStartAnchor->v3InteractionPoint;
......
......@@ -39,7 +39,7 @@ int main( int iNumInArgs, char* pcInArgs[] )
string sSubFolder = "SketchUpFiles/";
//string sInFile = "NonSimpleRoom - Outside.skp";
string sInFile = "SimpleUrbanEnvironmentNotGrouped.skp";
string sInFile = "SimpleRoom.skp";
if( iNumInArgs > 1 )
sInFile = string( pcInArgs[ 1 ] );
......
......@@ -22,4 +22,4 @@ vista_configure_app( SimpleMeshModelDiffractionTest )
vista_install( SimpleMeshModelDiffractionTest )
vista_create_default_info_file( SimpleMeshModelDiffractionTest )
set_property( TARGET SimpleMeshModelDiffractionTest PROPERTY FOLDER "ITAGeometricalAcoustics/Tests/ITAPropagationPathSim/MeshModelDiffraction" )
set_property( TARGET SimpleMeshModelDiffractionTest PROPERTY FOLDER "ITAGeometricalAcoustics/Tests/ITAPropagationPathSim/MeshModel/Diffraction" )
......@@ -22,4 +22,4 @@ vista_configure_app( SimpleMeshModelImageSourceTest )
vista_install( SimpleMeshModelImageSourceTest )
vista_create_default_info_file( SimpleMeshModelImageSourceTest )
set_property( TARGET SimpleMeshModelImageSourceTest PROPERTY FOLDER "ITAGeometricalAcoustics/Tests/ITAPropagationPathSim/MeshModelDiffraction" )
set_property( TARGET SimpleMeshModelImageSourceTest PROPERTY FOLDER "ITAGeometricalAcoustics/Tests/ITAPropagationPathSim/MeshModel/Reflection" )
......@@ -41,22 +41,22 @@ using namespace ITAPropagationPathSim;
int main( int iNumInArgs, char* pcInArgs[] )
{
string sSUFolder = "SketchUpFiles/";
string sSUFolder = "../../ImageModel/SketchUpFiles/";
string sJsonFolder = "JsonFiles/";
string sInFile = "SimpleUrbanEnvironment";
string sInFile = "SimpleRoom";
if( iNumInArgs > 1 )
sInFile = string( pcInArgs[ 1 ] );
CMaterialDirectory oMaterialDir( "./" );
SketchUp::CModel oGeoModel;
ITAGeo::Halfedge::CMeshModelList vpMeshModelList;
auto vpMeshModelList = make_shared< ITAGeo::Halfedge::CMeshModelList>();
vpMeshModelList.SetMaterialManager( &oMaterialDir );
vpMeshModelList->SetMaterialManager( &oMaterialDir );
if (vpMeshModelList.Load(sSUFolder + sInFile + ".skp"))
if (vpMeshModelList->Load(sSUFolder + sInFile + ".skp"))
{
cout << "Succesffully loaded '" << sInFile << "'" << endl;
}
......@@ -74,19 +74,22 @@ int main( int iNumInArgs, char* pcInArgs[] )
//auto pSensor = make_shared<CSensor>( VistaVector3D( 3.0f, 3.3f, 1.3f ) );
auto pSensor = make_shared< CSensor >(VistaVector3D(-3.0f, -3.3f, 2.3f));
pSensor = make_shared< CSensor >(VistaVector3D(3.0f, 3.3f, 1.3f));
pEmitter = make_shared< CEmitter >(VistaVector3D(2.1f, 2.2f, 1.7f));
cout << "Emitter: " << pEmitter->vPos << endl;
cout << "Sensor: " << pSensor->vPos << endl;
//Set the mirror image engine for the urban environment
ITAPropagationPathSim::BaseEngine::MirrorImage::CSource oImageSourceEngine(vpMeshModelList, Order::ORDER_2);
ITAPropagationPathSim::BaseEngine::MirrorImage::CSource oImageSourceEngine(vpMeshModelList, Order::ORDER_3);
oImageSourceEngine.ConstructImages(pEmitter);
//Set the reflection sound paths
CPropagationPathList oPathListAll, oPathListVisible;
oImageSourceEngine.ConstructReflectionPathsOutside(pSensor, oPathListAll);
oImageSourceEngine.ConstructReflectionPathsInside(pSensor, oPathListAll);
//Get the visible sound paths
vpMeshModelList.FilterVisiblePaths(oPathListAll, oPathListVisible);
vpMeshModelList->FilterVisiblePaths(oPathListAll, oPathListVisible);
//Add paths to SketchUp Visualisation
......@@ -107,9 +110,9 @@ int main( int iNumInArgs, char* pcInArgs[] )
oGeoModel.AddSensorVisualization(*pSensor, "Sensor A");
//Store model
oGeoModel.Store( sSUFolder + "SimpleUrbanImageModelTest_"+ sInFile + ".skp");
oGeoModel.Store( sSUFolder + "SimpleMeshModelImageModelTest_"+ sInFile + ".skp");
oPathListVisible.Store(sJsonFolder + "SimpleUrbanImageModelTest_" + sInFile + ".json");
oPathListVisible.Store(sJsonFolder + "SimpleMeshModelImageModelTest_" + sInFile + ".json");
return 0;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment