// test cases main() { Semantic *pa1 = new Semantic(Atomic::Constant, NULL, "true"); Semantic *pa2 = new Semantic(Atomic::Variable, "A", NULL); Semantic pe1(Expression::And, pa1, pa2, 1); return(0); }
SkFlattenable* SkComposePathEffect::CreateProc(SkReadBuffer& buffer) { SkAutoTUnref<SkPathEffect> pe0(buffer.readPathEffect()); SkAutoTUnref<SkPathEffect> pe1(buffer.readPathEffect()); if (pe0 && pe1) { return SkComposePathEffect::Create(pe0, pe1); } else { return nullptr; } }
void Compare(const po::variables_map& variables, int& retcode) { retcode = 1; std::vector<std::wstring> inputs; if (variables.count("input")) inputs = variables["input"].as<std::vector<std::wstring>>(); if (inputs.size() != 2) { std::wcerr << L"Error parsing options: must have 2 input files." << std::endl; return; } auto out = OpenOutput<wchar_t>(variables); if (!out) return; bool fast = variables["fast"].as<bool>(); bool noHeuristics = variables["no-heuristics"].as<bool>(); bool verbose = variables["verbose"].as<bool>(); bool tlbTimestamp = variables["tlb-timestamp"].as<bool>(); BlockList ignoredRanges = boost::lexical_cast<BlockList>(variables["r"].as<std::wstring>()); BlockList ignoredRanges1 = boost::lexical_cast<BlockList>(variables["r1"].as<std::wstring>()); BlockList ignoredRanges2 = boost::lexical_cast<BlockList>(variables["r2"].as<std::wstring>()); PEParser pe1(inputs[0]); PEParser pe2(inputs[1]); pe1.AddIgnoredRange(ignoredRanges1); pe1.AddIgnoredRange(ignoredRanges); pe2.AddIgnoredRange(ignoredRanges2); pe2.AddIgnoredRange(ignoredRanges); pe1.Open(); pe2.Open(); *out << inputs[0] << L":\n\n" << pe1 << inputs[1] << L":\n\n" << pe2 << std::endl; auto result = PEParser::Compare(pe1, pe2, fast, noHeuristics, verbose, tlbTimestamp); *out << result << std::endl; bool success = false; bool identical = variables["identical"].as<bool>(); if (identical) success = result.IsIdentical(); else success = result.IsEquivalent(); retcode = (success) ? 0 : 1; }
void PathPlanner::drawPath(std::vector<Eigen::Vector3f> & path, cv::Mat3b & image) { if(path.size() != 0) { for(size_t i = 1; i < path.size(); i++) { cv::Point2i p0, p1; Eigen::Vector2i pe0 = worldToImg(path.at(i - 1)); Eigen::Vector2i pe1 = worldToImg(path.at(i)); p0.x = pe0(0); p0.y = pe0(1); p1.x = pe1(0); p1.y = pe1(1); cv::line(image, p0, p1, CV_RGB(0, 255, 0), 2); } for(size_t i = 1; i < path.size(); i++) { cv::Point2i p0, p1; Eigen::Vector2i pe0 = worldToImg(path.at(i - 1)); Eigen::Vector2i pe1 = worldToImg(path.at(i)); p0.x = pe0(0); p0.y = pe0(1); p1.x = pe1(0); p1.y = pe1(1); cv::circle(image, p0, 4, CV_RGB(0, 0, 255), 2); cv::circle(image, p1, 4, CV_RGB(0, 0, 255), 2); } } }
int main(int argc, const char** argv) { std::unique_ptr<Shape> pr1(new Rectangle); std::unique_ptr<Shape> pr2(new Rectangle); std::unique_ptr<Shape> pe1(new Ellipse); std::unique_ptr<Shape> pe2(new Ellipse); std::unique_ptr<Shape> pt(new Triangle); std::cout << "Dynamic type dispatch\n"; LOG(pr1->Intersect(pe1.get())); LOG(pe1->Intersect(pr1.get())); LOG(pr1->Intersect(pr2.get())); // Here the dispatch is routed to Shape, since Ellipse doesn't define // intersections with ellipses. LOG(pe1->Intersect(pe2.get())); // Since Rectangle and Triangle don't define intersection ops with each other, // these calls are routed to Shape. LOG(pr1->Intersect(pt.get())); LOG(pt->Intersect(pr1.get())); return 0; }