KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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, see <https://www.gnu.org/licenses/>.
18 */
19
24
25
26#ifndef SG_BASE_H
27#define SG_BASE_H
28
30
31#ifndef SGLIB_API
32 #if defined (COMPILE_SGLIB)
33 #define SGLIB_API APIEXPORT
34 #else
35 #define SGLIB_API APIIMPORT
36 #endif
37#endif
38
40{
41protected:
42 float red;
43 float green;
44 float blue;
45
46public:
47 SGCOLOR();
48 SGCOLOR( float aRVal, float aGVal, float aBVal );
49
50 void GetColor( float& aRedVal, float& aGreenVal, float& aBlueVal ) const noexcept;
51 void GetColor( SGCOLOR& aColor ) const noexcept;
52 void GetColor( SGCOLOR* aColor ) const noexcept;
53
54 bool SetColor( float aRedVal, float aGreenVal, float aBlueVal );
55 bool SetColor( const SGCOLOR& aColor ) noexcept;
56 bool SetColor( const SGCOLOR* aColor ) noexcept;
57
58private:
59 bool checkRange( float aRedVal, float aGreenVal, float aBlueVal ) const noexcept;
60};
61
62
64{
65public:
66 double x;
67 double y;
68 double z;
69
70public:
71 SGPOINT();
72 SGPOINT( double aXVal, double aYVal, double aZVal ) noexcept;
73
74 void GetPoint( const double& aXVal, const double& aYVal, const double& aZVal ) noexcept;
75 void GetPoint( const SGPOINT& aPoint ) noexcept;
76 void GetPoint( const SGPOINT* aPoint ) noexcept;
77
78 void SetPoint( double aXVal, double aYVal, double aZVal ) noexcept;
79 void SetPoint( const SGPOINT& aPoint ) noexcept;
80};
81
82
84{
85private:
86 void normalize( void ) noexcept;
87
88 double vx;
89 double vy;
90 double vz;
91
92public:
93 SGVECTOR();
94 SGVECTOR( double aXVal, double aYVal, double aZVal );
95
96 void GetVector( double& aXVal, double& aYVal, double& aZVal ) const noexcept;
97
98 void SetVector( double aXVal, double aYVal, double aZVal );
99 void SetVector( const SGVECTOR& aVector );
100
101 SGVECTOR& operator=( const SGVECTOR& source ) noexcept;
102};
103
104
105#endif // SG_BASE_H
bool SetColor(float aRedVal, float aGreenVal, float aBlueVal)
Definition sg_base.cpp:81
float red
Definition sg_base.h:42
void GetColor(float &aRedVal, float &aGreenVal, float &aBlueVal) const noexcept
Definition sg_base.cpp:55
bool checkRange(float aRedVal, float aGreenVal, float aBlueVal) const noexcept
Definition sg_base.cpp:114
float green
Definition sg_base.h:43
float blue
Definition sg_base.h:44
SGCOLOR()
Definition sg_base.cpp:30
double z
Definition sg_base.h:68
void GetPoint(const double &aXVal, const double &aYVal, const double &aZVal) noexcept
Definition sg_base.cpp:162
void SetPoint(double aXVal, double aYVal, double aZVal) noexcept
Definition sg_base.cpp:188
double x
Definition sg_base.h:66
double y
Definition sg_base.h:67
void normalize(void) noexcept
Definition sg_base.cpp:244
double vz
Definition sg_base.h:90
void GetVector(double &aXVal, double &aYVal, double &aZVal) const noexcept
Definition sg_base.cpp:221
double vx
Definition sg_base.h:88
double vy
Definition sg_base.h:89
SGVECTOR & operator=(const SGVECTOR &source) noexcept
Definition sg_base.cpp:266
void SetVector(double aXVal, double aYVal, double aZVal)
Definition sg_base.cpp:229
#define SGLIB_API
Definition sg_base.h:35