void GetCoordInventory() { std::map<std::wstring, AcGePoint3d> m_3dPoints; u_int startIndex = 1; ads_real textHeightResult = 1; ads_real pointSizeResult = 0.25; ACHAR stringResult[2]; ACHAR prompt[100]; AcDbObjectId pObj; selectObject(pObj); if (pObj) { acedInitGet(RSG_NONULL | RSG_NOZERO | RSG_NONEG, NULL); acedGetReal(_T("\nIntroduceti inaltime text: "), &textHeightResult); acedGetReal(_T("\nIntroduceti dimensiunea punctului: "), &pointSizeResult); extractVertexCoords(pObj, m_3dPoints); if (m_3dPoints.size() > 0) { if (insertPoints(m_3dPoints, 32, pointSizeResult, textHeightResult)) { acedInitGet(RSG_NONULL, _T("Y N")); acedGetKword(_T("\nInseram tabel de coordonate? [Yes No]:"), stringResult); if (wcscmp(stringResult, _T("N"))) generateInventarTable(m_3dPoints,textHeightResult); //swprintf(prompt, _T("\nExportam fisier de coordonate? [Y/N]<stringResult=%s>: "), stringResult); acedInitGet(RSG_NONULL, _T("Y N")); acedGetKword(_T("\nExportam fisier de coordonate? [Yes No]: " ), stringResult); if (wcscmp(stringResult, _T("N"))) { struct resbuf* result = NULL; if (acedGetFileNavDialog(_T("Save coordonates file"), NULL, _T("csv;txt"), _T("Save Dialog"), 1, &result) != RTERROR) { ExportClass* csvExport = new ExportClass(result->resval.rstring); csvExport->exportInventarCSV(m_3dPoints, startIndex); //*****Release memory area*****/ acutRelRb(result); delete csvExport; } } } } } else { acutPrintf(_T("\nError nici un obiect selectat!")); } }
void Foam::CV2D::insertPoints(const fileName& pointFileName) { IFstream pointsFile(pointFileName); if (pointsFile.good()) { insertPoints ( point2DField(pointsFile), 0.5*meshControls().minCellSize2() ); } else { FatalErrorInFunction << "Could not open pointsFile " << pointFileName << exit(FatalError); } }
bool convertMeshToPCLPointCloud(const osg::Geometry* geometry, pcl::PointCloud<PointT>& pointcloud) { insertPoints(geometry, pointcloud); return !pointcloud.empty(); }
void Mesh::processMesh() { _totalNumberOfIntervalsX = 0; _totalNumberOfIntervalsY = 0; _totalNumberOfIntervalsZ = 0; for (auto i = 0; i < _emountOfIntervalsX.size(); i++) { _totalNumberOfIntervalsX += _emountOfIntervalsX[i]; } for (auto i = 0; i < _emountOfIntervalsY.size(); i++) { _totalNumberOfIntervalsY += _emountOfIntervalsY[i]; } for (auto i = 0; i < _emountOfIntervalsZ.size(); i++) { _totalNumberOfIntervalsZ += _emountOfIntervalsZ[i]; } x.resize((_totalNumberOfIntervalsX + 1)*(_totalNumberOfIntervalsY + 1)); y.resize((_totalNumberOfIntervalsX + 1)*(_totalNumberOfIntervalsY + 1)); z.resize(_totalNumberOfIntervalsZ + 1); for (auto i = 0; i < y.size(); i++) { y[i] = -1; } std::vector<double> resultX; std::vector<double> resultY; std::vector<double> squareCoordinatesX; std::vector<double> squareCoordinatesY; squareCoordinatesX.resize(4); squareCoordinatesY.resize(4); int sizeOfResult; int startPosition = 0; for (auto i = 0; i < _emountOfReferenceNodesY - 1; i++) { for (auto j = 0; j < _emountOfReferenceNodesX - 1; j++) { sizeOfResult = (_emountOfIntervalsX[j] + 1)*(_emountOfIntervalsY[i] + 1); resultX.resize(sizeOfResult); resultY.resize(sizeOfResult); squareCoordinatesX[0] = _referenceNodesX[j + i * (_emountOfReferenceNodesX)]; squareCoordinatesX[1] = _referenceNodesX[j + 1 + i * (_emountOfReferenceNodesX)]; squareCoordinatesX[2] = _referenceNodesX[j + (i + 1) * (_emountOfReferenceNodesX)]; squareCoordinatesX[3] = _referenceNodesX[j + 1 + (i + 1) * (_emountOfReferenceNodesX)]; squareCoordinatesY[0] = _referenceNodesY[j + i * (_emountOfReferenceNodesX)]; squareCoordinatesY[1] = _referenceNodesY[j + 1 + i * (_emountOfReferenceNodesX)]; squareCoordinatesY[2] = _referenceNodesY[j + (i + 1) * (_emountOfReferenceNodesX)]; squareCoordinatesY[3] = _referenceNodesY[j + 1 + (i + 1) * (_emountOfReferenceNodesX)]; processSquare(squareCoordinatesX, squareCoordinatesY, _coefficientOfExpansionX[j], _coefficientOfExpansionY[i], _emountOfIntervalsX[j], _emountOfIntervalsY[i], resultX, resultY); insertPoints(j, i, _emountOfIntervalsX[j], _emountOfIntervalsY[i], resultX, resultY, x, y); } // Заполним последнюю ячейку для данного слоя по y. // Решил не экономить на этом. /*for (auto j = 0; j < _emountOfIntervalsY[i] + 1; j++) { x[startPosition + j*(_totalNumberOfIntervalsX + 1) + _totalNumberOfIntervalsX] = _referenceNodesX[(i + j)*(_emountOfReferenceNodesX)+_emountOfReferenceNodesX - 1]; y[startPosition + j*(_totalNumberOfIntervalsX + 1) + _totalNumberOfIntervalsX] = _referenceNodesY[(i + j)*(_emountOfReferenceNodesX)+_emountOfReferenceNodesX - 1]; }*/ startPosition += _emountOfIntervalsY[i] * (_totalNumberOfIntervalsX + 1); } std::vector<double> pointsToInsert; int startPosition1 = 0; for (auto i = 0; i < _emountOfLayersZ - 1; i++) { pointsToInsert = processInterval(_layersZ[i], _layersZ[i + 1], _coefficientOfExpansionZ[i], _emountOfIntervalsZ[i] ); for (auto j = 0; j < pointsToInsert.size() - 1; j++) { z[startPosition1 + j] = pointsToInsert[j]; } startPosition1 += _emountOfIntervalsZ[i]; } z[z.size() - 1] = _layersZ[_layersZ.size() - 1]; setMaterials(); setIndexesOfFiniteElementNodes(); getListOfEdges(); getListOfFaces(); }