MCPcopy Create free account
hub / github.com/creatale/node-dv / Add

Method Add

deps/tesseract/cube/con_comp.cpp:53–77  ·  view source on GitHub ↗

adds a pt to the conn comp and updates its boundaries

Source from the content-addressed store, hash-verified

51
52// adds a pt to the conn comp and updates its boundaries
53bool ConComp::Add(int x, int y) {
54 ConCompPt *pt_ptr = new ConCompPt(x, y);
55
56 if (head_ == NULL) {
57 left_ = x;
58 right_ = x;
59 top_ = y;
60 bottom_ = y;
61
62 head_ = pt_ptr;
63 } else {
64 left_ = left_ <= x ? left_ : x;
65 top_ = top_ <= y ? top_ : y;
66 right_ = right_ >= x ? right_ : x;
67 bottom_ = bottom_ >= y ? bottom_ : y;
68 }
69
70 if (tail_ != NULL) {
71 tail_->SetNext(pt_ptr);
72 }
73
74 tail_ = pt_ptr;
75 pt_cnt_++;
76 return true;
77}
78
79// merges two connected components
80bool ConComp::Merge(ConComp *concomp) {

Callers 2

SegmentMethod · 0.45
FindConCompsMethod · 0.45

Calls 1

SetNextMethod · 0.80

Tested by

no test coverage detected