本文整理汇总了C++中ofVec2f::length方法的典型用法代码示例。如果您正苦于以下问题:C++ ofVec2f::length方法的具体用法?C++ ofVec2f::length怎么用?C++ ofVec2f::length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofVec2f
的用法示例。
在下文中一共展示了ofVec2f::length方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: spawnHandle
shared_ptr<handle> handle::press(ofVec2f t_vec, int ha) {
//mouse coordinates already translated in testApp
shared_ptr<handle> ptr;
m_isActive = true;
if(!m_parent && m_children.size() == 0 || ha == HA_VEC_SPAWN) {
ptr = spawnHandle();
m_inputMapper = shared_ptr<inputMapper>(new vecInput()); //need to think how parameters for this are set
shared_ptr<vecInput> t_vi(static_pointer_cast <vecInput>(m_inputMapper));
if(t_vec.length() > 10){
t_vi->setDirGlobal(t_vec.getNormalized());
}else{
t_vi->setDirGlobal(ofVec2f(0,1));
}
}
if(m_inputMapper) {
reset();
m_inputMapper->start();
}
return ptr;
}
示例2: drawArrow
void KinectProjector::drawArrow(ofVec2f projectedPoint, ofVec2f v1)
{
float angle = ofRadToDeg(atan2(v1.y,v1.x));
float length = v1.length();
ofFill();
ofPushMatrix();
ofTranslate(projectedPoint);
ofRotate(angle);
ofSetColor(255,0,0,255);
ofDrawLine(0, 0, length, 0);
ofDrawLine(length, 0, length-7, 5);
ofDrawLine(length, 0, length-7, -5);
ofPopMatrix();
}
示例3: undistortCoordinate
ofVec2f Camera::undistortCoordinate(const ofVec2f & xy) const {
const int distortionLength = this->distortion.size();
if (this->distortion.size() < 2) {
return xy;
}
float r = xy.length();
float rr = r*r;
float rad_coeff = 1.0f + distortion[0] * rr + distortion[1] * rr * rr;
if (distortionLength > 4) {
rad_coeff += distortion[4] * rr * rr * rr;
}
float xn = xy.x * rad_coeff;
float yn = xy.y * rad_coeff;
xn += 2 * distortion[2] * xn * yn + distortion[3] * (rr + 2 * xn * xn);
yn += distortion[2] * (rr + 2 * yn * yn) + 2 * distortion[3] * xn * yn;
return ofVec2f(xn, yn);
}
示例4: getRadius
float getRadius() {
return position.length();
}