From b84a85f6480e4bcba9081f7c172c7e2c34e59187 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 3 Dec 2021 17:44:43 +0000 Subject: [PATCH] Cleanup dead code and stale TODOs. --- .../raytracing/shapes3D/bbox_3d.cpp | 61 ------------------- .../raytracing/shapes3D/bbox_3d.h | 8 --- common/plotters/DXF_plotter.cpp | 4 +- common/plugins/eagle/eagle_parser.cpp | 21 ------- 4 files changed, 1 insertion(+), 93 deletions(-) diff --git a/3d-viewer/3d_rendering/raytracing/shapes3D/bbox_3d.cpp b/3d-viewer/3d_rendering/raytracing/shapes3D/bbox_3d.cpp index 3b310c85b5..400c2533ec 100644 --- a/3d-viewer/3d_rendering/raytracing/shapes3D/bbox_3d.cpp +++ b/3d-viewer/3d_rendering/raytracing/shapes3D/bbox_3d.cpp @@ -254,47 +254,6 @@ SFVEC3F BBOX_3D::Offset( const SFVEC3F& p ) const } -/// @todo Why are we keeping both implementations of Intersect()? -// Intersection code based on the book: -// "Physical Based Ray Tracing" (by Matt Pharr and Greg Humphrey) -// https://github.com/mmp/pbrt-v2/blob/master/src/core/geometry.cpp#L68 -#if 0 -bool BBOX_3D::Intersect( const RAY& aRay, float* aOutHitt0, float* aOutHitt1 ) const -{ - float t0 = 0.0f; - float t1 = FLT_MAX; - - for( unsigned int i = 0; i < 3; ++i ) - { - // Update interval for _i_th bounding box slab - float tNear = ( m_min[i] - aRay.m_Origin[i] ) * aRay.m_InvDir[i]; - float tFar = ( m_max[i] - aRay.m_Origin[i] ) * aRay.m_InvDir[i]; - - // Update parametric interval from slab intersection - if( tNear > tFar ) - { - // Swap - float ftemp = tNear; - tNear = tFar; - tFar = ftemp; - } - - t0 = tNear > t0 ? tNear : t0; - t1 = tFar < t1 ? tFar : t1; - - if( t0 > t1 ) - return false; - } - - if( aOutHitt0 ) - *aOutHitt0 = t0; - - if( aOutHitt1 ) - *aOutHitt1 = t1; - - return true; -} -#else // https://github.com/mmp/pbrt-v2/blob/master/src/accelerators/bvh.cpp#L126 bool BBOX_3D::Intersect( const RAY& aRay, float* aOutHitt0, float* aOutHitt1 ) const { @@ -332,7 +291,6 @@ bool BBOX_3D::Intersect( const RAY& aRay, float* aOutHitt0, float* aOutHitt1 ) c return true; } -#endif void BBOX_3D::ApplyTransformation( glm::mat4 aTransformMatrix ) @@ -349,22 +307,3 @@ void BBOX_3D::ApplyTransformation( glm::mat4 aTransformMatrix ) } -void BBOX_3D::ApplyTransformationAA( glm::mat4 aTransformMatrix ) -{ - wxASSERT( IsInitialized() ); - - // apply the transformation matrix for each of vertices of the bounding box - // and make a union with all vertices - BBOX_3D tmpBBox = BBOX_3D( - SFVEC3F( aTransformMatrix * glm::vec4( m_min.x, m_min.y, m_min.z, 1.0f ) ) ); - tmpBBox.Union( SFVEC3F( aTransformMatrix * glm::vec4( m_max.x, m_min.y, m_min.z, 1.0f ) ) ); - tmpBBox.Union( SFVEC3F( aTransformMatrix * glm::vec4( m_min.x, m_max.y, m_min.z, 1.0f ) ) ); - tmpBBox.Union( SFVEC3F( aTransformMatrix * glm::vec4( m_min.x, m_min.y, m_max.z, 1.0f ) ) ); - tmpBBox.Union( SFVEC3F( aTransformMatrix * glm::vec4( m_min.x, m_max.y, m_max.z, 1.0f ) ) ); - tmpBBox.Union( SFVEC3F( aTransformMatrix * glm::vec4( m_max.x, m_max.y, m_min.z, 1.0f ) ) ); - tmpBBox.Union( SFVEC3F( aTransformMatrix * glm::vec4( m_max.x, m_min.y, m_max.z, 1.0f ) ) ); - tmpBBox.Union( SFVEC3F( aTransformMatrix * glm::vec4( m_max.x, m_max.y, m_max.z, 1.0f ) ) ); - - m_min = tmpBBox.m_min; - m_max = tmpBBox.m_max; -} diff --git a/3d-viewer/3d_rendering/raytracing/shapes3D/bbox_3d.h b/3d-viewer/3d_rendering/raytracing/shapes3D/bbox_3d.h index 0484946799..8342bdfb78 100644 --- a/3d-viewer/3d_rendering/raytracing/shapes3D/bbox_3d.h +++ b/3d-viewer/3d_rendering/raytracing/shapes3D/bbox_3d.h @@ -132,14 +132,6 @@ public: */ void ApplyTransformation( glm::mat4 aTransformMatrix ); - /** - * Apply a transformation matrix to the box points and recalculate it - * to fit an axis aligned bounding box. - * - * @param aTransformMatrix matrix to apply to the points of the bounding box. - */ - void ApplyTransformationAA( glm::mat4 aTransformMatrix ); - /** * Calculate the volume of a bounding box. * diff --git a/common/plotters/DXF_plotter.cpp b/common/plotters/DXF_plotter.cpp index b2157d050b..880efc82b0 100644 --- a/common/plotters/DXF_plotter.cpp +++ b/common/plotters/DXF_plotter.cpp @@ -811,9 +811,6 @@ void DXF_PLOTTER::FlashRegularPolygon( const wxPoint& aShapePos, int aRadius, in /** * Check if a given string contains non-ASCII characters. * - * @fixme The performance of this code is really poor, but in this case it can be - * acceptable because the plot operation is not called very often. - * * @param string String to check. * @return true if it contains some non-ASCII character, false if all characters are * inside ASCII range (<=255). @@ -823,6 +820,7 @@ bool containsNonAsciiChars( const wxString& string ) for( unsigned i = 0; i < string.length(); i++ ) { wchar_t ch = string[i]; + if( ch > 255 ) return true; } diff --git a/common/plugins/eagle/eagle_parser.cpp b/common/plugins/eagle/eagle_parser.cpp index d215426aa9..ca1350dcfe 100644 --- a/common/plugins/eagle/eagle_parser.cpp +++ b/common/plugins/eagle/eagle_parser.cpp @@ -1080,27 +1080,6 @@ EDEVICE_SET::EDEVICE_SET( wxXmlNode* aDeviceSet ) name = parseRequiredAttribute( aDeviceSet, "name" ); prefix = parseOptionalAttribute( aDeviceSet, "prefix" ); uservalue = parseOptionalAttribute( aDeviceSet, "uservalue" ); - - /* Russell: Parsing of devices and gates moved to sch_eagle_plugin.cpp - * - //TODO: description - - NODE_MAP aDeviceSetChildren = MapChildren(aDeviceSet); - wxXmlNode* deviceNode = getChildrenNodes(aDeviceSetChildren, "device"); - - while(deviceNode){ - devices.push_back(EDEVICE(deviceNode)); - deviceNode->GetNext(); - } - - wxXmlNode* gateNode = getChildrenNodes(aDeviceSetChildren, "gate"); - - while(gateNode){ - gates.push_back(EGATE(gateNode)); - gateNode->GetNext(); - } - */ - }