Commit e33b7a81 authored by Frédéric Larue's avatar Frédéric Larue

Corners() function of Box2/3f returns a CornerSet instead of taking one as parameter.

parent be7648fc
......@@ -166,7 +166,7 @@ public:
*
* \return Set of corner points.
*/
inline void Corners( CornerSet &corners ) const;
inline CornerSet Corners() const;
/** Explicit specification of the box boundaries.
*
......@@ -284,12 +284,14 @@ inline void Box2f::SetBoundaries( const float xMin, const float xMax,
}
inline void Box2f::Corners( CornerSet &corners ) const
inline Box2f::CornerSet Box2f::Corners() const
{
CornerSet corners;
corners.xy = m_Min;
corners.Xy = QVector2D( m_Max.x(), m_Min.y() );
corners.xY = QVector2D( m_Min.x(), m_Max.y() );
corners.XY = m_Max;
return corners;
}
......@@ -470,7 +472,7 @@ public:
*
* \return Set of corner points.
*/
inline void Corners( CornerSet &corners ) const;
inline CornerSet Corners() const;
/** Explicit specification of the box boundaries.
*
......@@ -624,8 +626,9 @@ inline void Box3f::SetBoundaries( const float xMin, const float xMax,
}
inline void Box3f::Corners( CornerSet &corners ) const
inline Box3f::CornerSet Box3f::Corners() const
{
CornerSet corners;
corners.xyz = m_Min;
corners.xyZ = QVector3D( m_Min.x(), m_Min.y(), m_Max.z() );
corners.xYz = QVector3D( m_Min.x(), m_Max.y(), m_Min.z() );
......@@ -634,6 +637,7 @@ inline void Box3f::Corners( CornerSet &corners ) const
corners.XyZ = QVector3D( m_Max.x(), m_Min.y(), m_Max.z() );
corners.XYz = QVector3D( m_Max.x(), m_Max.y(), m_Min.z() );
corners.XYZ = m_Max;
return corners;
}
......
......@@ -140,17 +140,13 @@ bool Frustum::IsOutside( const Box3f::CornerSet& corners ) const
bool Frustum::IsOutside( const Box3f& box ) const
{
Box3f::CornerSet corners;
box.Corners( corners );
return IsOutside( corners );
return IsOutside( box.Corners() );
}
bool Frustum::IsOutside( const Box3f& box, const QMatrix4x4& model ) const
{
Box3f::CornerSet corners;
box.Corners( corners );
Box3f::CornerSet corners = box.Corners();
for( auto &c : corners )
c = model.map( c );
......@@ -180,8 +176,7 @@ bool Frustum::IsOutside( const QVector3D& sphereCenter, float sphereRadius, cons
Frustum::VisibilityState Frustum::TestVisibility( const Box3f& box ) const
{
Box3f::CornerSet corners;
box.Corners( corners );
Box3f::CornerSet corners = box.Corners();
uint32_t outsideTotalCount = 0;
for( int i=0; i<PLANE_COUNT; ++i )
......
......@@ -530,9 +530,7 @@ void GLViewer::frameItems( QList<GenericUIData*> &items )
if( dispInfo != m_Displayables.end() )
if( !dispInfo->second.boundingBox.IsNull() )
{
Box3f::CornerSet objectBoxCorners;
dispInfo->second.boundingBox.Corners( objectBoxCorners );
Box3f::CornerSet objectBoxCorners = dispInfo->second.boundingBox.Corners();
for( auto c=objectBoxCorners.begin(); c!=objectBoxCorners.end(); ++c )
box.Add( dispInfo->second.GetTransform().map(*c) );
}
......@@ -557,13 +555,8 @@ Box3f GLViewer::sceneBox() const
{
const Box3f &objectBox = dispInfo.second.boundingBox;
if( !objectBox.IsNull() )
{
Box3f::CornerSet objectBoxCorners;
objectBox.Corners( objectBoxCorners );
for( auto &c : objectBoxCorners )
for( auto &c : objectBox.Corners() )
box.Add( dispInfo.second.GetTransform().map(c) );
}
}
return box;
......
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