void Joint::draw() { if (hover) { gui_panel_p = p; } if (hover || selected || controlled_angle || fixed_angle) { if (gui != NULL) { gui->setPosition(getPx(p) + ofPoint(30.0f, 30.0f)); gui->draw(); } } ofPoint icon_offset(13, 13); if (joint_type == JOINT_FIXED) { fixed = true; } if (controlled || controlled_angle) { ofSetColor(ofColor::darkRed); } else if (selected) { ofSetColor(ofColor::steelBlue); } else if (hover) { ofSetColor(ofColor::red); } else if (fixed) { ofSetColor(ofColor::darkBlue); } else { ofSetColor(ofColor::black); } ofPoint p1 = getPx(p); if (fixed || fixed_angle) { joint_icon_fixed.draw(p1 - icon_offset); } else { joint_icon_r.draw(p1 - icon_offset); } ofSetColor(ofColor::red); ofSetLineWidth(4.0f); ofLine(getPx(p), getPx(p+f)); //ofDrawBitmapStringHighlight(ofToString(angle), p1); // ofDrawBitmapStringHighlight("a"+ofToString(angle_change_i), p1); // ofDrawBitmapStringHighlight("m"+ofToString(moved_i), p1 + ofPoint(0.0f, 15.0f)); // ofSetColor(ofColor::blue); // ofSetLineWidth(4.0f); // ofLine(getPx(p), getPx(target)); }
Eigen::Vector3d getSubPx_intx(const cv::Mat & M, const int nx, const double y) { const int ny_lo = intFloor(y); const int ny_hi = ny_lo + 1; const double y_lo = (double) ny_lo; if(IS_DEBUG) CHECK(y_lo > y, "floor failed"); double dWeightHi = y - y_lo; double dWeightLo = 1 - dWeightHi; if(IS_DEBUG) CHECK(dWeightHi < 0 || dWeightHi > 1, "Weight OOB"); if(IS_DEBUG) CHECK(dWeightLo < 0 || dWeightLo > 1, "Weight OOB"); return dWeightLo * getPx(M, nx, ny_lo) + dWeightHi * getPx(M, nx, ny_hi); }
ofPoint Canvas::getPx(InteractiveObject *v) { return getPx(v->p); }