Skip to content
Snippets Groups Projects
Commit 5cf4efbe authored by Daniel Filbert's avatar Daniel Filbert
Browse files

merged version

parents e98f43d2 a1de000e
No related branches found
No related tags found
No related merge requests found
......@@ -90,7 +90,7 @@ namespace ITAPropagationPathSim
* @param[out] lPropagationPaths Audible paths after recursive audibility test (with specular reflection anchors)
* @param[in] iCulling Enables/disables culling
*/
void Run( std::shared_ptr< ITAGeo::CPropagationAnchor > pSource, std::shared_ptr< ITAGeo::CPropagationAnchor > pDestination, ITAGeo::CPropagationPathList& lPropagationPaths, const int iCulling = ITAGeo::ECulling::NONE) const;
void Run( std::shared_ptr< ITAGeo::CPropagationAnchor > pSource, std::shared_ptr< ITAGeo::CPropagationAnchor > pDestination, ITAGeo::CPropagationPathList& lPropagationPaths, const ITAGeo::ECulling eCulling = ITAGeo::ECulling::NONE) const;
protected:
......
......@@ -63,6 +63,7 @@ bool RayDetectionSphereIntersectionTest(VistaRay rRay, std::shared_ptr< ITAGeo::
void ReflectRayOnFace(VistaRay& rRay, CITAMesh* pMesh, CITAMesh::FaceHandle hFace, VistaVector3D& v3ReflectionPoint)
{
assert(pMesh->has_face_normals());
CITAMesh::Normal normal(pMesh->normal(hFace));
const VistaVector3D v3FaceNormal(normal.data());
......@@ -74,7 +75,7 @@ void ReflectRayOnFace(VistaRay& rRay, CITAMesh* pMesh, CITAMesh::FaceHandle hFac
}
void CEngine::Run( std::shared_ptr< ITAGeo::CPropagationAnchor > pSource, std::shared_ptr< ITAGeo::CPropagationAnchor > pDestination, ITAGeo::CPropagationPathList& lPropagationPaths, const int iCulling /*= ITAGeo::ECulling::NONE*/ ) const
void CEngine::Run( std::shared_ptr< ITAGeo::CPropagationAnchor > pSource, std::shared_ptr< ITAGeo::CPropagationAnchor > pDestination, ITAGeo::CPropagationPathList& lPropagationPaths, const ITAGeo::ECulling eCulling /*= ITAGeo::ECulling::NONE*/ ) const
{
CITAMesh* pMesh = m_oMeshModel.GetMesh()->pMesh;
VistaVector3D v3SourcePoint = pSource->v3InteractionPoint;
......@@ -85,6 +86,7 @@ void CEngine::Run( std::shared_ptr< ITAGeo::CPropagationAnchor > pSource, std::s
VistaRay rRay;
rRay.SetOrigin(pSource->v3InteractionPoint);
// @todo: check correct randomness
float fAzimuthRad = VistaRandomNumberGenerator::GetStandardRNG()->GenerateFloat(0.0f, 2 * ITAConstants::PI_F);
float fElevationRad = VistaRandomNumberGenerator::GetStandardRNG()->GenerateFloat(0.0f, ITAConstants::PI_F);
VistaVector3D v3RandomDirection(cos(fAzimuthRad), sin(fAzimuthRad), cos(fElevationRad));
......@@ -105,6 +107,7 @@ void CEngine::Run( std::shared_ptr< ITAGeo::CPropagationAnchor > pSource, std::s
VistaVector3D v3DetectionPoint;
VistaVector3D v3ReflectionPoint;
// Store source position as start point of the propagation path
ITAGeo::CPropagationPath oPropagationPath;
oPropagationPath.push_back(pSource);
......@@ -119,7 +122,7 @@ void CEngine::Run( std::shared_ptr< ITAGeo::CPropagationAnchor > pSource, std::s
CITAMesh::FaceHandle hFace( *it++ );
// Check for intersection of the ray with current face
bFaceIntersectedByRay = ITAGeoUtils::RayFaceIntersectionTest(rRay, pMesh, hFace, v3ReflectionPoint);
bFaceIntersectedByRay = ITAGeoUtils::RayFaceIntersectionTest(rRay, pMesh, hFace, v3ReflectionPoint, eCulling);
if (bFaceIntersectedByRay)
{
// Reflect ray on face
......@@ -136,6 +139,25 @@ void CEngine::Run( std::shared_ptr< ITAGeo::CPropagationAnchor > pSource, std::s
// Update propagation losses
tPropagationLossFactor = 1 / powf(oPropagationPath.GetLength(), 2);
}
// Changes Not from me:
/*
{
//Set reflection anchor at intersection point
std::shared_ptr< ITAGeo::CSpecularReflection > pReflectionAnchor = std::make_shared < ITAGeo::CSpecularReflection >();
pReflectionAnchor->v3InteractionPoint = v3IntersectionPoint;
//Add reflection to path
lPropagationPaths[pNode->pImage->iOrder] = pReflectionAnchor;
//Add further propagation anchors to path
if (pNode->HasParent())
{
ConstructReflectionsPath(pNode->pParent, pReflectionAnchor, lPropagationPaths, eCulling);
}
}
else*/
}
// Check for recever hit by ray
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment