KiCad PCB EDA Suite
CONTAINER_3D_BASE Class Referenceabstract

#include <container_3d.h>

Inheritance diagram for CONTAINER_3D_BASE:
CONTAINER_3D

Public Member Functions

 CONTAINER_3D_BASE ()
 
virtual ~CONTAINER_3D_BASE ()
 
void Add (OBJECT_3D *aObject)
 
void Clear ()
 
const LIST_OBJECTGetList () const
 
void ConvertTo (CONST_VECTOR_OBJECT &aOutVector) const
 
const BBOX_3DGetBBox () const
 
virtual bool Intersect (const RAY &aRay, HITINFO &aHitInfo) const =0
 
virtual bool IntersectP (const RAY &aRay, float aMaxDistance) const =0
 

Protected Attributes

BBOX_3D m_bbox
 
LIST_OBJECT m_objects
 

Detailed Description

Definition at line 41 of file container_3d.h.

Constructor & Destructor Documentation

◆ CONTAINER_3D_BASE()

CONTAINER_3D_BASE::CONTAINER_3D_BASE ( )

Definition at line 32 of file container_3d.cpp.

33 {
34  m_objects.clear();
35  m_bbox.Reset();
36 }
LIST_OBJECT m_objects
Definition: container_3d.h:70
void Reset()
Reset the bounding box to zero and de-initialize it.
Definition: bbox_3d.cpp:95

References m_bbox, m_objects, and BBOX_3D::Reset().

◆ ~CONTAINER_3D_BASE()

CONTAINER_3D_BASE::~CONTAINER_3D_BASE ( )
virtual

Definition at line 56 of file container_3d.cpp.

57 {
58  Clear();
59 }

References Clear().

Member Function Documentation

◆ Add()

void CONTAINER_3D_BASE::Add ( OBJECT_3D aObject)
inline

Definition at line 48 of file container_3d.h.

49  {
50  if( aObject )
51  {
52  m_objects.push_back( aObject );
53  m_bbox.Union( aObject->GetBBox() );
54  }
55  }
void Union(const SFVEC3F &aPoint)
Recalculate the bounding box adding a point.
Definition: bbox_3d.cpp:102
LIST_OBJECT m_objects
Definition: container_3d.h:70
const BBOX_3D & GetBBox() const
Definition: object_3d.h:92

References OBJECT_3D::GetBBox(), m_bbox, m_objects, and BBOX_3D::Union().

Referenced by RENDER_3D_RAYTRACE::addModels(), RENDER_3D_RAYTRACE::createItemsFromContainer(), RENDER_3D_RAYTRACE::createObject(), RENDER_3D_RAYTRACE::insertHole(), and RENDER_3D_RAYTRACE::Reload().

◆ Clear()

void CONTAINER_3D_BASE::Clear ( )

Definition at line 39 of file container_3d.cpp.

40 {
41  if( !m_objects.empty() )
42  {
43  for( LIST_OBJECT::iterator ii = m_objects.begin(); ii != m_objects.end(); ++ii )
44  {
45  delete *ii;
46  *ii = nullptr;
47  }
48 
49  m_objects.clear();
50  }
51 
52  m_bbox.Reset();
53 }
LIST_OBJECT m_objects
Definition: container_3d.h:70
void Reset()
Reset the bounding box to zero and de-initialize it.
Definition: bbox_3d.cpp:95

References m_bbox, m_objects, and BBOX_3D::Reset().

Referenced by RENDER_3D_RAYTRACE::Reload(), and ~CONTAINER_3D_BASE().

◆ ConvertTo()

void CONTAINER_3D_BASE::ConvertTo ( CONST_VECTOR_OBJECT aOutVector) const

Definition at line 62 of file container_3d.cpp.

63 {
64  aOutVector.resize( m_objects.size() );
65 
66  if( !m_objects.empty() )
67  {
68  unsigned int i = 0;
69 
70  for( LIST_OBJECT::const_iterator ii = m_objects.begin(); ii != m_objects.end(); ++ii )
71  {
72  wxASSERT( (*ii) != nullptr );
73 
74  aOutVector[i++] = static_cast<const OBJECT_3D*>( *ii );
75  }
76  }
77 }
LIST_OBJECT m_objects
Definition: container_3d.h:70

References m_objects.

Referenced by BVH_PBRT::BVH_PBRT().

◆ GetBBox()

const BBOX_3D& CONTAINER_3D_BASE::GetBBox ( ) const
inline

Definition at line 63 of file container_3d.h.

63 { return m_bbox; }

References m_bbox.

Referenced by RENDER_3D_RAYTRACE::Reload().

◆ GetList()

const LIST_OBJECT& CONTAINER_3D_BASE::GetList ( ) const
inline

Definition at line 59 of file container_3d.h.

59 { return m_objects; }
LIST_OBJECT m_objects
Definition: container_3d.h:70

References m_objects.

Referenced by BVH_PBRT::BVH_PBRT(), and RENDER_3D_RAYTRACE::Reload().

◆ Intersect()

virtual bool CONTAINER_3D_BASE::Intersect ( const RAY aRay,
HITINFO aHitInfo 
) const
pure virtual

Implemented in CONTAINER_3D.

◆ IntersectP()

virtual bool CONTAINER_3D_BASE::IntersectP ( const RAY aRay,
float  aMaxDistance 
) const
pure virtual

Implemented in CONTAINER_3D.

Member Data Documentation

◆ m_bbox

BBOX_3D CONTAINER_3D_BASE::m_bbox
protected

Definition at line 69 of file container_3d.h.

Referenced by Add(), Clear(), CONTAINER_3D_BASE(), GetBBox(), and CONTAINER_3D::Intersect().

◆ m_objects

LIST_OBJECT CONTAINER_3D_BASE::m_objects
protected

The documentation for this class was generated from the following files: