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
5a51d11b
Commit
5a51d11b
authored
May 14, 2014
by
Tomasz Włostowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
geometry: get rid of useless vertex references in SEG class
parent
5bf50ee9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
48 deletions
+12
-48
seg.h
include/geometry/seg.h
+11
-47
shape_line_chain.h
include/geometry/shape_line_chain.h
+1
-1
No files found.
include/geometry/seg.h
View file @
5a51d11b
...
...
@@ -46,17 +46,14 @@ public:
* to an object the segment belongs to (e.g. a line chain) or references to locally stored
* points (m_a, m_b).
*/
VECTOR2I
&
A
;
VECTOR2I
&
B
;
VECTOR2I
A
;
VECTOR2I
B
;
/** Default constructor
* Creates an empty (0, 0) segment, locally-referenced
*/
SEG
()
:
A
(
m_a
),
B
(
m_b
)
SEG
()
{
A
=
m_a
;
B
=
m_b
;
m_is_local
=
true
;
m_index
=
-
1
;
}
...
...
@@ -64,13 +61,10 @@ public:
* Constructor
* Creates a segment between (aX1, aY1) and (aX2, aY2), locally referenced
*/
SEG
(
int
aX1
,
int
aY1
,
int
aX2
,
int
aY2
)
:
A
(
m_a
),
B
(
m_b
)
SEG
(
int
aX1
,
int
aY1
,
int
aX2
,
int
aY2
)
:
A
(
VECTOR2I
(
aX1
,
aY1
)
),
B
(
VECTOR2I
(
aX2
,
aY2
)
)
{
m_a
=
VECTOR2I
(
aX1
,
aY1
);
m_b
=
VECTOR2I
(
aX2
,
aY2
);
A
=
m_a
;
B
=
m_b
;
m_is_local
=
true
;
m_index
=
-
1
;
}
...
...
@@ -78,11 +72,8 @@ public:
* Constructor
* Creates a segment between (aA) and (aB), locally referenced
*/
SEG
(
const
VECTOR2I
&
aA
,
const
VECTOR2I
&
aB
)
:
A
(
m_a
),
B
(
m_b
),
m_a
(
aA
),
m_b
(
aB
)
SEG
(
const
VECTOR2I
&
aA
,
const
VECTOR2I
&
aB
)
:
A
(
aA
),
B
(
aB
)
{
A
=
m_a
;
B
=
m_b
;
m_is_local
=
true
;
m_index
=
-
1
;
}
...
...
@@ -93,44 +84,24 @@ public:
* @param aB reference to the end point in the parent shape
* @param aIndex index of the segment within the parent shape
*/
SEG
(
VECTOR2I
&
aA
,
VECTOR2I
&
aB
,
int
aIndex
)
:
A
(
aA
),
B
(
aB
)
SEG
(
const
VECTOR2I
&
aA
,
const
VECTOR2I
&
aB
,
int
aIndex
)
:
A
(
aA
),
B
(
aB
)
{
m_is_local
=
false
;
m_index
=
aIndex
;
}
/**
* Copy constructor
*/
SEG
(
const
SEG
&
aSeg
)
:
A
(
m_a
),
B
(
m_b
)
SEG
(
const
SEG
&
aSeg
)
:
A
(
aSeg
.
A
),
B
(
aSeg
.
B
),
m_index
(
aSeg
.
m_index
)
{
if
(
aSeg
.
m_is_local
)
{
m_a
=
aSeg
.
m_a
;
m_b
=
aSeg
.
m_b
;
A
=
m_a
;
B
=
m_b
;
m_is_local
=
true
;
m_index
=
-
1
;
}
else
{
A
=
aSeg
.
A
;
B
=
aSeg
.
B
;
m_index
=
aSeg
.
m_index
;
m_is_local
=
false
;
}
}
SEG
&
operator
=
(
const
SEG
&
aSeg
)
{
A
=
aSeg
.
A
;
B
=
aSeg
.
B
;
m_a
=
aSeg
.
m_a
;
m_b
=
aSeg
.
m_b
;
m_index
=
aSeg
.
m_index
;
m_is_local
=
aSeg
.
m_is_local
;
return
*
this
;
}
...
...
@@ -289,14 +260,8 @@ public:
private
:
bool
ccw
(
const
VECTOR2I
&
aA
,
const
VECTOR2I
&
aB
,
const
VECTOR2I
&
aC
)
const
;
///> locally stored start/end coordinates (used when m_is_local == true)
VECTOR2I
m_a
,
m_b
;
///> index withing the parent shape (used when m_is_local == false)
int
m_index
;
///> locality flag
bool
m_is_local
;
};
...
...
@@ -344,8 +309,7 @@ inline const VECTOR2I SEG::NearestPoint( const VECTOR2I& aP ) const
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
aStream
,
const
SEG
&
aSeg
)
{
if
(
aSeg
.
m_is_local
)
aStream
<<
"[ local "
<<
aSeg
.
A
<<
" - "
<<
aSeg
.
B
<<
" ]"
;
aStream
<<
"[ "
<<
aSeg
.
A
<<
" - "
<<
aSeg
.
B
<<
" ]"
;
return
aStream
;
}
...
...
include/geometry/shape_line_chain.h
View file @
5a51d11b
...
...
@@ -445,7 +445,7 @@ public:
struct
compareOriginDistance
{
compareOriginDistance
(
VECTOR2I
&
aOrigin
)
:
compareOriginDistance
(
const
VECTOR2I
&
aOrigin
)
:
m_origin
(
aOrigin
)
{}
...
...
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