本文整理汇总了C++中PointSet::GetPointSet方法的典型用法代码示例。如果您正苦于以下问题:C++ PointSet::GetPointSet方法的具体用法?C++ PointSet::GetPointSet怎么用?C++ PointSet::GetPointSet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PointSet
的用法示例。
在下文中一共展示了PointSet::GetPointSet方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: GetDataNode
bool mitk::PointSetDataInteractor::MoveSet(StateMachineAction*, InteractionEvent* interactionEvent)
{
InteractionPositionEvent* positionEvent = dynamic_cast<InteractionPositionEvent*>(interactionEvent);
if (positionEvent != NULL)
{
int timeStep = positionEvent->GetSender()->GetTimeStep();
// Vector that represents movement relative to last position
Point3D movementVector;
movementVector[0] = positionEvent->GetPositionInWorld()[0] - m_PointSet->GetPoint(m_SelectedPointIndex, timeStep)[0];
movementVector[1] = positionEvent->GetPositionInWorld()[1] - m_PointSet->GetPoint(m_SelectedPointIndex, timeStep)[1];
movementVector[2] = positionEvent->GetPositionInWorld()[2] - m_PointSet->GetPoint(m_SelectedPointIndex, timeStep)[2];
PointSet* points = dynamic_cast<PointSet*>(GetDataNode()->GetData());
PointSet::PointsContainer* pointsContainer = points->GetPointSet(timeStep)->GetPoints();
// Iterate over point set and update each point
Point3D newPoint;
for (PointSet::PointsIterator it = pointsContainer->Begin(); it != pointsContainer->End(); it++)
{
newPoint[0] = m_PointSet->GetPoint(it->Index(), timeStep)[0] + movementVector[0];
newPoint[1] = m_PointSet->GetPoint(it->Index(), timeStep)[1] + movementVector[1];
newPoint[2] = m_PointSet->GetPoint(it->Index(), timeStep)[2] + movementVector[2];
m_PointSet->SetPoint(it->Index(), newPoint, timeStep);
}
GetDataNode()->SetData(m_PointSet);
GetDataNode()->Modified();
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
return true;
}
else
{
return false;
}
}
示例3: 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;
}
示例4: BaseData
mitk::PointSet::PointSet(const PointSet &other)
: BaseData(other)
, m_PointSetSeries(other.GetPointSetSeriesSize())
, m_CalculateBoundingBox(true)
{
// Copy points
for (std::size_t t = 0; t < m_PointSetSeries.size(); ++t)
{
m_PointSetSeries[t] = DataType::New();
DataType::Pointer otherPts = other.GetPointSet(t);
for (PointsConstIterator i = other.Begin(t);
i != other.End(t); ++i)
{
m_PointSetSeries[t]->SetPoint(i.Index(), i.Value());
PointDataType pointData;
if (otherPts->GetPointData(i.Index(), &pointData))
{
m_PointSetSeries[t]->SetPointData(i.Index(), pointData);
}
}
}
}