Extending polygon test and specular reflection class

parent 006ca88a
......@@ -67,7 +67,7 @@ namespace ITAGeo
bool bProtected; //!< Protect this anchor from destruction in DeleteAnchorsAndClear function
CPropagationAnchor();
CPropagationAnchor( const VistaVector3D& oPos );
CPropagationAnchor( const VistaVector3D& v3Pos );
virtual ~CPropagationAnchor();
//! Returns anchor type as a string
......@@ -162,6 +162,7 @@ namespace ITAGeo
public:
VistaVector3D v3MirrorNormal; //<! If normal is zero vector, image is invalid / was not reflected
const VistaVector3D& v3MirrorPosition; //!< Mirror image position (alias for interaction point)
int iPolygonIndex; //!< Polygon index helper (for recursive audibility test)
int iOrder;
void* pUserData; //!< User data pointer (for future use)
......@@ -170,6 +171,7 @@ namespace ITAGeo
: iPolygonIndex( -1 )
, pUserData( nullptr )
, iOrder( -1 )
, v3MirrorPosition( v3InteractionPoint )
{
CPropagationAnchor::iAnchorType = CPropagationAnchor::ITA_SPECULAR_REFLECTION;
};
......@@ -179,6 +181,7 @@ namespace ITAGeo
, iPolygonIndex( -1 )
, iOrder( -1 )
, pUserData( nullptr )
, v3MirrorPosition( v3InteractionPoint )
{
CPropagationAnchor::iAnchorType = CPropagationAnchor::ITA_SPECULAR_REFLECTION;
};
......@@ -194,9 +197,7 @@ namespace ITAGeo
if( pManager )
pManager->AssignMaterial( *this, oOther.pAcousticMaterial->GetIdentifier(), pAcousticMaterial );
*/
}
};
};
//! Geometrical propagation anchor with parameters of a specular reflection point
......@@ -207,6 +208,8 @@ namespace ITAGeo
{
public:
inline CSpecularReflection() {};
inline CSpecularReflection( const VistaVector3D& v3SpecularReflectionPoint )
: CPropagationAnchor( v3SpecularReflectionPoint ) {};
inline virtual ~CSpecularReflection() {};
};
......
......@@ -40,7 +40,7 @@ namespace ITAGeoUtils
ITA_GEO_API bool IsPointInPolygon( const VistaVector3D& v3Point, VistaPolygon& oPolygon );
//! Returns only true, if a ray casts through given polygon, false otherwise
ITA_GEO_API bool RayPolygonIntersectionTest( const VistaRay& rRay, VistaPolygon& oPolygon );
ITA_GEO_API bool RayPolygonIntersectionTest( const VistaRay& rRay, VistaPolygon& oPolygon, VistaVector3D& v3IntersectionPoint );
//! Mirrors point over a plane
ITA_GEO_API void MirrorPointOverPlane( const VistaVector3D& v3Point, const VistaPlane& oPlane, VistaVector3D& v3MirroredPoint );
......
......@@ -71,7 +71,7 @@ bool ITAGeoUtils::IsPointInPolygon( const VistaVector3D& v3Point, VistaPolygon&
return true;
}
bool ITAGeoUtils::RayPolygonIntersectionTest( const VistaRay& rRay, VistaPolygon& oPolygon )
bool ITAGeoUtils::RayPolygonIntersectionTest( const VistaRay& rRay, VistaPolygon& oPolygon, VistaVector3D& v3InteractionPoint )
{
std::vector< VistaVector3D* > vv3PolyPoints;
oPolygon.GetPolyPoints( vv3PolyPoints );
......@@ -80,10 +80,9 @@ bool ITAGeoUtils::RayPolygonIntersectionTest( const VistaRay& rRay, VistaPolygon
oPlane.SetOrigin( *vv3PolyPoints[ 0 ] );
oPlane.SetNormVector( oPolygon.GetUpVector() );
VistaVector3D v3ResolutionPoint;
oPlane.CalcIntersectionPoint( rRay, v3ResolutionPoint );
oPlane.CalcIntersectionPoint( rRay, v3InteractionPoint );
return IsPointInPolygon( v3ResolutionPoint, oPolygon );
return IsPointInPolygon( v3InteractionPoint, oPolygon );
}
void ITAGeoUtils::MirrorPointOverPlane( const VistaVector3D& v3Point, const VistaPlane& oPlane, VistaVector3D& v3MirroredPoint )
......
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