Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
3c97a45f
Commit
3c97a45f
authored
Oct 25, 2008
by
charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
code cleaning, and some minor bugs solved
parent
07a39a03
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
95 additions
and
80 deletions
+95
-80
netform.cpp
eeschema/netform.cpp
+5
-7
macros.h
include/macros.h
+0
-8
libs.win
libs.win
+1
-1
class_pad.h
pcbnew/class_pad.h
+8
-2
class_track.cpp
pcbnew/class_track.cpp
+1
-0
class_track.h
pcbnew/class_track.h
+11
-3
class_zone.h
pcbnew/class_zone.h
+8
-0
connect.cpp
pcbnew/connect.cpp
+2
-2
gpcb_exchange.cpp
pcbnew/gpcb_exchange.cpp
+4
-4
plotgerb.cpp
pcbnew/plotgerb.cpp
+37
-35
PolyLine.cpp
polygon/PolyLine.cpp
+10
-10
PolyLine.h
polygon/PolyLine.h
+4
-4
math_for_graphics.h
polygon/math_for_graphics.h
+4
-4
No files found.
eeschema/netform.cpp
View file @
3c97a45f
...
...
@@ -862,18 +862,16 @@ static void WriteGENERICListOfNets( FILE* f, ObjetNetListStruct* ObjNet )
NetcodeName
+=
wxT
(
"
\"
"
);
if
(
!
NetName
.
IsEmpty
()
)
{
NetcodeName
+=
NetName
;
if
(
g_TabObjNet
[
jj
].
m_Type
!=
NET_PINLABEL
)
{
// usual net name, add in the sheet path
NetcodeName
=
g_TabObjNet
[
jj
].
m_SheetList
.
PathHumanReadable
()
+
NetcodeName
;
//NetcodeName << wxT("_") <<
// g_TabObjNet[jj].m_SheetList.PathHumanReadable();
// usual net name, prefix it by the sheet path
NetcodeName
+=
g_TabObjNet
[
jj
].
m_SheetList
.
PathHumanReadable
();
}
NetcodeName
+=
NetName
;
}
NetcodeName
+=
wxT
(
"
\"
"
);
// Add the netname without prefix, in cases we need only the "short" netname
NetcodeName
+=
wxT
(
"
\"
"
)
+
NetName
+
wxT
(
"
\"
"
);
LastNetCode
=
NetCode
;
}
...
...
include/macros.h
View file @
3c97a45f
...
...
@@ -11,14 +11,6 @@
#define CONV_FROM_UTF8( utf8string ) (utf8string)
#endif
/* violation of C++ standard, cannot use min() and max(), i.e. in lowercase
#ifndef min
#define min(x, y) ((x) > (y) ? (y) : (x))
#endif
#ifndef max
#define max(x, y) ((x) > (y) ? (x) : (y))
#endif
*/
#ifndef MIN
#define MIN( x, y ) ( (x) > (y) ? (y) : (x) )
...
...
libs.win
View file @
3c97a45f
...
...
@@ -62,7 +62,7 @@ SYSWXLIB = `$(WXWIN)/wx-config --libs gl`\
CC = gcc
.cpp.o:
g
cc
-c -Wall $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) $(EXTRACPPFLAGS) -o $@ $*.cpp
g
++
-c -Wall $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) $(EXTRACPPFLAGS) -o $@ $*.cpp
# Settings for Cyginw/Mingw32
# Some versions of windres cannot cope with the --preprocessor
...
...
pcbnew/class_pad.h
View file @
3c97a45f
...
...
@@ -65,8 +65,8 @@ public:
int
m_physical_connexion
;
// variable used in rastnest computations
// handle block number in track connection
int
m_
zone_connexion
;
// variable used in rastnest computations
protected
:
int
m_
ZoneSubnet
;
// variable used in rastnest computations
// handle block number in zone connection
public
:
...
...
@@ -131,6 +131,12 @@ public:
int
GetNet
()
const
{
return
m_NetCode
;
}
void
SetNet
(
int
aNetCode
)
{
m_NetCode
=
aNetCode
;
}
/**
* Function GetZoneSubNet
* @return int - the sub net code in zone connections.
*/
int
GetZoneSubNet
()
const
{
return
m_ZoneSubnet
;
}
void
SetZoneSubNet
(
int
aSubNetCode
)
{
m_ZoneSubnet
=
aSubNetCode
;
}
/**
* Function Display_Infos
...
...
pcbnew/class_track.cpp
View file @
3c97a45f
...
...
@@ -66,6 +66,7 @@ TRACK::TRACK( BOARD_ITEM* StructFather, KICAD_T idtype ) :
start
=
end
=
NULL
;
SetNet
(
0
);
SetSubNet
(
0
);
SetZoneSubNet
(
0
);
SetDrillDefault
();
m_Param
=
0
;
}
...
...
pcbnew/class_track.h
View file @
3c97a45f
...
...
@@ -36,8 +36,10 @@ public:
protected
:
int
m_NetCode
;
// Net number
int
m_S
ous_Netcode
;
/* In rastnest routines : for the current net,
int
m_S
ubnet
;
/* In rastnest routines : for the current net,
* block number (number common to the current connected items found) */
int
m_ZoneSubnet
;
// variable used in rastnest computations : for the current net,
// handle block number in zone connection
TRACK
(
const
TRACK
&
track
);
// protected so Copy() is used instead.
...
...
@@ -127,9 +129,15 @@ public:
* Function GetSubNet
* @return int - the sub net code.
*/
int
GetSubNet
()
const
{
return
m_S
ous_Netcode
;
}
void
SetSubNet
(
int
aSubNetCode
)
{
m_S
ous_Netcode
=
aSubNetCode
;
}
int
GetSubNet
()
const
{
return
m_S
ubnet
;
}
void
SetSubNet
(
int
aSubNetCode
)
{
m_S
ubnet
=
aSubNetCode
;
}
/**
* Function GetZoneSubNet
* @return int - the sub net code in zone connections.
*/
int
GetZoneSubNet
()
const
{
return
m_ZoneSubnet
;
}
void
SetZoneSubNet
(
int
aSubNetCode
)
{
m_ZoneSubnet
=
aSubNetCode
;
}
/**
* Function GetLength
...
...
pcbnew/class_zone.h
View file @
3c97a45f
...
...
@@ -44,6 +44,7 @@ public:
private
:
int
m_NetCode
;
// Net number for fast comparisons
int
m_ZoneSubnet
;
// variable used in rastnest computations:handle block number in zone connection calculations
public
:
ZONE_CONTAINER
(
BOARD
*
parent
);
...
...
@@ -130,6 +131,13 @@ public:
}
/**
* Function GetZoneSubNet
* @return int - the sub net code in zone connections.
*/
int
GetZoneSubNet
()
const
{
return
m_ZoneSubnet
;
}
void
SetZoneSubNet
(
int
aSubNetCode
)
{
m_ZoneSubnet
=
aSubNetCode
;
}
int
GetNet
(
void
)
const
{
return
m_NetCode
;
...
...
pcbnew/connect.cpp
View file @
3c97a45f
...
...
@@ -30,7 +30,7 @@ static int change_equipot( TRACK* pt_start_conn, TRACK* pt_end_conn,
* Used by propage_equipot()
* Change a subnet value to a new value, for tracks ans pads which are connected to corresponding track
* for pads, this is the .m_physical_connexion member which is tested and modified
* for tracks, this is the .m_S
ous_Netcode
member which is tested and modified
* for tracks, this is the .m_S
ubnet
member which is tested and modified
* these members are block numbers (or cluster numbers) for a given net
* @return modification count
* @param old_val = subnet value to modify
...
...
@@ -93,7 +93,7 @@ static void propage_equipot( TRACK* pt_start_conn, TRACK* pt_end_conn )
* the track list must be sorted by nets, and all segments from pt_start_conn to pt_end_conn have the save net
* When 2 items are connected (a track to a pad, or a track to an other track) they are grouped in a cluster.
* for pads, this is the .m_physical_connexion member which is a cluster identifier
* for tracks, this is the .m_S
ous_Netcode
member which is a cluster identifier
* for tracks, this is the .m_S
ubnet
member which is a cluster identifier
* For a given net, if all tracks are created, there is only one cluster.
* but if not all tracks are created, there are are more than one cluster, and some ratsnets will be shown.
* @param pt_start_conn = first track to test
...
...
pcbnew/gpcb_exchange.cpp
View file @
3c97a45f
/****************************************************/
/*
class_module.cpp : fonctions de la classe MODULE
*/
/****************************************************/
/****************************************************
******************
/
/*
Import functions to import footprints from a gpcb (Newlib) library
*/
/****************************************************
******************
/
#include "fctsys.h"
...
...
@@ -227,7 +227,7 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
// Calculate size: default is 40 mils (400 pcb units)
// real size is: default * ibuf[5] / 100 (size in gpcb is given in percent of defalut size
ibuf
[
5
]
*=
TEXT_DEFAULT_SIZE
;
ibuf
[
5
]
/=
100
;
m_Reference
->
m_Size
.
x
=
m_Reference
->
m_Size
.
y
=
max
(
20
,
ibuf
[
5
]
);
m_Reference
->
m_Size
.
x
=
m_Reference
->
m_Size
.
y
=
MAX
(
20
,
ibuf
[
5
]
);
m_Reference
->
m_Width
=
m_Reference
->
m_Size
.
x
/
10
;
m_Value
->
m_Orient
=
m_Reference
->
m_Orient
;
m_Value
->
m_Size
=
m_Reference
->
m_Size
;
...
...
pcbnew/plotgerb.cpp
View file @
3c97a45f
...
...
@@ -42,8 +42,11 @@ void WinEDA_BasePcbFrame::Genere_GERBER( const wxString& FullFileName, int Layer
bool
PlotOriginIsAuxAxis
)
/********************************************************************************/
/* Genere les divers fichiers de trace:
* Pour chaque couche 1 fichier xxxc.PHO au format RS274X
/* Creates the output files, one per board layer:
* filenames are like xxxc.PHO and use the RS274X format
* Units = inches
* format 3.4, Leading zero omitted, Abs format
* format 3.4 uses the native pcbnew units (1/10000 inch).
*/
{
int
tracevia
=
1
;
...
...
@@ -142,7 +145,8 @@ void WinEDA_BasePcbFrame::Plot_Layer_GERBER( FILE* File, int masque_layer,
int
garde
,
int
tracevia
)
/***********************************************************************/
/* Trace en format GERBER. d'une couche cuivre ou masque
/* Creates one GERBER file for a copper layer or a technical layer
* the silkscreen layers are plotted by Plot_Serigraphie() because they have special features
*/
{
wxPoint
pos
;
...
...
@@ -156,7 +160,7 @@ void WinEDA_BasePcbFrame::Plot_Layer_GERBER( FILE* File, int masque_layer,
// (Following command has been superceded by new command on lines 93 and 94.)
// masque_layer |= EDGE_LAYER; /* Les elements de la couche EDGE sont tj traces */
/*
trace des element
s type Drawings Pcb : */
/*
Draw item
s type Drawings Pcb : */
PtStruct
=
m_Pcb
->
m_Drawings
;
for
(
;
PtStruct
!=
NULL
;
PtStruct
=
PtStruct
->
Pnext
)
{
...
...
@@ -191,7 +195,7 @@ void WinEDA_BasePcbFrame::Plot_Layer_GERBER( FILE* File, int masque_layer,
}
}
/*
Trace des Elements des modules autres que pads
*/
/*
Draw footprints shapes without pads (pads will plotted later)
*/
nb_items
=
0
;
Affiche_1_Parametre
(
this
,
38
,
wxT
(
"DrawMod"
),
wxEmptyString
,
GREEN
);
Module
=
m_Pcb
->
m_Modules
;
...
...
@@ -213,7 +217,7 @@ void WinEDA_BasePcbFrame::Plot_Layer_GERBER( FILE* File, int masque_layer,
}
}
/*
Trace des Elements des modules : Pastille
s */
/*
Plot footprint pad
s */
nb_items
=
0
;
Affiche_1_Parametre
(
this
,
48
,
wxT
(
"Pads"
),
wxEmptyString
,
GREEN
);
Module
=
m_Pcb
->
m_Modules
;
...
...
@@ -271,7 +275,7 @@ void WinEDA_BasePcbFrame::Plot_Layer_GERBER( FILE* File, int masque_layer,
}
}
/*
trace des VIAS
: */
/*
Plot vias
: */
if
(
tracevia
)
{
nb_items
=
0
;
...
...
@@ -304,7 +308,7 @@ void WinEDA_BasePcbFrame::Plot_Layer_GERBER( FILE* File, int masque_layer,
Affiche_1_Parametre
(
this
,
56
,
wxEmptyString
,
msg
,
RED
);
}
}
/*
trace des pistes
: */
/*
Plot tracks (not vias)
: */
nb_items
=
0
;
Affiche_1_Parametre
(
this
,
64
,
wxT
(
"Tracks"
),
wxEmptyString
,
YELLOW
);
...
...
@@ -328,7 +332,7 @@ void WinEDA_BasePcbFrame::Plot_Layer_GERBER( FILE* File, int masque_layer,
Affiche_1_Parametre
(
this
,
64
,
wxEmptyString
,
msg
,
YELLOW
);
}
/*
trace des
zones: */
/*
Plot
zones: */
nb_items
=
0
;
if
(
m_Pcb
->
m_Zone
)
Affiche_1_Parametre
(
this
,
72
,
wxT
(
"Zones "
),
wxEmptyString
,
YELLOW
);
...
...
@@ -452,11 +456,10 @@ void Plot_1_CIRCLE_pad_GERBER( wxPoint pos, int diametre )
void
PlotRectangularPad_GERBER
(
wxPoint
pos
,
wxSize
size
,
int
orient
)
/**************************************************************************/
/*
Trace 1 pad rectangulaire d'orientation quelconque
/*
Plot 1 rectangular pad
* donne par son centre, ses dimensions, et son orientation
* Pour une orientation verticale ou horizontale, la forme est flashee
* Pour une orientation quelconque la forme est tracee par 4 segments
* de largeur 1/2 largeur pad
* For a vertical or horizontal shape, the shape is an aperture (Dcode) and it is flashed
* For others orientations the shape is plotted as a polygon
*/
{
D_CODE
*
dcode_ptr
;
...
...
@@ -487,7 +490,7 @@ void PlotRectangularPad_GERBER( wxPoint pos, wxSize size, int orient )
fputs
(
cbuf
,
dest
);
break
;
default
:
/*
Forme tracee par remplissage
*/
default
:
/*
plot pad shape as polygon
*/
trace_1_pad_TRAPEZE_GERBER
(
pos
,
size
,
wxSize
(
0
,
0
),
orient
,
FILLED
);
break
;
}
...
...
@@ -587,7 +590,7 @@ void trace_1_pad_TRAPEZE_GERBER( wxPoint pos, wxSize size, wxSize delta,
{
int
ii
,
jj
;
int
dx
,
dy
;
wxPoint
polygon
e
[
4
];
/* coord sommet
s */
wxPoint
polygon
[
4
];
/* polygon corner
s */
int
coord
[
8
];
int
ddx
,
ddy
;
...
...
@@ -600,33 +603,33 @@ void trace_1_pad_TRAPEZE_GERBER( wxPoint pos, wxSize size, wxSize delta,
ddx
=
delta
.
x
/
2
;
ddy
=
delta
.
y
/
2
;
polygon
e
[
0
].
x
=
-
dx
-
ddy
;
polygon
e
[
0
].
y
=
+
dy
+
ddx
;
polygon
e
[
1
].
x
=
-
dx
+
ddy
;
polygon
e
[
1
].
y
=
-
dy
-
ddx
;
polygon
e
[
2
].
x
=
+
dx
-
ddy
;
polygon
e
[
2
].
y
=
-
dy
+
ddx
;
polygon
e
[
3
].
x
=
+
dx
+
ddy
;
polygon
e
[
3
].
y
=
+
dy
-
ddx
;
polygon
[
0
].
x
=
-
dx
-
ddy
;
polygon
[
0
].
y
=
+
dy
+
ddx
;
polygon
[
1
].
x
=
-
dx
+
ddy
;
polygon
[
1
].
y
=
-
dy
-
ddx
;
polygon
[
2
].
x
=
+
dx
-
ddy
;
polygon
[
2
].
y
=
-
dy
+
ddx
;
polygon
[
3
].
x
=
+
dx
+
ddy
;
polygon
[
3
].
y
=
+
dy
-
ddx
;
/* Dessin du polygone et Remplissage eventuel de l'interieur */
for
(
ii
=
0
,
jj
=
0
;
ii
<
4
;
ii
++
)
{
RotatePoint
(
&
polygon
e
[
ii
].
x
,
&
polygone
[
ii
].
y
,
orient
);
coord
[
jj
]
=
polygon
e
[
ii
].
x
+=
pos
.
x
;
RotatePoint
(
&
polygon
[
ii
].
x
,
&
polygon
[
ii
].
y
,
orient
);
coord
[
jj
]
=
polygon
[
ii
].
x
+=
pos
.
x
;
jj
++
;
coord
[
jj
]
=
polygon
e
[
ii
].
y
+=
pos
.
y
;
coord
[
jj
]
=
polygon
[
ii
].
y
+=
pos
.
y
;
jj
++
;
}
if
(
modetrace
!=
FILLED
)
{
int
plotLine_width
=
(
int
)
(
10
*
g_PlotLine_Width
*
Gerb_scale_plot
);
PlotGERBERLine
(
polygon
e
[
0
],
polygone
[
1
],
plotLine_width
);
PlotGERBERLine
(
polygon
e
[
1
],
polygone
[
2
],
plotLine_width
);
PlotGERBERLine
(
polygon
e
[
2
],
polygone
[
3
],
plotLine_width
);
PlotGERBERLine
(
polygon
e
[
3
],
polygone
[
0
],
plotLine_width
);
PlotGERBERLine
(
polygon
[
0
],
polygon
[
1
],
plotLine_width
);
PlotGERBERLine
(
polygon
[
1
],
polygon
[
2
],
plotLine_width
);
PlotGERBERLine
(
polygon
[
2
],
polygon
[
3
],
plotLine_width
);
PlotGERBERLine
(
polygon
[
3
],
polygon
[
0
],
plotLine_width
);
}
else
PlotPolygon_GERBER
(
4
,
coord
,
TRUE
);
...
...
@@ -664,7 +667,7 @@ void PlotGERBERLine( wxPoint start, wxPoint end, int width )
void
PlotCircle_GERBER
(
wxPoint
centre
,
int
rayon
,
int
epaisseur
)
/********************************************************************/
/*
routine de trace de 1 cercle de centre centre par approximation de segment
s
/*
Plot one cercle as segments (6 to 16 depending on its radiu
s
*/
{
int
ii
;
...
...
@@ -702,7 +705,7 @@ void PlotPolygon_GERBER( int nb_segm, int* coord, bool fill )
/***************************************************************/
{
int
ii
;
wxPoint
pos
;
wxPoint
pos
,
startpos
;
fputs
(
"G36*
\n
"
,
dest
);
pos
.
x
=
*
coord
;
...
...
@@ -710,6 +713,7 @@ void PlotPolygon_GERBER( int nb_segm, int* coord, bool fill )
pos
.
y
=
*
coord
;
coord
++
;
UserToDeviceCoordinate
(
pos
);
startpos
=
pos
;
fprintf
(
dest
,
"X%5.5dY%5.5dD02*
\n
"
,
pos
.
x
,
pos
.
y
);
for
(
ii
=
1
;
ii
<
nb_segm
;
ii
++
)
{
...
...
@@ -721,6 +725,7 @@ void PlotPolygon_GERBER( int nb_segm, int* coord, bool fill )
fprintf
(
dest
,
"X%5.5dY%5.5dD01*
\n
"
,
pos
.
x
,
pos
.
y
);
}
fprintf
(
dest
,
"X%5.5dY%5.5dD01*
\n
"
,
startpos
.
x
,
startpos
.
y
);
fputs
(
"G37*
\n
"
,
dest
);
}
...
...
@@ -915,9 +920,6 @@ int WinEDA_BasePcbFrame::Gen_D_CODE_File( FILE* penfile )
break
;
}
// compensation localisation printf (float x.y gnr x,y)
to_point
(
text
+
2
);
fputs
(
cbuf
,
penfile
);
ptr_tool
=
ptr_tool
->
m_Pnext
;
nb_dcodes
++
;
...
...
polygon/PolyLine.cpp
View file @
3c97a45f
...
...
@@ -344,7 +344,7 @@ int CPolyLine::MakeKboolPoly( int aStart_contour, int aEnd_contour, std::vector<
// style is ARC_CW or ARC_CCW
int
n
;
// number of steps for arcs
n
=
(
abs
(
x2
-
x1
)
+
abs
(
y2
-
y1
)
)
/
(
CArc
::
MAX_STEP
);
n
=
max
(
n
,
CArc
::
MIN_STEPS
);
// or at most 5 degrees of arc
n
=
MAX
(
n
,
CArc
::
MIN_STEPS
);
// or at most 5 degrees of arc
n_vertices
+=
n
;
n_arcs
++
;
}
...
...
@@ -378,7 +378,7 @@ int CPolyLine::MakeKboolPoly( int aStart_contour, int aEnd_contour, std::vector<
// style is arc_cw or arc_ccw
int
n
;
// number of steps for arcs
n
=
(
abs
(
x2
-
x1
)
+
abs
(
y2
-
y1
)
)
/
(
CArc
::
MAX_STEP
);
n
=
max
(
n
,
CArc
::
MIN_STEPS
);
// or at most 5 degrees of arc
n
=
MAX
(
n
,
CArc
::
MIN_STEPS
);
// or at most 5 degrees of arc
double
xo
,
yo
,
theta1
,
theta2
,
a
,
b
;
a
=
fabs
(
(
double
)
(
x1
-
x2
)
);
b
=
fabs
(
(
double
)
(
y1
-
y2
)
);
...
...
@@ -966,10 +966,10 @@ CRect CPolyLine::GetCornerBounds()
r
.
right
=
r
.
top
=
INT_MIN
;
for
(
unsigned
i
=
0
;
i
<
corner
.
size
();
i
++
)
{
r
.
left
=
min
(
r
.
left
,
corner
[
i
].
x
);
r
.
right
=
max
(
r
.
right
,
corner
[
i
].
x
);
r
.
bottom
=
min
(
r
.
bottom
,
corner
[
i
].
y
);
r
.
top
=
max
(
r
.
top
,
corner
[
i
].
y
);
r
.
left
=
MIN
(
r
.
left
,
corner
[
i
].
x
);
r
.
right
=
MAX
(
r
.
right
,
corner
[
i
].
x
);
r
.
bottom
=
MIN
(
r
.
bottom
,
corner
[
i
].
y
);
r
.
top
=
MAX
(
r
.
top
,
corner
[
i
].
y
);
}
return
r
;
...
...
@@ -986,10 +986,10 @@ CRect CPolyLine::GetCornerBounds( int icont )
int
iend
=
GetContourEnd
(
icont
);
for
(
int
i
=
istart
;
i
<=
iend
;
i
++
)
{
r
.
left
=
min
(
r
.
left
,
corner
[
i
].
x
);
r
.
right
=
max
(
r
.
right
,
corner
[
i
].
x
);
r
.
bottom
=
min
(
r
.
bottom
,
corner
[
i
].
y
);
r
.
top
=
max
(
r
.
top
,
corner
[
i
].
y
);
r
.
left
=
MIN
(
r
.
left
,
corner
[
i
].
x
);
r
.
right
=
MAX
(
r
.
right
,
corner
[
i
].
x
);
r
.
bottom
=
MIN
(
r
.
bottom
,
corner
[
i
].
y
);
r
.
top
=
MAX
(
r
.
top
,
corner
[
i
].
y
);
}
return
r
;
...
...
polygon/PolyLine.h
View file @
3c97a45f
...
...
@@ -46,11 +46,11 @@ void ArmBoolEng( Bool_Engine* aBooleng, bool aConvertHoles = false );
#define NM_PER_MIL 10 // 25400
#define to_int( x ) (int) round( (x) )
#ifndef
min
#define
min
( x1, x2 ) ( (x1) > (x2) ? (x2) : (x1) )
#ifndef
MIN
#define
MIN
( x1, x2 ) ( (x1) > (x2) ? (x2) : (x1) )
#endif
#ifndef
max
#define
max
( x1, x2 ) ( (x1) > (x2) ? (x1) : (x2) )
#ifndef
MAX
#define
MAX
( x1, x2 ) ( (x1) > (x2) ? (x1) : (x2) )
#endif
class
CRect
...
...
polygon/math_for_graphics.h
View file @
3c97a45f
...
...
@@ -38,10 +38,10 @@ public:
my_rect
(){};
my_rect
(
int
xi
,
int
yi
,
int
xf
,
int
yf
)
{
xlo
=
min
(
xi
,
xf
);
xhi
=
max
(
xi
,
xf
);
ylo
=
min
(
yi
,
yf
);
yhi
=
max
(
yi
,
yf
);
xlo
=
MIN
(
xi
,
xf
);
xhi
=
MAX
(
xi
,
xf
);
ylo
=
MIN
(
yi
,
yf
);
yhi
=
MAX
(
yi
,
yf
);
};
int
xlo
,
ylo
,
xhi
,
yhi
;
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment