diff --git a/include/ITAGeo/Base.h b/include/ITAGeo/Base.h index e4ccbe24f385424f420f432c4ef81420ccd7ca95..cfc14b2fc67a529962e11e963b381d6e661dae58 100644 --- a/include/ITAGeo/Base.h +++ b/include/ITAGeo/Base.h @@ -310,6 +310,7 @@ namespace ITAGeo inline CSpecularReflection() { iAnchorType = CPropagationAnchor::SPECULAR_REFLECTION; + v3FaceNormal.SetToZeroVector(); }; inline CSpecularReflection(const VistaVector3D& v3SpecularReflectionPoint) : CPropagationAnchor(v3SpecularReflectionPoint) @@ -326,6 +327,8 @@ namespace ITAGeo //! Load properties from JSON formatted string void LoadFromJSONString(const std::string& sContent, std::shared_ptr< CResourceManager > pResourceManager = nullptr); + VistaVector3D v3FaceNormal; //!< Face normal of reflection plane + std::shared_ptr< Material::IMaterial > pMaterial; //!< Acoustic material connection, i.e. absorption coefficient }; diff --git a/src/ITAGeo/Base.cpp b/src/ITAGeo/Base.cpp index 5a59dad0fa4e288d0f2308983e467f7719827a23..de6bc604aec48a817a4941bd5445a65268b0bdcc 100644 --- a/src/ITAGeo/Base.cpp +++ b/src/ITAGeo/Base.cpp @@ -522,6 +522,18 @@ std::stringstream ITAGeo::CSpecularReflection::ToJSON( std::shared_ptr< const CR JSONNode jnClassType("class", GetTypeStr()); jnRoot.push_back(jnClassType); } + + if (!v3FaceNormal.GetIsZeroVector()) + { + //Set interaction point array + JSONNode jnFaceNormalArray(JSON_ARRAY); + jnFaceNormalArray.set_name("face_normal"); + jnFaceNormalArray.push_back(JSONNode("x", v3FaceNormal[Vista::X])); + jnFaceNormalArray.push_back(JSONNode("y", v3FaceNormal[Vista::Y])); + jnFaceNormalArray.push_back(JSONNode("z", v3FaceNormal[Vista::Z])); + jnFaceNormalArray.push_back(JSONNode("w", v3FaceNormal[Vista::W])); + jnRoot.push_back(jnFaceNormalArray); + } //Get the acoustic material if( pMaterial && pResourceManager ) diff --git a/tests/PropagationPathsTest.cpp b/tests/PropagationPathsTest.cpp index 0873c9f34d4272eef416f5644f7db920ad2298c7..f7b1ded314df8ac5de262c8c1a4c018de0dd956b 100644 --- a/tests/PropagationPathsTest.cpp +++ b/tests/PropagationPathsTest.cpp @@ -12,6 +12,7 @@ int main( int, char** ) auto pReflection = make_shared< CSpecularReflection >(); pReflection->v3InteractionPoint.SetValues(-0.5f, -1.0f, -2.0f); + pReflection->v3FaceNormal.SetValues(1.f, 0.f, 0.f, 0.f); auto pReceiver = make_shared< CSensor >(); pReceiver->v3InteractionPoint.SetValues(-1.0f, -2.0f, -3.0f);