WIP

parent 43e7380b
......@@ -28,6 +28,7 @@
// STL includes
#include <complex>
#include <map>
#include <memory>
#include <string>
#include <vector>
......@@ -215,19 +216,28 @@ class ITA_GEO_API CITAMaterialManager
{
public:
inline CITAMaterialManager() {};
virtual inline ~CITAMaterialManager() {};
//! Retrieve acoustic material, if available
/**
* @param[in] sMaterialIdentifier Text-based material identifier (usually the name of the material)
* @return Pointer to material or nullptr, if not available
*/
const IITAAcousticMaterial* GetMaterial( const std::string& sMaterialIdentifier ) const;
virtual const IITAAcousticMaterial* GetMaterial( const std::string& sMaterialIdentifier ) const;
//! Add a material copy, if not already existant
/**
* @return True, if possible, false if already existing
*/
bool AddMaterialCopy( IITAAcousticMaterial* pMaterial );
virtual bool AddMaterialCopy( IITAAcousticMaterial* pMaterial );
private:
std::map< std::string, IITAAcousticMaterial* > m_mMaterials;
};
class ITA_GEO_API CITAMaterialDirectory
{
};
#endif // IW_ITA_GEO_ACOUSTIC_MATERIAL
......@@ -149,6 +149,9 @@ namespace ITAGeo
//! Get pointer to underlying mesh (OpenMESH)
const CITAMeshPtr* GetMesh() const;
//! Returns bounding box min and max point
void GetBoundingBoxAxesAligned( VistaVector3D& v3Min, VistaVector3D& v3Max ) const;
protected:
CITAMeshPtr* m_prModelMeshData; // CITAMesh pointer
......
......@@ -37,7 +37,10 @@
namespace ITAGeoUtils
{
//! Returns only true, if a point lies within given polygon and in same plane, false otherwise
ITA_GEO_API bool IsPointInPolygon( const VistaVector3D& v3Point, const VistaPolygon& oPolygon );
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 );
//! Mirrors point over a plane
ITA_GEO_API void MirrorPointOverPlane( const VistaVector3D& v3Point, const VistaPlane& oPlane, VistaVector3D& v3MirroredPoint );
......
......@@ -194,6 +194,39 @@ const CITAMeshPtr* ITAGeo::CHalfedgeMeshModel::GetMesh() const
return m_prModelMeshData;
}
void ITAGeo::CHalfedgeMeshModel::GetBoundingBoxAxesAligned( VistaVector3D& v3Min, VistaVector3D& v3Max ) const
{
CITAMesh* pMesh = static_cast< CITAMesh* >( m_prModelMeshData->pTopLevelMesh );
if( pMesh->n_vertices() == 0 )
{
v3Max.SetToZeroVector();
v3Min.SetToZeroVector();
return;
}
CITAMesh::VertexIter v_it = pMesh->vertices_begin();
CITAMesh::VertexHandle hFirstVertex( *v_it++ );
VistaVector3D v3FirstVertexPoint( pMesh->point( hFirstVertex ).data() );
v3Max = v3FirstVertexPoint;
v3Min = v3FirstVertexPoint;
while( v_it != pMesh->vertices_end() )
{
CITAMesh::VertexHandle hVertex( *v_it++ );
VistaVector3D v3VertexPoint( pMesh->point( hVertex ).data() );
for( int i = 0; i < 3; i++ )
{
if( v3VertexPoint[ i ] > v3Max[ i ] )
v3Max[ i ] = v3VertexPoint[ i ];
if( v3VertexPoint[ i ] < v3Min[ i ] )
v3Min[ i ] = v3VertexPoint[ i ];
}
}
}
CITAMeshPtr* ITAGeo::CHalfedgeMeshModel::GetMesh()
{
return m_prModelMeshData;
......
......@@ -46,15 +46,50 @@ bool ITAGeoUtils::CalculateDiffractionAperturePoint( const VistaVector3D& v3Star
return ITAGeoUtils::IsDiffractionAperturePointInRange( v3StartVertex, v3EndVertex, v3AperturePoint );
}
bool ITAGeoUtils::IsPointInPolygon( const VistaVector3D& v3Point, const VistaPolygon& oPolygon )
bool ITAGeoUtils::IsPointInPolygon( const VistaVector3D& v3Point, VistaPolygon& oPolygon )
{
ITA_EXCEPT0( NOT_IMPLEMENTED );
std::vector< VistaVector3D* > vv3PolyPoints;
oPolygon.GetPolyPoints( vv3PolyPoints );
if( vv3PolyPoints.size() < 3 )
return false;
for( size_t i = 0; i < vv3PolyPoints.size() - 2; i++ )
{
if( vv3PolyPoints[ i ]->Dot( *vv3PolyPoints[ i + 1 ] ) !=
vv3PolyPoints[ i + 1 ]->Dot( *vv3PolyPoints[ ( i + 2 ) % vv3PolyPoints.size() ] ) )
return false;
}
VistaPlane oPlaneOnSourceAndTarget;
oPlaneOnSourceAndTarget.SetOrigin( *vv3PolyPoints[ 0 ] );
oPlaneOnSourceAndTarget.SetNormVector( oPolygon.GetUpVector() );
if( oPlaneOnSourceAndTarget.CalcDistance( v3Point ) > ITAConstants::EPS_F_L )
return false;
return true;
}
bool ITAGeoUtils::RayPolygonIntersectionTest( const VistaRay& rRay, VistaPolygon& oPolygon )
{
std::vector< VistaVector3D* > vv3PolyPoints;
oPolygon.GetPolyPoints( vv3PolyPoints );
VistaPlane oPlane;
oPlane.SetOrigin( *vv3PolyPoints[ 0 ] );
oPlane.SetNormVector( oPolygon.GetUpVector() );
VistaVector3D v3ResolutionPoint;
oPlane.CalcIntersectionPoint( rRay, v3ResolutionPoint );
return IsPointInPolygon( v3ResolutionPoint, oPolygon );
}
void ITAGeoUtils::MirrorPointOverPlane( const VistaVector3D& v3Point, const VistaPlane& oPlane, VistaVector3D& v3MirroredPoint )
{
const float fDistance = oPlane.CalcDistance( v3Point );
if( fDistance < ITAConstants::EPS_F_L )
if( fDistance < ITAConstants::EPS_F_L )
{
v3MirroredPoint = v3Point;
}
......@@ -64,7 +99,7 @@ void ITAGeoUtils::MirrorPointOverPlane( const VistaVector3D& v3Point, const Vist
}
}
ITA_GEO_API float ITAGeoUtils::GetWedgeMainFaceElevationToPointRad( const VistaVector3D& v3StartVertex, const VistaVector3D& v3EndVertex, const VistaVector3D& v3MainFaceNormal, const VistaVector3D& v3Point )
float ITAGeoUtils::GetWedgeMainFaceElevationToPointRad( const VistaVector3D& v3StartVertex, const VistaVector3D& v3EndVertex, const VistaVector3D& v3MainFaceNormal, const VistaVector3D& v3Point )
{
VistaPlane oPlane;
oPlane.SetOrigin( v3StartVertex );
......
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