KiCad PCB EDA Suite
sg_base.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 Cirilo Bernardo <[email protected]>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
30#ifndef SG_BASE_H
31#define SG_BASE_H
32
34
35#ifndef SGLIB_API
36 #if defined (COMPILE_SGLIB)
37 #define SGLIB_API APIEXPORT
38 #else
39 #define SGLIB_API APIIMPORT
40 #endif
41#endif
42
44{
45protected:
46 float red;
47 float green;
48 float blue;
49
50public:
51 SGCOLOR();
52 SGCOLOR( float aRVal, float aGVal, float aBVal );
53
54 void GetColor( float& aRedVal, float& aGreenVal, float& aBlueVal ) const noexcept;
55 void GetColor( SGCOLOR& aColor ) const noexcept;
56 void GetColor( SGCOLOR* aColor ) const noexcept;
57
58 bool SetColor( float aRedVal, float aGreenVal, float aBlueVal );
59 bool SetColor( const SGCOLOR& aColor ) noexcept;
60 bool SetColor( const SGCOLOR* aColor ) noexcept;
61
62private:
63 bool checkRange( float aRedVal, float aGreenVal, float aBlueVal ) const noexcept;
64};
65
66
68{
69public:
70 double x;
71 double y;
72 double z;
73
74public:
75 SGPOINT();
76 SGPOINT( double aXVal, double aYVal, double aZVal ) noexcept;
77
78 void GetPoint( const double& aXVal, const double& aYVal, const double& aZVal ) noexcept;
79 void GetPoint( const SGPOINT& aPoint ) noexcept;
80 void GetPoint( const SGPOINT* aPoint ) noexcept;
81
82 void SetPoint( double aXVal, double aYVal, double aZVal ) noexcept;
83 void SetPoint( const SGPOINT& aPoint ) noexcept;
84};
85
86
88{
89private:
90 void normalize( void ) noexcept;
91
92 double vx;
93 double vy;
94 double vz;
95
96public:
97 SGVECTOR();
98 SGVECTOR( double aXVal, double aYVal, double aZVal );
99
100 void GetVector( double& aXVal, double& aYVal, double& aZVal ) const noexcept;
101
102 void SetVector( double aXVal, double aYVal, double aZVal );
103 void SetVector( const SGVECTOR& aVector );
104
105 SGVECTOR& operator=( const SGVECTOR& source ) noexcept;
106};
107
108
109#endif // SG_BASE_H
float red
Definition: sg_base.h:46
float green
Definition: sg_base.h:47
float blue
Definition: sg_base.h:48
double z
Definition: sg_base.h:72
double x
Definition: sg_base.h:70
double y
Definition: sg_base.h:71
double vz
Definition: sg_base.h:94
double vx
Definition: sg_base.h:92
double vy
Definition: sg_base.h:93
#define SGLIB_API
Definition: sg_base.h:39