本文整理汇总了C++中Point2D::GetVectorFromOrigin方法的典型用法代码示例。如果您正苦于以下问题:C++ Point2D::GetVectorFromOrigin方法的具体用法?C++ Point2D::GetVectorFromOrigin怎么用?C++ Point2D::GetVectorFromOrigin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point2D
的用法示例。
在下文中一共展示了Point2D::GetVectorFromOrigin方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
// Zooms with a factor (1.0=identity) around the specified center, but tries (if its within view contraints) to match the center in display units with the center in world coordinates.
bool mitk::DisplayGeometry::ZoomWithFixedWorldCoordinates(ScalarType factor, const Point2D& focusDisplayUnits, const Point2D& focusUnitsInMM )
{
assert(factor > 0);
SetScaleFactor(m_ScaleFactorMMPerDisplayUnit/factor);
SetOriginInMM(focusUnitsInMM.GetVectorFromOrigin()-focusDisplayUnits.GetVectorFromOrigin()*m_ScaleFactorMMPerDisplayUnit);
return true;
}
示例2: SetOriginInMM
// Zooms with a factor (1.0=identity) around the specified center in display units
bool mitk::DisplayGeometry::Zoom(ScalarType factor, const Point2D& centerInDisplayUnits)
{
assert(factor > 0);
if ( SetScaleFactor(m_ScaleFactorMMPerDisplayUnit/factor) )
{
return SetOriginInMM(m_OriginInMM-centerInDisplayUnits.GetVectorFromOrigin()*(1-factor)*m_ScaleFactorMMPerDisplayUnit);
}
else
{
return false;
}
}
示例3: oldSizeInMM
void mitk::DisplayGeometry::SetSizeInDisplayUnits(unsigned int width, unsigned int height, bool keepDisplayedRegion)
{
Vector2D oldSizeInMM( m_SizeInMM );
Point2D oldCenterInMM;
if(keepDisplayedRegion)
{
Point2D centerInDisplayUnits;
centerInDisplayUnits[0] = m_SizeInDisplayUnits[0]*0.5;
centerInDisplayUnits[1] = m_SizeInDisplayUnits[1]*0.5;
DisplayToWorld(centerInDisplayUnits, oldCenterInMM);
}
m_SizeInDisplayUnits[0]=width;
m_SizeInDisplayUnits[1]=height;
if(m_SizeInDisplayUnits[0] <= 0)
m_SizeInDisplayUnits[0] = 1;
if(m_SizeInDisplayUnits[1] <= 0)
m_SizeInDisplayUnits[1] = 1;
DisplayToWorld(m_SizeInDisplayUnits, m_SizeInMM);
if(keepDisplayedRegion)
{
Point2D positionOfOldCenterInCurrentDisplayUnits;
WorldToDisplay(oldCenterInMM, positionOfOldCenterInCurrentDisplayUnits);
Point2D currentNewCenterInDisplayUnits;
currentNewCenterInDisplayUnits[0] = m_SizeInDisplayUnits[0]*0.5;
currentNewCenterInDisplayUnits[1] = m_SizeInDisplayUnits[1]*0.5;
Vector2D shift;
shift=positionOfOldCenterInCurrentDisplayUnits.GetVectorFromOrigin()-currentNewCenterInDisplayUnits;
MoveBy(shift);
Zoom(m_SizeInMM.GetNorm()/oldSizeInMM.GetNorm(), currentNewCenterInDisplayUnits);
}
Modified();
}