本文整理汇总了C++中PointSet类的典型用法代码示例。如果您正苦于以下问题:C++ PointSet类的具体用法?C++ PointSet怎么用?C++ PointSet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PointSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
}
示例2: mouseMoveEvent
bool RangeProfilePlotManager::mouseMoveEvent(PlotView* pView, QMouseEvent* pEvent)
{
bool rval = false;
if (!mMouseStart.isNull())
{
double dataX, startY, curY;
pView->translateScreenToData(0.0, mMouseStart.y(), dataX, startY);
pView->translateScreenToData(0.0, pEvent->y(), dataX, curY);
double shift = curY - startY;
std::list<PlotObject*> selected;
pView->getSelectedObjects(selected, true);
for (std::list<PlotObject*>::iterator obj = selected.begin(); obj != selected.end(); ++obj)
{
PointSet* pSet = dynamic_cast<PointSet*>(*obj);
if (pSet != NULL)
{
rval = true;
std::vector<Point*> points = pSet->getPoints();
for (std::vector<Point*>::iterator point = points.begin(); point != points.end(); ++point)
{
LocationType loc = (*point)->getLocation();
loc.mY -= shift;
(*point)->setLocation(loc);
}
}
}
mMouseStart = pEvent->pos();
pView->refresh();
}
return rval;
}
示例3: 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;
}
示例4: serializeRead
void PointSets::serializeRead(QDataStream &s, Q3Canvas* canvas)
{
axesPointSet.serializeRead(s, canvas);
axesPointSet.attachPointsToPointSet();
scalePointSet.serializeRead(s, canvas);
scalePointSet.attachPointsToPointSet();
int i;
int count;
s >> (Q_INT32 &) count;
for (i = 0; i < count; i++)
{
PointSet pointSet;
pointSet.serializeRead(s, canvas);
curveList.append(pointSet);
curveList.last().attachPointsToPointSet();
}
s >> (Q_INT32 &) count;
for (i = 0; i < count; i++)
{
PointSet pointSet;
pointSet.serializeRead(s, canvas);
measureList.append(pointSet);
measureList.last().attachPointsToPointSet();
}
}
示例5: findMeasure
int PointSets::pointCountMeasure(QString name)
{
PointSet* pointSet = findMeasure(name);
if (pointSet == 0)
return 0;
else
return pointSet->pointCount();
}
示例6: PointSet
SceneObjectPtr
PointSet::copy(DeepCopier& copier) const
{
PointSet * ptr = new PointSet(*this);
copier.copy_attribute(ptr->getPointList());
copier.copy_attribute(ptr->getColorList());
return SceneObjectPtr(ptr);
}
示例7: addCurve
void PointSets::addCurve(QString name)
{
PointSet pointSet;
pointSet.setStyle(DefaultSettings::instance().getCurveStyle(curveList.count()));
pointSet.setName(name);
curveList.append(pointSet);
}
示例8: addMeasure
void PointSets::addMeasure(QString name)
{
PointSet pointSet;
pointSet.setStyle(DefaultSettings::instance().getMeasureStyle(measureList.count()));
pointSet.setName(name);
measureList.append(pointSet);
}
示例9: affineInterp
void affineInterp(const PointSet &src, PointSet &res, const double mat[DIM_MAX][DIM_MAX+1])
{
int N = src.dim() ;
res.al(src.size(), src.dim()) ;
for (unsigned int i=0; i< src.size(); i++) {
for (int j=0; j< N; j++) {
res[i][j] = mat[j][N] ;
for(int jj=0; jj< N; jj++)
res[i][j] += mat[j][jj] * src[i][jj] ;
}
}
}
示例10: WeldVertices
void BaseMesh::WeldVertices(float Epsilon, Vector<UINT> &OldToNewMapping)
{
PointSet MyPoints;
MyPoints.LoadFromMesh(*this);
KDTree3 &Tree = MyPoints.KDTree();
UINT VC = VertexCount(), IC = IndexCount();
MeshVertex *V = Vertices();
DWORD *I = Indices();
OldToNewMapping.ReSize(VC);
OldToNewMapping.Clear(VC);
Vector<UINT> NNResult;
//MeshVertex *VStorage = new MeshVertex[VC];
for(UINT VertexIndex = 0; VertexIndex < VC; VertexIndex++)
{
Vec3f Pos = V[VertexIndex].Pos;
Tree.WithinDistance(Pos, Epsilon, NNResult);
bool MatchFound = false;
//VStorage[VertexIndex] = V[VertexIndex];
for(UINT ResultIndex = 0; ResultIndex < NNResult.Length() && !MatchFound; ResultIndex++)
{
UINT CurIndex = NNResult[ResultIndex];
if(OldToNewMapping[CurIndex] != VC)
{
MatchFound = true;
OldToNewMapping[VertexIndex] = CurIndex;
}
}
if(!MatchFound)
{
OldToNewMapping[VertexIndex] = VertexIndex;
}
}
//DWORD *IStorage = new DWORD[IC];
for(UINT IndexIndex = 0; IndexIndex < IC; IndexIndex++)
{
I[IndexIndex] = OldToNewMapping[UINT(I[IndexIndex])];
}
//Allocate(
//delete[] VStorage;
Vector<UINT> SecondMapping, SplitToUnsplit = OldToNewMapping;
CleanVerticesAndTriangles(SecondMapping);
for(UINT VertexIndex = 0; VertexIndex < VC; VertexIndex++)
{
OldToNewMapping[VertexIndex] = SecondMapping[SplitToUnsplit[VertexIndex]];
}
}
示例11: penetration
void GjkContactSolver::penetration(const PointSet & A, const PointSet & B, ClosestTestContext * result)
{
resetSimplex(result->W);
const Vector3F r = result->rayDirection;
const Vector3F startP = Vector3F::Zero - result->rayDirection * 99.f;
Vector3F hitP = startP;
// from origin to startP
Vector3F v = hitP;
Vector3F w, p, pa, pb, localA, localB;
float lamda = 0.f;
float vdotw, vdotr;
int k = 0;
for(; k < 39; k++) {
vdotr = v.dot(r);
// SA-B(v)
pa = A.supportPoint(v, result->transformA, localA, result->margin);
pb = B.supportPoint(v.reversed(), result->transformB, localB, result->margin);
p = pa - pb;// + v.normal() * MARGIN_DISTANCE;
w = hitP - p;
vdotw = v.dot(w);
if(vdotw > 0.f) {
if(vdotr >= 0.f)
break;
lamda -= vdotw / vdotr;
hitP = startP + r * lamda;
}
addToSimplex(result->W, p, localB);
result->hasResult = 0;
result->distance = 1e9;
result->referencePoint = hitP;
closestOnSimplex(result);
v = hitP - result->closestPoint;
interpolatePointB(result);
if(v.length2() < TINY_VALUE) break;
result->separateAxis = v;
smallestSimplex(result);
}
result->distance = hitP.length();
result->separateAxis.normalize();
}
示例12: pruneCallback
bool LabelPosition::pruneCallback( LabelPosition *lp, void *ctx )
{
PointSet *feat = (( PruneCtx* ) ctx )->obstacle;
if (( feat == lp->feature ) || ( feat->getHoleOf() && feat->getHoleOf() != lp->feature ) )
{
return true;
}
CostCalculator::addObstacleCostPenalty( lp, feat );
return true;
}
示例13: PointSet
void
KML_Model::parseCoords( xml_node<>* node, KMLContext& cx )
{
PointSet* point = new PointSet();
xml_node<>* location = node->first_node("location", 0, false);
if (location)
{
double latitude = as<double>(getValue(location, "latitude"), 0.0);
double longitude = as<double>(getValue(location, "longitude"), 0.0);
double altitude = as<double>(getValue(location, "altitude"), 0.0);
point->push_back( osg::Vec3d(longitude, latitude, altitude));
}
_geom = point;
}
示例14: PointSet
void
KML_Model::parseCoords( const Config& conf, KMLContext& cx )
{
PointSet* point = new PointSet();
Config location = conf.child("location");
if (!location.empty())
{
double latitude = location.value("latitude", 0.0);
double longitude = location.value("longitude", 0.0);
double altitude = location.value("altitude", 0.0);
point->push_back( osg::Vec3d(longitude, latitude, altitude));
}
_geom = point;
}
示例15: Read
bool SimpleReadStrategy::Read(PointSet &pointSet)
{
if(_isFinish)
return false;
time_t sT, eT;
sT = clock();
std::ifstream infile(_fileName.c_str());
if(!infile)
{
_log << "Can not open this file in this path"<<endl;
return false;
}
_log<<"Begin to read data."<<endl;
SimpleInputor inputor(infile);
inputor.ReadHead();
ReadConcept(inputor, pointSet, _recordType);
infile.close();
//inputor.infile.close();
_log<<"All "<<pointSet.size()<<" points have been read successfully!"<<endl;
eT = clock();
_log << "Read-Time: "<<difftime(eT, sT)<<endl;
_isFinish = true;
return true;
}