xsi/algorithm.xsi

filter: Statementstmt 93.3% 98 / 105 Branchbran 51.5% 135 / 262 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 63.4% 233 / 367 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« xsi/Geometry.xsi ↑ Summary xsi/LineSegment.xsi »
1 MODULE = Geo::Geos PACKAGE = Geo::Geos::Algorithm
2 PROTOTYPES: DISABLE
3  
4 8 ▶double toDegrees (double radians) { RETVAL = Angle::toDegrees(radians); }
Branch: 1 branch
BranchTrueFalseTotal
double toDegrees (double radians) { RETVAL = Angle::toDegrees(radians); } 0 8 8
5  
6 1 ▶double toRadians (double angleDegrees) { RETVAL = Angle::toRadians(angleDegrees); }
Branch: 1 branch
BranchTrueFalseTotal
double toRadians (double angleDegrees) { RETVAL = Angle::toRadians(angleDegrees); } 0 1 1
7  
8 1 ▶double angle (Coordinate& p0) { RETVAL = Angle::angle(p0); }
Branch: 1 branch
BranchTrueFalseTotal
double angle (Coordinate& p0) { RETVAL = Angle::angle(p0); } 0 1 1
9  
10 bool isAcute (Coordinate* p0, Coordinate* p1, Coordinate *p2) {
11 1 ▶ RETVAL = Angle::isAcute(*p0, *p1, *p2);
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = Angle::isAcute(*p0, *p1, *p2); 1 0 1
12 }
13  
14 bool isObtuse (Coordinate& p0, Coordinate& p1, Coordinate& p2) {
15 1 ▶ RETVAL = Angle::isObtuse(p0, p1, p2);
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = Angle::isObtuse(p0, p1, p2); 0 1 1
16 }
17  
18 double angleBetween (Coordinate& tip1, Coordinate& tail, Coordinate& tip2) {
19 1 ▶ RETVAL = Angle::angleBetween(tip1, tail, tip2);
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = Angle::angleBetween(tip1, tail, tip2); 0 1 1
20 }
21  
22 double angleBetweenOriented (Coordinate& tip1, Coordinate& tail, Coordinate& tip2) {
23 1 ▶ RETVAL = Angle::angleBetweenOriented (tip1, tail, tip2);
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = Angle::angleBetweenOriented (tip1, tail, tip2); 0 1 1
24 }
25  
26 double interiorAngle(Coordinate& p0, Coordinate& p1, Coordinate& p2) {
27 1 ▶ RETVAL = Angle::interiorAngle(p0, p1, p2);
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = Angle::interiorAngle(p0, p1, p2); 0 1 1
28 }
29  
30 1 ▶int getTurn (double ang1, double ang2) { RETVAL = Angle::getTurn(ang1, ang2); }
Branch: 1 branch
BranchTrueFalseTotal
int getTurn (double ang1, double ang2) { RETVAL = Angle::getTurn(ang1, ang2); } 0 1 1
31  
32 1 ▶double normalize (double angle) { RETVAL = Angle::normalize(angle); }
Branch: 1 branch
BranchTrueFalseTotal
double normalize (double angle) { RETVAL = Angle::normalize(angle); } 0 1 1
33  
34 1 ▶double normalizePositive (double angle) { RETVAL = Angle::normalizePositive(angle); }
Branch: 1 branch
BranchTrueFalseTotal
double normalizePositive (double angle) { RETVAL = Angle::normalizePositive(angle); } 0 1 1
35  
36 1 ▶double diff (double ang1, double ang2) { RETVAL = Angle::diff(ang1, ang2); }
Branch: 1 branch
BranchTrueFalseTotal
double diff (double ang1, double ang2) { RETVAL = Angle::diff(ang1, ang2); } 0 1 1
37  
38 Coordinate* centroid (Geometry& g) {
39 2 Coordinate c;
40 2 ▶ if (Centroid::getCentroid(g, c)) RETVAL = new Coordinate(c);
Branch: 1 branch
BranchTrueFalseTotal
if (Centroid::getCentroid(g, c)) RETVAL = new Coordinate(c); 2 0 2
41 2 ▶ else XSRETURN_UNDEF;
Branch: 3 branches
BranchTrueFalseTotal
else XSRETURN_UNDEF; 2 0 2
else XSRETURN_UNDEF; 1 1 2
else XSRETURN_UNDEF; 1 0 1
42 1 }
43  
44 Coordinate* centroidArea (Array geoms) {
45 3 Coordinate result;
46 3 ▶ CentroidArea acc;
Branch: 1 branch
BranchTrueFalseTotal
CentroidArea acc; 3 0 3
47 3 ▶ for(size_t i = 0; i < geoms.size(); ++i) {
Branch: 1 branch
BranchTrueFalseTotal
for(size_t i = 0; i < geoms.size(); ++i) { 3 0 3
48 5 ▶ auto item = geoms.at(i);
Branch: 2 branches
BranchTrueFalseTotal
auto item = geoms.at(i); 5 0 5
auto item = geoms.at(i); 2 3 5
49 2 ▶ if (item.is_array_ref()) {
Branch: 1 branch
BranchTrueFalseTotal
if (item.is_array_ref()) { 2 0 2
50 2 ▶ auto seq = Helper::convert_coords(Array(item));
Branch: 2 branches
BranchTrueFalseTotal
auto seq = Helper::convert_coords(Array(item)); 2 0 2
auto seq = Helper::convert_coords(Array(item)); 1 1 2
51 1 ▶ acc.add(&seq);
Branch: 2 branches
BranchTrueFalseTotal
acc.add(&seq); 1 0 1
acc.add(&seq); 1 0 1
52 1 ▶ }
Branch: 1 branch
BranchTrueFalseTotal
} 1 0 1
53 1 else {
54 acc.add(&xs::in<Geometry&>(item));
55 1 ▶ }
Branch: 2 branches
BranchTrueFalseTotal
} 1 0 1
} 1 0 1
56 }
57 2 if (acc.getCentroid(result)) RETVAL = new Coordinate(result);
58 3 ▶ else XSRETURN_UNDEF;
Branch: 3 branches
BranchTrueFalseTotal
else XSRETURN_UNDEF; 3 0 3
else XSRETURN_UNDEF; 2 1 3
else XSRETURN_UNDEF; 2 0 2
59 1 }
60  
61  
62 Coordinate* centroidLine (Array geoms) {
63 2 Coordinate result;
64 2 ▶ CentroidLine acc;
Branch: 1 branch
BranchTrueFalseTotal
CentroidLine acc; 2 0 2
65 2 ▶ for(size_t i = 0; i < geoms.size(); ++i) {
Branch: 1 branch
BranchTrueFalseTotal
for(size_t i = 0; i < geoms.size(); ++i) { 2 0 2
66 3 ▶ auto item = geoms.at(i);
Branch: 2 branches
BranchTrueFalseTotal
auto item = geoms.at(i); 3 0 3
auto item = geoms.at(i); 1 2 3
67 1 ▶ if (item.is_array_ref()) {
Branch: 1 branch
BranchTrueFalseTotal
if (item.is_array_ref()) { 1 0 1
68 1 ▶ auto seq = Helper::convert_coords(Array(item));
Branch: 2 branches
BranchTrueFalseTotal
auto seq = Helper::convert_coords(Array(item)); 1 0 1
auto seq = Helper::convert_coords(Array(item)); 0 1 1
69 0 ▶ acc.add(&seq);
Branch: 2 branches
BranchTrueFalseTotal
acc.add(&seq); 0 0 0
acc.add(&seq); 0 0 0
70 0 ▶ }
Branch: 1 branch
BranchTrueFalseTotal
} 0 0 0
71 0 else {
72 acc.add(&xs::in<Geometry&>(item));
73 1 ▶ }
Branch: 2 branches
BranchTrueFalseTotal
} 1 0 1
} 1 0 1
74 }
75 1 if (acc.getCentroid(result)) RETVAL = new Coordinate(result);
76 2 ▶ else XSRETURN_UNDEF;
Branch: 3 branches
BranchTrueFalseTotal
else XSRETURN_UNDEF; 2 0 2
else XSRETURN_UNDEF; 1 1 2
else XSRETURN_UNDEF; 1 0 1
77 1 }
78  
79 Coordinate* centroidPoint (Array geoms) {
80 3 Coordinate result;
81 3 ▶ CentroidPoint acc;
Branch: 1 branch
BranchTrueFalseTotal
CentroidPoint acc; 3 0 3
82 3 ▶ for(size_t i = 0; i < geoms.size(); ++i) {
Branch: 1 branch
BranchTrueFalseTotal
for(size_t i = 0; i < geoms.size(); ++i) { 3 0 3
83 6 ▶ Object item = Object(geoms.at(i));
Branch: 2 branches
BranchTrueFalseTotal
Object item = Object(geoms.at(i)); 6 0 6
Object item = Object(geoms.at(i)); 4 2 6
84 4 ▶ if (!item) throw ("invalid argument");
Branch: 2 branches
BranchTrueFalseTotal
if (!item) throw ("invalid argument"); 4 0 4
if (!item) throw ("invalid argument"); 4 0 4
85 4 ▶ if (item.stash().name() == "Geo::Geos::Coordinate") {
Branch: 1 branch
BranchTrueFalseTotal
if (item.stash().name() == "Geo::Geos::Coordinate") { 1 3 4
86 3 ▶ acc.add(&xs::in<Coordinate&>(item));
Branch: 4 branches
BranchTrueFalseTotal
acc.add(&xs::in<Coordinate&>(item)); 3 0 3
acc.add(&xs::in<Coordinate&>(item)); 3 0 3
acc.add(&xs::in<Coordinate&>(item)); 3 0 3
acc.add(&xs::in<Coordinate&>(item)); 0 3 3
87 0 ▶ }
Branch: 2 branches
BranchTrueFalseTotal
} 0 0 0
} 0 0 0
88 else acc.add(&xs::in<Geometry&>(item));
89 3 ▶ }
Branch: 2 branches
BranchTrueFalseTotal
} 3 0 3
} 3 0 3
90 4 if (acc.getCentroid(result)) RETVAL = new Coordinate(result);
91 2 ▶ else XSRETURN_UNDEF;
Branch: 3 branches
BranchTrueFalseTotal
else XSRETURN_UNDEF; 2 0 2
else XSRETURN_UNDEF; 1 1 2
else XSRETURN_UNDEF; 1 0 1
92 1 }
93  
94 bool isPointInRing(Coordinate& p, Array ring) {
95 1 ▶ auto seq = Helper::convert_coords(ring);
Branch: 2 branches
BranchTrueFalseTotal
auto seq = Helper::convert_coords(ring); 1 0 1
auto seq = Helper::convert_coords(ring); 1 0 1
96 1 ▶ RETVAL = CGAlgorithms::isPointInRing(p, &seq);
Branch: 2 branches
BranchTrueFalseTotal
RETVAL = CGAlgorithms::isPointInRing(p, &seq); 1 0 1
RETVAL = CGAlgorithms::isPointInRing(p, &seq); 1 0 1
97 }
98  
99 int locatePointInRing(Coordinate& p,Array ring) {
100 1 ▶ auto seq = Helper::convert_coords(ring);
Branch: 2 branches
BranchTrueFalseTotal
auto seq = Helper::convert_coords(ring); 1 0 1
auto seq = Helper::convert_coords(ring); 1 0 1
101 1 ▶ RETVAL = CGAlgorithms::locatePointInRing(p, seq);
Branch: 2 branches
BranchTrueFalseTotal
RETVAL = CGAlgorithms::locatePointInRing(p, seq); 1 0 1
RETVAL = CGAlgorithms::locatePointInRing(p, seq); 0 1 1
102 }
103  
104 bool isOnLine(Coordinate& p, Array line) {
105 1 ▶ auto seq = Helper::convert_coords(line);
Branch: 2 branches
BranchTrueFalseTotal
auto seq = Helper::convert_coords(line); 1 0 1
auto seq = Helper::convert_coords(line); 1 0 1
106 1 ▶ RETVAL = CGAlgorithms::isPointInRing(p, &seq);
Branch: 2 branches
BranchTrueFalseTotal
RETVAL = CGAlgorithms::isPointInRing(p, &seq); 1 0 1
RETVAL = CGAlgorithms::isPointInRing(p, &seq); 0 1 1
107 }
108  
109 bool isCCW(Array ring) {
110 1 ▶ auto seq = Helper::convert_coords(ring);
Branch: 2 branches
BranchTrueFalseTotal
auto seq = Helper::convert_coords(ring); 1 0 1
auto seq = Helper::convert_coords(ring); 1 0 1
111 1 ▶ RETVAL = CGAlgorithms::isCCW(&seq);
Branch: 2 branches
BranchTrueFalseTotal
RETVAL = CGAlgorithms::isCCW(&seq); 1 0 1
RETVAL = CGAlgorithms::isCCW(&seq); 0 1 1
112 }
113  
114 int computeOrientation(Coordinate& p1, Coordinate& p2, Coordinate& q){
115 1 ▶ RETVAL = CGAlgorithms::computeOrientation(p1, p2, q);
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = CGAlgorithms::computeOrientation(p1, p2, q); 0 1 1
116 }
117  
118 double distancePointLine(Coordinate& p, Coordinate& A, Coordinate& B) {
119 1 ▶ RETVAL = CGAlgorithms::distancePointLine(p, A, B);
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = CGAlgorithms::distancePointLine(p, A, B); 0 1 1
120 }
121  
122 double distancePointLinePerpendicular(Coordinate& p, Coordinate& A, Coordinate& B) {
123 1 ▶ RETVAL = CGAlgorithms::distancePointLinePerpendicular(p, A, B);
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = CGAlgorithms::distancePointLinePerpendicular(p, A, B); 0 1 1
124 }
125  
126 double distanceLineLine (Coordinate& A, Coordinate& B, Coordinate& C, Coordinate& D) {
127 1 ▶ RETVAL = CGAlgorithms::distanceLineLine(A, B, C, D);
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = CGAlgorithms::distanceLineLine(A, B, C, D); 0 1 1
128 }
129  
130 double signedArea (Array ring) {
131 1 ▶ auto seq = Helper::convert_coords(ring);
Branch: 2 branches
BranchTrueFalseTotal
auto seq = Helper::convert_coords(ring); 1 0 1
auto seq = Helper::convert_coords(ring); 1 0 1
132 1 ▶ RETVAL = CGAlgorithms::signedArea(&seq);
Branch: 2 branches
BranchTrueFalseTotal
RETVAL = CGAlgorithms::signedArea(&seq); 1 0 1
RETVAL = CGAlgorithms::signedArea(&seq); 0 1 1
133 }
134  
135 double length(Array pts) {
136 1 ▶ auto seq = Helper::convert_coords(pts);
Branch: 2 branches
BranchTrueFalseTotal
auto seq = Helper::convert_coords(pts); 1 0 1
auto seq = Helper::convert_coords(pts); 1 0 1
137 1 ▶ RETVAL = CGAlgorithms::length(&seq);
Branch: 2 branches
BranchTrueFalseTotal
RETVAL = CGAlgorithms::length(&seq); 1 0 1
RETVAL = CGAlgorithms::length(&seq); 0 1 1
138 }
139  
140 int orientationIndex(Coordinate& p1, Coordinate& p2, Coordinate& q) {
141 1 ▶ RETVAL = CGAlgorithms::computeOrientation(p1, p2, q);
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = CGAlgorithms::computeOrientation(p1, p2, q); 0 1 1
142 }
143  
144 Coordinate* getIntersection(Coordinate& p00, Coordinate& p01, Coordinate& p10, Coordinate& p11) {
145 1 //auto& c = CentralEndpointIntersector::getIntersection(p00, p01, p10, p11);
146 // ^ buggy implementation in 3.6.3, as it returns dangling reference;
147 CentralEndpointIntersector intor(p00, p01, p10, p11);
148 1 ▶ auto& c = intor.getIntersection();
Branch: 1 branch
BranchTrueFalseTotal
auto& c = intor.getIntersection(); 1 0 1
149 1 RETVAL = new Coordinate(c);
150 1 ▶}
Branch: 2 branches
BranchTrueFalseTotal
} 1 0 1
} 1 0 1
151  
152 Sv convexHull(Geometry& newGeometry) {
153 1 ▶ auto ch = ConvexHull(&newGeometry);
Branch: 1 branch
BranchTrueFalseTotal
auto ch = ConvexHull(&newGeometry); 1 0 1
154 1 ▶ RETVAL = Helper::uplift(ch.getConvexHull());
Branch: 2 branches
BranchTrueFalseTotal
RETVAL = Helper::uplift(ch.getConvexHull()); 1 0 1
RETVAL = Helper::uplift(ch.getConvexHull()); 1 0 1
155 }
156  
157 Coordinate* interiorPointArea(Geometry& g) {
158 1 InteriorPointArea ip(&g);
159 1 ▶ Coordinate c;
Branch: 1 branch
BranchTrueFalseTotal
Coordinate c; 1 0 1
160 1 ▶ if (ip.getInteriorPoint(c)) RETVAL = new Coordinate(c);
Branch: 1 branch
BranchTrueFalseTotal
if (ip.getInteriorPoint(c)) RETVAL = new Coordinate(c); 1 0 1
161 1 ▶ else XSRETURN_UNDEF;
Branch: 3 branches
BranchTrueFalseTotal
else XSRETURN_UNDEF; 1 0 1
else XSRETURN_UNDEF; 1 0 1
else XSRETURN_UNDEF; 1 0 1
162 0 }
163  
164 Coordinate* interiorPointLine(Geometry& g) {
165 1 InteriorPointLine ip(&g);
166 1 ▶ Coordinate c;
Branch: 1 branch
BranchTrueFalseTotal
Coordinate c; 1 0 1
167 1 ▶ if (ip.getInteriorPoint(c)) RETVAL = new Coordinate(c);
Branch: 1 branch
BranchTrueFalseTotal
if (ip.getInteriorPoint(c)) RETVAL = new Coordinate(c); 1 0 1
168 1 ▶ else XSRETURN_UNDEF;
Branch: 3 branches
BranchTrueFalseTotal
else XSRETURN_UNDEF; 1 0 1
else XSRETURN_UNDEF; 1 0 1
else XSRETURN_UNDEF; 1 0 1
169 0 }
170  
171 Coordinate* interiorPointPoint(Geometry& g) {
172 1 InteriorPointPoint ip(&g);
173 1 ▶ Coordinate c;
Branch: 1 branch
BranchTrueFalseTotal
Coordinate c; 1 0 1
174 1 ▶ if (ip.getInteriorPoint(c)) RETVAL = new Coordinate(c);
Branch: 1 branch
BranchTrueFalseTotal
if (ip.getInteriorPoint(c)) RETVAL = new Coordinate(c); 1 0 1
175 1 ▶ else XSRETURN_UNDEF;
Branch: 3 branches
BranchTrueFalseTotal
else XSRETURN_UNDEF; 1 0 1
else XSRETURN_UNDEF; 1 0 1
else XSRETURN_UNDEF; 1 0 1
176 0 }
177  
178 int locate(Coordinate& p, Geometry& geom) {
179 1 PointLocator pl;
180 1 ▶ RETVAL = pl.locate(p, &geom);
Branch: 2 branches
BranchTrueFalseTotal
RETVAL = pl.locate(p, &geom); 1 0 1
RETVAL = pl.locate(p, &geom); 0 1 1
181 }
182  
183 bool intersects(Coordinate& p, Geometry& geom) {
184 1 PointLocator pl;
185 1 ▶ RETVAL = pl.intersects(p, &geom);
Branch: 2 branches
BranchTrueFalseTotal
RETVAL = pl.intersects(p, &geom); 1 0 1
RETVAL = pl.intersects(p, &geom); 1 0 1
186 }
187  
188 int signOfDet2x2(double x1, double y1, double x2, double y2) {
189 1 ▶ RETVAL = RobustDeterminant::signOfDet2x2(x1, y1, x2, y2);
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = RobustDeterminant::signOfDet2x2(x1, y1, x2, y2); 0 1 1
190 }
191  
192 int locateIndexedPointInArea(Coordinate& p, Geometry& geom) {
193 1 ▶ locate::IndexedPointInAreaLocator locator(geom);
Branch: 1 branch
BranchTrueFalseTotal
locate::IndexedPointInAreaLocator locator(geom); 1 0 1
194 1 ▶ RETVAL = locator.locate(&p);
Branch: 2 branches
BranchTrueFalseTotal
RETVAL = locator.locate(&p); 1 0 1
RETVAL = locator.locate(&p); 0 1 1
195 }
196  
197 int locateSimplePointInArea(Coordinate& p, Geometry& geom) {
198 1 locate::SimplePointInAreaLocator locator(&geom);
199 1 ▶ RETVAL = locator.locate(&p);
Branch: 2 branches
BranchTrueFalseTotal
RETVAL = locator.locate(&p); 1 0 1
RETVAL = locator.locate(&p); 0 1 1
200 }
201  
202 BOOT {
203 46 ▶ auto this_stash = Stash(__PACKAGE__);
Branch: 1 branch
BranchTrueFalseTotal
auto this_stash = Stash(__PACKAGE__); 46 0 46
204 322 ▶ xs::exp::create_constants(this_stash, {
Branch: 4 branches
BranchTrueFalseTotal
xs::exp::create_constants(this_stash, { 46 0 46
xs::exp::create_constants(this_stash, { 46 0 46
xs::exp::create_constants(this_stash, { 276 46 322
xs::exp::create_constants(this_stash, { 0 0 0
205 {"TYPE_TURN_CLOCKWISE", CGAlgorithms::CLOCKWISE},
206 {"TYPE_TURN_COLLINEAR", CGAlgorithms::COLLINEAR},
207 {"TYPE_TURN_COUNTERCLOCKWISE", CGAlgorithms::COUNTERCLOCKWISE},
208  
209 {"TYPE_ORIENT_RIGHT", CGAlgorithms::RIGHT},
210 {"TYPE_ORIENT_LEFT" , CGAlgorithms::LEFT},
211 {"TYPE_ORIENT_STRAIGHT", CGAlgorithms::STRAIGHT}
212 });
213 46 ▶ xs::exp::autoexport(this_stash);
Branch: 2 branches
BranchTrueFalseTotal
xs::exp::autoexport(this_stash); 46 0 46
xs::exp::autoexport(this_stash); 46 0 46
214 46 }
« xsi/Geometry.xsi ↑ Summary xsi/LineSegment.xsi »