Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dmitri Naumov
ogs
Commits
1a02eeca
Commit
1a02eeca
authored
12 years ago
by
Tom Fischer
Browse files
Options
Downloads
Patches
Plain Diff
moved declaration and implementation of operator<= to namespace GeoLib
parent
994ff3c4
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GeoLib/Point.cpp
+19
-20
19 additions, 20 deletions
GeoLib/Point.cpp
GeoLib/Point.h
+2
-2
2 additions, 2 deletions
GeoLib/Point.h
with
21 additions
and
22 deletions
GeoLib/Point.cpp
+
19
−
20
View file @
1a02eeca
...
...
@@ -16,26 +16,6 @@
#include
"Point.h"
bool
operator
<=
(
const
GeoLib
::
Point
&
p0
,
const
GeoLib
::
Point
&
p1
)
{
double
tol
(
sqrt
(
std
::
numeric_limits
<
double
>::
min
()));
if
(
fabs
(
p0
[
0
]
-
p1
[
0
])
>
tol
*
fabs
(
p0
[
0
]))
{
if
(
p0
[
0
]
<
p1
[
0
])
return
true
;
else
return
false
;
}
else
{
// assume p0[0] == p1[0]
if
(
fabs
(
p0
[
1
]
-
p1
[
1
])
>
tol
*
fabs
(
p0
[
1
]))
{
if
(
p0
[
1
]
<
p1
[
1
])
return
true
;
else
return
false
;
}
else
{
// assume p0[1] == p1[1] and p0[0] == p1[0]
if
(
p0
[
2
]
<
p1
[
2
])
return
true
;
else
return
false
;
}
}
}
namespace
GeoLib
{
bool
lessX
(
GeoLib
::
Point
const
&
p0
,
GeoLib
::
Point
const
&
p1
)
...
...
@@ -56,5 +36,24 @@ bool lessZ (GeoLib::Point const & p0, GeoLib::Point const & p1)
return
false
;
}
bool
operator
<=
(
const
GeoLib
::
Point
&
p0
,
const
GeoLib
::
Point
&
p1
)
{
double
tol
(
sqrt
(
std
::
numeric_limits
<
double
>::
min
()));
if
(
fabs
(
p0
[
0
]
-
p1
[
0
])
>
tol
*
fabs
(
p0
[
0
]))
{
if
(
p0
[
0
]
<
p1
[
0
])
return
true
;
else
return
false
;
}
else
{
// assume p0[0] == p1[0]
if
(
fabs
(
p0
[
1
]
-
p1
[
1
])
>
tol
*
fabs
(
p0
[
1
]))
{
if
(
p0
[
1
]
<
p1
[
1
])
return
true
;
else
return
false
;
}
else
{
// assume p0[1] == p1[1] and p0[0] == p1[0]
if
(
p0
[
2
]
<
p1
[
2
])
return
true
;
else
return
false
;
}
}
}
}
// end namespace GeoLib
This diff is collapsed.
Click to expand it.
GeoLib/Point.h
+
2
−
2
View file @
1a02eeca
...
...
@@ -47,11 +47,11 @@ bool lessY (Point const & p0, Point const & p1);
*/
bool
lessZ
(
Point
const
&
p0
,
Point
const
&
p1
);
}
/**
* lexicographic comparison of points
*/
bool
operator
<=
(
GeoLib
::
Point
const
&
p0
,
GeoLib
::
Point
const
&
p1
);
}
#endif
/* POINT_H_ */
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment