KiCad PCB EDA Suite
Loading...
Searching...
No Matches
container_3d.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2015-2016 Mario Luzeiro <[email protected]>
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
21#pragma once
22
24#include <list>
25#include <vector>
26
27
29{
30public:
32
33 virtual ~CONTAINER_3D_BASE();
34
35 void Add( OBJECT_3D* aObject )
36 {
37 if( aObject )
38 {
39 m_objects.push_back( aObject );
40 m_bbox.Union( aObject->GetBBox() );
41 }
42 }
43
44 void Clear();
45
46 const std::list<OBJECT_3D*>& GetList() const { return m_objects; }
47
48 void ConvertTo( std::vector<const OBJECT_3D*>& aOutVector ) const;
49
50 const BBOX_3D& GetBBox() const { return m_bbox; }
51
52 virtual bool Intersect( const RAY& aRay, HITINFO& aHitInfo ) const = 0;
53 virtual bool IntersectP( const RAY& aRay, float aMaxDistance ) const = 0;
54
55protected:
57 std::list<OBJECT_3D*> m_objects;
58};
59
60
62{
63public:
64 bool Intersect( const RAY& aRay, HITINFO& aHitInfo ) const override;
65 bool IntersectP( const RAY& aRay, float aMaxDistance ) const override;
66};
virtual bool Intersect(const RAY &aRay, HITINFO &aHitInfo) const =0
const std::list< OBJECT_3D * > & GetList() const
void ConvertTo(std::vector< const OBJECT_3D * > &aOutVector) const
const BBOX_3D & GetBBox() const
std::list< OBJECT_3D * > m_objects
virtual bool IntersectP(const RAY &aRay, float aMaxDistance) const =0
void Add(OBJECT_3D *aObject)
virtual ~CONTAINER_3D_BASE()
bool Intersect(const RAY &aRay, HITINFO &aHitInfo) const override
bool IntersectP(const RAY &aRay, float aMaxDistance) const override
const BBOX_3D & GetBBox() const
Definition object_3d.h:88
Manage a bounding box defined by two SFVEC3F min max points.
Definition bbox_3d.h:39
Stores the hit information of a ray with a point on the surface of a object.
Definition hitinfo.h:32
Definition ray.h:59