KiCad PCB EDA Suite
croundseg.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 <mrluzeiro@ua.pt>
5  * Copyright (C) 1992-2016 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, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
30 #ifndef _CROUNDSEG_H_
31 #define _CROUNDSEG_H_
32 
33 #include "cobject.h"
34 #include "../shapes2D/croundsegment2d.h"
35 
39 class CROUNDSEG : public COBJECT
40 {
41 
42 public:
46  CROUNDSEG( const CROUNDSEGMENT2D &aSeg2D, float aZmin, float aZmax );
47 
48  void SetColor( SFVEC3F aObjColor ) { m_diffusecolor = aObjColor; }
49 
50  // Imported from COBJECT
51  bool Intersect( const RAY &aRay, HITINFO &aHitInfo ) const override;
52  bool IntersectP( const RAY &aRay, float aMaxDistance ) const override;
53  bool Intersects( const CBBOX &aBBox ) const override;
54  SFVEC3F GetDiffuseColor( const HITINFO &aHitInfo ) const override;
55 
56 private:
58 
63 
64  float m_radius;
66  float m_inv_radius;
68 
70 };
71 
72 #if 0
73 
77 class COBLONGRING : public COBJECT
78 {
79 public:
83  CROUNDSEG( const SFVEC2F &aStart,
84  const SFVEC2F &aEnd,
85  float aInnerRadius,
86  float aOutterRadius,
87  float aZmin,
88  float aZmax );
89 
90  // Imported from COBJECT
91  bool Intersect( const RAY &aRay, HITINFO &aHitInfo ) const;
92  bool Intersects( const CBBOX &aBBox ) const;
93 
94 private:
95  RAYSEG2D m_segment;
96 
97  SFVEC3F m_center_left;
98  SFVEC3F m_center_right;
99  SFVEC3F m_plane_dir_left;
100  SFVEC3F m_plane_dir_right;
101 
102  float m_inner_radius;
103  float m_inner_radius_squared;
104  float m_inner_inv_radius;
105  float m_outter_radius;
106  float m_outter_radius_squared;
107  float m_outter_inv_radius;
108  float m_width;
109  float m_seglen_over_two_squared;
110 };
111 #endif
112 #endif // _CROUNDSEG_H_
SFVEC3F GetDiffuseColor(const HITINFO &aHitInfo) const override
Definition: croundseg.cpp:444
SFVEC3F m_plane_dir_left
Definition: croundseg.h:61
void SetColor(SFVEC3F aObjColor)
Definition: croundseg.h:48
Definition: ray.h:43
RAYSEG2D m_segment
Definition: croundseg.h:57
glm::vec2 SFVEC2F
Definition: xv3d_types.h:45
float m_seglen_over_two_squared
Definition: croundseg.h:67
SFVEC3F m_plane_dir_right
Definition: croundseg.h:62
CROUNDSEG(const CROUNDSEGMENT2D &aSeg2D, float aZmin, float aZmax)
Constructor CROUNDSEG.
Definition: croundseg.cpp:32
SFVEC3F m_center_left
Definition: croundseg.h:59
bool IntersectP(const RAY &aRay, float aMaxDistance) const override
Functions Intersect for shadow test.
Definition: croundseg.cpp:282
virtual bool Intersects(const CBBOX &aBBox) const =0
Function Intersects.
bool Intersect(const RAY &aRay, HITINFO &aHitInfo) const override
Functions Intersect.
Definition: croundseg.cpp:63
float m_radius_squared
Definition: croundseg.h:65
virtual bool Intersect(const RAY &aRay, HITINFO &aHitInfo) const =0
Functions Intersect.
Stores the hit information of a ray with a point on the surface of a object.
Definition: hitinfo.h:40
float m_radius
Definition: croundseg.h:64
glm::vec3 SFVEC3F
Definition: xv3d_types.h:47
float m_inv_radius
Definition: croundseg.h:66
bool Intersects(const CBBOX &aBBox) const override
Function Intersects.
Definition: croundseg.cpp:437
SFVEC3F m_center_right
Definition: croundseg.h:60
Class CBBOX manages a bounding box defined by two SFVEC3F min max points.
Definition: cbbox.h:40
SFVEC3F m_diffusecolor
Definition: croundseg.h:69
Definition: ray.h:86