本文整理汇总了C++中Point2D::GetVnlVector方法的典型用法代码示例。如果您正苦于以下问题:C++ Point2D::GetVnlVector方法的具体用法?C++ Point2D::GetVnlVector怎么用?C++ Point2D::GetVnlVector使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point2D
的用法示例。
在下文中一共展示了Point2D::GetVnlVector方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
bool mitk::PlanarCircle::SetControlPoint( unsigned int index, const Point2D &point, bool /*createIfDoesNotExist*/ )
{
// moving center point
if(index == 0)
{
const Point2D ¢erPoint = GetControlPoint( 0 );
Point2D boundaryPoint = GetControlPoint( 1 );
vnl_vector<float> vec = (point.GetVnlVector() - centerPoint.GetVnlVector());
boundaryPoint[0] += vec[0];
boundaryPoint[1] += vec[1];
PlanarFigure::SetControlPoint( 0, point );
PlanarFigure::SetControlPoint( 1, boundaryPoint );
}
else if ( index == 1 )
{
PlanarFigure::SetControlPoint( index, point );
return true;
}
return false;
}
示例2: if
bool mitk::PlanarEllipse::SetControlPoint( unsigned int index, const Point2D &point, bool createIfDoesNotExist )
{
if(index == 0) // moving center point and control points accordingly
{
const Point2D ¢erPoint = GetControlPoint( 0 );
Point2D boundaryPoint1 = GetControlPoint( 1 );
Point2D boundaryPoint2 = GetControlPoint( 2 );
Point2D boundaryPoint3 = GetControlPoint( 3 );
vnl_vector<ScalarType> vec = (point.GetVnlVector() - centerPoint.GetVnlVector());
boundaryPoint1[0] += vec[0];
boundaryPoint1[1] += vec[1];
boundaryPoint2[0] += vec[0];
boundaryPoint2[1] += vec[1];
boundaryPoint3[0] += vec[0];
boundaryPoint3[1] += vec[1];
PlanarFigure::SetControlPoint( 0, point, createIfDoesNotExist );
PlanarFigure::SetControlPoint( 1, boundaryPoint1, createIfDoesNotExist );
PlanarFigure::SetControlPoint( 2, boundaryPoint2, createIfDoesNotExist );
PlanarFigure::SetControlPoint( 3, boundaryPoint3, createIfDoesNotExist );
return true;
}
else if (index < 3)
{
PlanarFigure::SetControlPoint( index, point, createIfDoesNotExist );
int otherIndex = index+1;
if (otherIndex > 2)
otherIndex = 1;
const Point2D ¢erPoint = GetControlPoint( 0 );
Point2D otherPoint = GetControlPoint( otherIndex );
Point2D point3 = GetControlPoint( 3 );
Vector2D vec1 = point - centerPoint;
Vector2D vec2;
if (index == 1 && m_TreatAsCircle )
{
float x = vec1[0];
vec2[0] = vec1[1];
vec2[1] = x;
if (index==1)
vec2[0] *= -1;
else
vec2[1] *= -1;
otherPoint = centerPoint+vec2;
PlanarFigure::SetControlPoint( otherIndex, otherPoint, createIfDoesNotExist );
float r = centerPoint.EuclideanDistanceTo(otherPoint);
// adjust additional third control point
Point2D p3 = this->GetControlPoint(3);
Vector2D vec3;
vec3[0] = p3[0]-centerPoint[0];
vec3[1] = p3[1]-centerPoint[1];
if (vec3[0]!=0 || vec3[1]!=0)
{
vec3.Normalize();
vec3 *= r;
}
else
{
vec3[0] = r;
vec3[1] = 0;
}
point3 = centerPoint + vec3;
PlanarFigure::SetControlPoint( 3, point3, createIfDoesNotExist );
}
else if ( vec1.GetNorm() > 0 )
{
float r = centerPoint.EuclideanDistanceTo(otherPoint);
float x = vec1[0];
vec2[0] = vec1[1];
vec2[1] = x;
if (index==1)
vec2[0] *= -1;
else
vec2[1] *= -1;
vec2.Normalize(); vec2 *= r;
if ( vec2.GetNorm() > 0 )
{
otherPoint = centerPoint+vec2;
PlanarFigure::SetControlPoint( otherIndex, otherPoint, createIfDoesNotExist );
}
// adjust third control point
Vector2D vec3 = point3 - centerPoint; vec3.Normalize();
double r1 = centerPoint.EuclideanDistanceTo( GetControlPoint( 1 ) );
double r2 = centerPoint.EuclideanDistanceTo( GetControlPoint( 2 ) );
Point2D newPoint = centerPoint + vec3*std::max(r1, r2);
PlanarFigure::SetControlPoint( 3, newPoint, createIfDoesNotExist );
m_TreatAsCircle = false;
}
return true;
}
//.........这里部分代码省略.........