MCPcopy Create free account
hub / github.com/cp-algorithms/cp-algorithms / solve

Function solve

test/test_vertical_decomposition.cpp:7–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5#include "triangle_union.h"
6
7dbl solve(vector<vector<int> > rects){
8 vector<vector<pt> > processed_rects;
9 for(const auto& v: rects){
10 processed_rects.push_back(vector<pt>());
11 processed_rects.back().push_back(pt{(dbl)v[0], (dbl)v[1]});
12 processed_rects.back().push_back(pt{(dbl)v[2], (dbl)v[3]});
13 processed_rects.back().push_back(pt{(dbl)v[4], (dbl)v[5]});
14 processed_rects.back().push_back(pt{(dbl)v[6], (dbl)v[7]});
15 }
16 vector<tuple<pt, pt, pt> > tr;
17 dbl sum = 0;
18 for(const auto& r: processed_rects){
19 sum += fabs((r[1] - r[0]).cross(r[3] - r[0]));
20 tr.emplace_back(r[0], r[1], r[2]);
21 tr.emplace_back(r[2], r[3], r[0]);
22 }
23 return sum/union_area(tr);
24}
25
26bool test1(){
27 vector<vector<int> > rects = {

Callers 7

test_discrete_logFunction · 0.85
mainFunction · 0.85
test1Function · 0.85
test2Function · 0.85
test_handcrafted_caseFunction · 0.85
test_random_casesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected