当前位置: 首页>>代码示例>>C++>>正文


C++ PointSet::GetPoint方法代码示例

本文整理汇总了C++中PointSet::GetPoint方法的典型用法代码示例。如果您正苦于以下问题:C++ PointSet::GetPoint方法的具体用法?C++ PointSet::GetPoint怎么用?C++ PointSet::GetPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PointSet的用法示例。


在下文中一共展示了PointSet::GetPoint方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: sqrt

int mitk::PointSetDataInteractor::GetPointIndexByPosition(Point3D position, unsigned int time, float accuracy)
{
  // iterate over point set and check if it contains a point close enough to the pointer to be selected
  PointSet* points = dynamic_cast<PointSet*>(GetDataNode()->GetData());
  int index = -1;
  if (points == NULL)
  {
    return index;
  }


  if (points->GetPointSet(time) == nullptr)
    return -1;

  PointSet::PointsContainer* pointsContainer = points->GetPointSet(time)->GetPoints();

  float minDistance = m_SelectionAccuracy;
  if (accuracy != -1 )
    minDistance = accuracy;


  for (PointSet::PointsIterator it = pointsContainer->Begin(); it != pointsContainer->End(); it++)
  {
    float distance = sqrt(position.SquaredEuclideanDistanceTo(points->GetPoint(it->Index(), time)));
    if (distance < minDistance) // if several points fall within the margin, choose the one with minimal distance to position
    {
      index = it->Index();
    }
  }
  return index;
}
开发者ID:151706061,项目名称:MITK,代码行数:31,代码来源:mitkPointSetDataInteractor.cpp

示例2: sqrt

int mitk::PointSetDataInteractor::GetPointIndexByPosition(Point3D position, int time)
{

  // iterate over point set and check if it contains a point close enough to the pointer to be selected
  PointSet* points = dynamic_cast<PointSet*>(GetDataNode()->GetData());
  int index = -1;
  if (points == NULL)
  {
    return index;
  }
  PointSet::PointsContainer* pointsContainer = points->GetPointSet(time)->GetPoints();

  float minDistance = m_SelectionAccuracy;
  for (PointSet::PointsIterator it = pointsContainer->Begin(); it != pointsContainer->End(); it++)
  {
    float distance = sqrt(position.SquaredEuclideanDistanceTo(points->GetPoint(it->Index(), time)));  // TODO: support time!
    if (distance < minDistance) // if several points fall within the margin, choose the one with minimal distance to position
    { // TODO: does this make sense, which unit is it?
      index = it->Index();
    }
  }
  return index;
}
开发者ID:AGrafmint,项目名称:MITK,代码行数:23,代码来源:mitkPointSetDataInteractor.cpp


注:本文中的PointSet::GetPoint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。