summaryrefslogtreecommitdiffstats
path: root/Polygon.cpp
diff options
context:
space:
mode:
authorneoraider <devnull@localhost>2007-09-27 10:27:04 +0200
committerneoraider <devnull@localhost>2007-09-27 10:27:04 +0200
commit50b65f72c02382d826802fa7c76ebc7bf53611fc (patch)
treea6a6149e609bc1c5cc49700f66f77e6c408ca808 /Polygon.cpp
parent1e9704dca9a861ffb7b2d3978e1390bea7af7ef0 (diff)
downloadzoomedit-50b65f72c02382d826802fa7c76ebc7bf53611fc.tar
zoomedit-50b65f72c02382d826802fa7c76ebc7bf53611fc.zip
Einige Warnungen mit -Wall gefixt
Diffstat (limited to 'Polygon.cpp')
-rw-r--r--Polygon.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/Polygon.cpp b/Polygon.cpp
index eb63a61..7eaeaa9 100644
--- a/Polygon.cpp
+++ b/Polygon.cpp
@@ -24,7 +24,7 @@ Polygon::Direction Polygon::getDirection() const {
}
float Polygon::area() const {
- return fabs(signedArea());
+ return fabsf(signedArea());
}
float Polygon::perimeter() const {
@@ -135,9 +135,9 @@ bool Polygon::isConcave(const Direction &dir, const Vertex &v1, const Vertex &v2
return (v1.getX()-v2.getX())*(v3.getY()-v2.getY()) > (v3.getX()-v2.getX())*(v1.getY()-v2.getY());
case Triangle::CCW:
return (v1.getX()-v2.getX())*(v3.getY()-v2.getY()) < (v3.getX()-v2.getX())*(v1.getY()-v2.getY());
+ default:
+ return false;
}
-
- return false;
}
bool Polygon::intersections(std::vector<Intersection> *intersections) const {
@@ -180,10 +180,10 @@ bool Polygon::simplify(std::list<Polygon> &polygons) const {
if(!intersections(&ins)) return false;
- int s = size();
- int start = 0;
+ size_t s = size();
+ size_t start = 0;
- for(int i = 1; i < s; i++) {
+ for(size_t i = 1; i < s; i++) {
if(at(i).getX() < at(start).getX())
start = i;
else if(at(i).getX() == at(start).getX() && at(i).getY() < at(start).getY())
@@ -192,7 +192,7 @@ bool Polygon::simplify(std::list<Polygon> &polygons) const {
int dir = Triangle(at((s+start-1)%s), at(start), at((start+1)%s)).getDirection();
- int i2 = start;
+ size_t i2 = start;
const Vertex *v2 = &at(i2);
bool intersected;
@@ -201,7 +201,7 @@ bool Polygon::simplify(std::list<Polygon> &polygons) const {
do {
intersected = false;
- int i = i2;
+ size_t i = i2;
if(dir == Triangle::CW)
i2 = (i2+1)%s;
@@ -216,7 +216,7 @@ bool Polygon::simplify(std::list<Polygon> &polygons) const {
Intersection *intr = NULL;
Vertex *v = NULL;
float dv = 0;
- int v3, v4;
+ size_t v3 = 0, v4 = 0;
for(std::vector<Intersection>::iterator in = ins.begin(); in != ins.end(); ++in) {
float di = v2->distanceSq(in->v);
@@ -276,7 +276,7 @@ bool Polygon::simplify(std::list<Polygon> &polygons) const {
polygons.back().push_back(polygons.front().back());
polygons.front().pop_back();
- if(v->distanceSq(polygons.back().back()) < 1E-6)
+ if(v->distanceSq(polygons.back().back()) < 1E-12)
break;
}
}