Removing sketch up version adaption for storing a new file after reading from...

Removing sketch up version adaption for storing a new file after reading from an skp file resource. SU2018 is default now.
parent 5c2c1231
......@@ -155,6 +155,11 @@ namespace ITAGeo
ORDER_1, //!< First order interaction, i.e one refection or one diffraction
ORDER_2, //!< Second order interaction, i.e. one reflection and one diffraction
ORDER_3, //!< ...
ORDER_4, //!< ...
ORDER_5, //!< ...
ORDER_6, //!< ...
ORDER_7, //!< ...
ORDER_8, //!< ...
};
class ITA_GEO_API CMirrorImage : public CPropagationAnchor
......
......@@ -91,6 +91,10 @@ namespace ITAGeo
void InvertAllFaceNormals();
//! Add propagation path visualization (that will be drawn if model is stored)
/**
* @note Uses pointers to propagation anchors.
* @todo Add visualization as layers
*/
void AddPropagationPathVisualization( const ITAGeo::CPropagationPath& oPath, std::string sName );
//! Add a visualization mesh
......
......@@ -37,6 +37,10 @@
namespace ITAGeoUtils
{
//! Returns only true, if a point lies within given polygon and in same plane, false otherwise
/**
* Calculates the dot product of all edges with the start-vertex-to-point vector and compares
* them among each other. Only, if all dot products have the same sign, the function will return true.
*/
ITA_GEO_API bool IsPointInPolygon( const VistaVector3D& v3Point, VistaPolygon& oPolygon );
//! Returns only true, if a ray casts through given polygon, false otherwise
......
......@@ -57,7 +57,7 @@ ITAGeo::CSketchUpModel::CSketchUpModel()
{
m_pTopLevelMeshModel = new ITAGeo::CHalfedgeMeshModel();
m_iSUVersion = 8; // TODO: move to cpp file, default su 2015
m_iSUVersion = SUModelVersion::SUModelVersion_SU2018;
SetName( "Unnamed_ITAGeoSketchUpModel" );
AddAcousticFacePropertyToMesh( m_pTopLevelMeshModel->GetMesh()->pTopLevelMesh );
}
......@@ -91,8 +91,7 @@ bool ITAGeo::CSketchUpModel::Load( const std::string& sSKPFilePath )
int iSUVersionMajor, iSUVersionMinor, iBuild;
SU_EXC( SUModelGetVersion( rModel, &iSUVersionMajor, &iSUVersionMinor, &iBuild ) );
SetSketchUpVersion( iSUVersionMajor );
SUStringRef rModelName = SU_INVALID;
SU_EXC( SUStringCreate( &rModelName ) );
SU_EXC( SUModelGetName( rModel, &rModelName ) );
......
......@@ -54,10 +54,15 @@ bool ITAGeoUtils::IsPointInPolygon( const VistaVector3D& v3Point, VistaPolygon&
if( vv3PolyPoints.size() < 3 )
return false;
for( size_t i = 0; i < vv3PolyPoints.size() - 2; i++ )
for( size_t i = 0; i < vv3PolyPoints.size() - 1; i++ )
{
if( vv3PolyPoints[ i ]->Dot( *vv3PolyPoints[ i + 1 ] ) !=
vv3PolyPoints[ i + 1 ]->Dot( *vv3PolyPoints[ ( i + 2 ) % vv3PolyPoints.size() ] ) )
const size_t iNextIdx = ( i + 1 ) % vv3PolyPoints.size();
const size_t iNextNextIdx = ( i + 2 ) % vv3PolyPoints.size();
const float fDotProduct1 = ( *vv3PolyPoints[ iNextIdx ] - *vv3PolyPoints[ i ] ).Dot( v3Point - *vv3PolyPoints[ i ] );
const float fDotProduct2 = ( *vv3PolyPoints[ iNextNextIdx ] - *vv3PolyPoints[ iNextIdx ] ).Dot( v3Point - *vv3PolyPoints[ iNextIdx ] );
// @todo jst: use single copysign function call
if( std::copysignf( 1.0f, fDotProduct1 ) != std::copysignf( 1.0f, fDotProduct2 ) )
return false;
}
......@@ -80,7 +85,8 @@ bool ITAGeoUtils::RayPolygonIntersectionTest( const VistaRay& rRay, VistaPolygon
oPlane.SetOrigin( *vv3PolyPoints[ 0 ] );
oPlane.SetNormVector( oPolygon.GetUpVector() );
oPlane.CalcIntersectionPoint( rRay, v3InteractionPoint );
if( !oPlane.CalcIntersectionPoint( rRay, v3InteractionPoint ) )
return false;
return IsPointInPolygon( v3InteractionPoint, oPolygon );
}
......@@ -88,7 +94,7 @@ bool ITAGeoUtils::RayPolygonIntersectionTest( const VistaRay& rRay, VistaPolygon
void ITAGeoUtils::MirrorPointOverPlane( const VistaVector3D& v3Point, const VistaPlane& oPlane, VistaVector3D& v3MirroredPoint )
{
const float fDistance = oPlane.CalcDistance( v3Point );
if( fDistance < ITAConstants::EPS_F_L )
if( std::abs( fDistance ) < ITAConstants::EPS_F_L )
{
v3MirroredPoint = v3Point;
}
......@@ -204,7 +210,7 @@ bool ITAGeoUtils::RojectPoint( const VistaVector3D& v3VertexStart, const VistaVe
*/
}
ITA_GEO_API unsigned long int ITAGeoUtils::CalculateNumberOfImages( const int iFaceCount, const int iOrder )
unsigned long int ITAGeoUtils::CalculateNumberOfImages( const int iFaceCount, const int iOrder )
{
if( iOrder <= 0 )
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