Fixup the 3d Viewer code after the last fixup

This commit is contained in:
Ian McInerney 2020-12-16 23:54:17 +00:00
parent b9b4618c8e
commit 048900dda7
3 changed files with 19 additions and 26 deletions

View File

@ -74,8 +74,11 @@ IFSG_COLORS::IFSG_COLORS( IFSG_NODE& aParent )
SGNODE* pp = aParent.GetRawPtr();
#ifdef DEBUG
// Braces needed due to dangling else warning from wxLogTrace macro
if( !pp )
{
wxLogTrace( MASK_3D_SG, "%s:%s:%d %s", __FILE__, __FUNCTION__, __LINE__, BadParent );
}
#endif
m_node = new SGCOLORS( nullptr );

View File

@ -170,23 +170,22 @@ bool CROUNDSEGMENT2D::Intersect( const RAYSEG2D &aSegRay,
{
if( !start_is_inside )
{
if( (hitted == false) || (rightSegT < closerHitT) )
if( ( hitted == false ) || ( rightSegT < closerHitT ) )
{
closerHitT = rightSegT;
closerHitNormal = SFVEC2F( -m_rightDir.y, m_rightDir.x );
}
if( start_is_inside )
{
if( (hitted == false) || (rightSegT > farHitT) )
{
farHitT = rightSegT;
farHitNormal = SFVEC2F( -m_rightDir.y, m_rightDir.x );
}
}
hitted = true;
}
else
{
if( ( hitted == false ) || ( rightSegT > farHitT ) )
{
farHitT = rightSegT;
farHitNormal = SFVEC2F( -m_rightDir.y, m_rightDir.x );
}
}
hitted = true;
}
float circleStart_T0;
@ -210,8 +209,7 @@ bool CROUNDSEGMENT2D::Intersect( const RAYSEG2D &aSegRay,
closerHitNormal = circleStart_N0;
}
}
if( start_is_inside )
else
{
if( (hitted == false) || (circleStart_T1 > farHitT) )
{
@ -253,8 +251,7 @@ bool CROUNDSEGMENT2D::Intersect( const RAYSEG2D &aSegRay,
closerHitNormal = circleEnd_N0;
}
}
if( start_is_inside )
else
{
if( (hitted == false) || (circleEnd_T1 > farHitT) )
{
@ -323,17 +320,11 @@ INTERSECTION_RESULT CROUNDSEGMENT2D::IsBBoxInside( const CBBOX2D &aBBox ) const
isInside[3] = IsPointInside( v[3] );
// Check if all points are inside the circle
if( isInside[0] &&
isInside[1] &&
isInside[2] &&
isInside[3] )
if( isInside[0] && isInside[1] && isInside[2] && isInside[3] )
return INTERSECTION_RESULT::FULL_INSIDE;
// Check if any point is inside the circle
if( isInside[0] ||
isInside[1] ||
isInside[2] ||
isInside[3] )
if( isInside[0] || isInside[1] || isInside[2] || isInside[3] )
return INTERSECTION_RESULT::INTERSECTS;
return INTERSECTION_RESULT::MISSES;

View File

@ -157,8 +157,7 @@ EDA_3D_VIEWER::EDA_3D_VIEWER( KIWAY *aKiway, PCB_BASE_FRAME *aParent, const wxSt
// Fixes bug in Windows (XP and possibly others) where the canvas requires the focus
// in order to receive mouse events. Otherwise, the user has to click somewhere on
// the canvas before it will respond to mouse wheel events.
if( m_canvas )
m_canvas->SetFocus();
m_canvas->SetFocus();
}