Asportazioni avanzate volumi virtual milling
This commit is contained in:
+442
-1
@@ -2775,7 +2775,448 @@ GdbExecutor::ExecuteVolZmap( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
//else if ( sCmd2 == "EDGES") {
|
||||
// return ExecuteVolZmapEdges( vsParams) ;
|
||||
//}
|
||||
return false ;
|
||||
///////////////////////////if ( sCmd2 == "ELLCYL") {
|
||||
/////////////////////////// // Parametri: nParentId, nLineId1, nLineId2, ptLine, vtLine, ptCirc, vtAx, dRad, vtSweptVec, nInOut, ptPP1, vtPV1, ptPP2, vtPV2, ptPP3, vtPV3
|
||||
/////////////////////////// if (vsParams.size() != 16)
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// // recupero il riferimento in cui è immerso
|
||||
/////////////////////////// Frame3d frRef;
|
||||
/////////////////////////// if (!m_pGDB->GetGroupGlobFrame(GetIdParam(vsParams[0]), frRef))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// // recupero punto iniziale retta
|
||||
/////////////////////////// Point3d ptLine;
|
||||
/////////////////////////// if (!GetPointParam(vsParams[3], frRef, ptLine))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// // recupero vettore retta
|
||||
/////////////////////////// Vector3d vtLine;
|
||||
/////////////////////////// if (!GetVectorParam(vsParams[4], frRef, vtLine))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// vtLine.Normalize();
|
||||
/////////////////////////// // recupero centro circonferenza
|
||||
/////////////////////////// Point3d ptCirc;
|
||||
/////////////////////////// if (!GetPointParam(vsParams[5], frRef, ptCirc))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// // recupero vettore asse circonferenza
|
||||
/////////////////////////// Vector3d vtAx;
|
||||
/////////////////////////// if (!GetVectorParam(vsParams[6], frRef, vtAx))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// vtAx.Normalize();
|
||||
/////////////////////////// // recupero raggio della circonferenza
|
||||
/////////////////////////// double dRad;
|
||||
/////////////////////////// if (!FromString(vsParams[7], dRad))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// // recupero vettore di traslazione
|
||||
/////////////////////////// Vector3d vtSweptVec;
|
||||
/////////////////////////// if (!GetVectorParam(vsParams[8], frRef, vtSweptVec))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// // intero per recupero flag bInOut
|
||||
/////////////////////////// int nInOut;
|
||||
/////////////////////////// if (!FromString(vsParams[9], nInOut))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// bool bInOut = nInOut == 0 ? false : true;
|
||||
/////////////////////////// // recupero punto piano 1
|
||||
/////////////////////////// Point3d ptPP1;
|
||||
/////////////////////////// if (!GetPointParam(vsParams[10], frRef, ptPP1))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// // recupero vettore piano 1
|
||||
/////////////////////////// Vector3d vtPV1;
|
||||
/////////////////////////// if (!GetVectorParam(vsParams[11], frRef, vtPV1))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// vtPV1.Normalize();
|
||||
/////////////////////////// // recupero punto piano 2
|
||||
/////////////////////////// Point3d ptPP2;
|
||||
/////////////////////////// if (!GetPointParam(vsParams[12], frRef, ptPP2))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// // recupero vettore piano 2
|
||||
/////////////////////////// Vector3d vtPV2;
|
||||
/////////////////////////// if (!GetVectorParam(vsParams[13], frRef, vtPV2))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// vtPV2.Normalize();
|
||||
/////////////////////////// // recupero punto piano 3
|
||||
/////////////////////////// Point3d ptPP3;
|
||||
/////////////////////////// if (!GetPointParam(vsParams[14], frRef, ptPP3))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// // recupero vettore piano 3
|
||||
/////////////////////////// Vector3d vtPV3;
|
||||
/////////////////////////// if (!GetVectorParam(vsParams[15], frRef, vtPV3))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// vtPV3.Normalize();
|
||||
/////////////////////////// // definisco i piani
|
||||
/////////////////////////// Plane3d plPlane1;
|
||||
/////////////////////////// plPlane1.Set(ptPP1, vtPV1);
|
||||
/////////////////////////// Plane3d plPlane2;
|
||||
/////////////////////////// plPlane2.Set(ptPP2, vtPV2);
|
||||
/////////////////////////// Plane3d plPlane3;
|
||||
/////////////////////////// plPlane3.Set(ptPP3, vtPV3);
|
||||
/////////////////////////// vector<Plane3d> vPlanesVec;
|
||||
/////////////////////////// /*vPlanesVec.emplace_back( plPlane1) ;
|
||||
/////////////////////////// vPlanesVec.emplace_back( plPlane2) ;
|
||||
/////////////////////////// vPlanesVec.emplace_back( plPlane3) ;*/
|
||||
/////////////////////////// // Intersezione
|
||||
/////////////////////////// VolZmap MyVol;
|
||||
/////////////////////////// Point3d ptInt1;
|
||||
/////////////////////////// Vector3d vtN1;
|
||||
/////////////////////////// Point3d ptInt2;
|
||||
/////////////////////////// Vector3d vtN2;
|
||||
/////////////////////////// int nSol = MyVol.IntersLineCircSweptSurfCuttedByPlanes(ptLine, vtLine, ptCirc, vtAx, dRad, vtSweptVec, bInOut, vPlanesVec,
|
||||
/////////////////////////// ptInt1, vtN1, ptInt2, vtN2);
|
||||
/////////////////////////// if (nSol == 1) {
|
||||
/////////////////////////// PtrOwner<CurveLine> pLine(CreateBasicCurveLine());
|
||||
/////////////////////////// pLine->Set(ptInt1, ptInt1 + vtN1);
|
||||
/////////////////////////// // inserisco nel DB
|
||||
/////////////////////////// return AddGeoObj(vsParams[1], vsParams[0], Release(pLine));
|
||||
/////////////////////////// }
|
||||
/////////////////////////// else if (nSol == 2) {
|
||||
/////////////////////////// PtrOwner<CurveLine> pLine1(CreateBasicCurveLine());
|
||||
/////////////////////////// pLine1->Set(ptInt1, ptInt1 + vtN1);
|
||||
/////////////////////////// PtrOwner<CurveLine> pLine2(CreateBasicCurveLine());
|
||||
/////////////////////////// pLine2->Set(ptInt2, ptInt2 + vtN2);
|
||||
/////////////////////////// // inserisco nel DB
|
||||
/////////////////////////// return AddGeoObj(vsParams[1], vsParams[0], Release(pLine1)) &&
|
||||
/////////////////////////// AddGeoObj(vsParams[2], vsParams[0], Release(pLine2));
|
||||
/////////////////////////// }
|
||||
///////////////////////////}
|
||||
///////////////////////////else if (sCmd2 == "STDCYL") {
|
||||
/////////////////////////// // Parametri : nParentId, nLineId1, nLineId2, ptLineP, vtLineDir, ptBaseCen, vtAx, dRad, dH, nInOut, ptPP1, vtPV1, ptPP2, vtPV2, ptPP3, vtPV3
|
||||
/////////////////////////// if (vsParams.size() != 16)
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// // recupero il riferimento in cui è immerso
|
||||
/////////////////////////// Frame3d frRef;
|
||||
/////////////////////////// if (!m_pGDB->GetGroupGlobFrame(GetIdParam(vsParams[0]), frRef))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// // recupero punto iniziale retta
|
||||
/////////////////////////// Point3d ptLineP;
|
||||
/////////////////////////// if (!GetPointParam(vsParams[3], frRef, ptLineP))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// // recupero vettore retta
|
||||
/////////////////////////// Vector3d vtLineDir;
|
||||
/////////////////////////// if (!GetVectorParam(vsParams[4], frRef, vtLineDir))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// vtLineDir.Normalize();
|
||||
/////////////////////////// // recupero centro circonferenza
|
||||
/////////////////////////// Point3d ptBaseCen;
|
||||
/////////////////////////// if (!GetPointParam(vsParams[5], frRef, ptBaseCen))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// // recupero vettore asse circonferenza
|
||||
/////////////////////////// Vector3d vtAx;
|
||||
/////////////////////////// if (!GetVectorParam(vsParams[6], frRef, vtAx))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// vtAx.Normalize();
|
||||
/////////////////////////// // recupero raggio della circonferenza
|
||||
/////////////////////////// double dRad;
|
||||
/////////////////////////// if (!FromString(vsParams[7], dRad))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// // recupero raggio della circonferenza
|
||||
/////////////////////////// double dH;
|
||||
/////////////////////////// if (!FromString(vsParams[8], dH))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// // intero per recupero flag bInOut
|
||||
/////////////////////////// int nInOut;
|
||||
/////////////////////////// if (!FromString(vsParams[9], nInOut))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// bool bInOut = nInOut == 0 ? false : true;
|
||||
/////////////////////////// // recupero punto piano 1
|
||||
/////////////////////////// Point3d ptPP1;
|
||||
/////////////////////////// if (!GetPointParam(vsParams[10], frRef, ptPP1))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// // recupero vettore piano 1
|
||||
/////////////////////////// Vector3d vtPV1;
|
||||
/////////////////////////// if (!GetVectorParam(vsParams[11], frRef, vtPV1))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// vtPV1.Normalize();
|
||||
/////////////////////////// // recupero punto piano 2
|
||||
/////////////////////////// Point3d ptPP2;
|
||||
/////////////////////////// if (!GetPointParam(vsParams[12], frRef, ptPP2))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// // recupero vettore piano 2
|
||||
/////////////////////////// Vector3d vtPV2;
|
||||
/////////////////////////// if (!GetVectorParam(vsParams[13], frRef, vtPV2))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// vtPV2.Normalize();
|
||||
/////////////////////////// // recupero punto piano 3
|
||||
/////////////////////////// Point3d ptPP3;
|
||||
/////////////////////////// if (!GetPointParam(vsParams[14], frRef, ptPP3))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// // recupero vettore piano 3
|
||||
/////////////////////////// Vector3d vtPV3;
|
||||
/////////////////////////// if (!GetVectorParam(vsParams[15], frRef, vtPV3))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// vtPV3.Normalize();
|
||||
/////////////////////////// // definisco i piani
|
||||
/////////////////////////// Plane3d plPlane1;
|
||||
/////////////////////////// plPlane1.Set(ptPP1, vtPV1);
|
||||
/////////////////////////// Plane3d plPlane2;
|
||||
/////////////////////////// plPlane2.Set(ptPP2, vtPV2);
|
||||
/////////////////////////// Plane3d plPlane3;
|
||||
/////////////////////////// plPlane3.Set(ptPP3, vtPV3);
|
||||
/////////////////////////// vector<Plane3d> vPlanesVec;
|
||||
/////////////////////////// /*vPlanesVec.emplace_back( plPlane1) ;
|
||||
/////////////////////////// vPlanesVec.emplace_back( plPlane2) ;
|
||||
/////////////////////////// vPlanesVec.emplace_back( plPlane3) ;*/
|
||||
/////////////////////////// // Intersezione
|
||||
/////////////////////////// VolZmap MyVol;
|
||||
/////////////////////////// Point3d ptInt1;
|
||||
/////////////////////////// Vector3d vtN1;
|
||||
/////////////////////////// Point3d ptInt2;
|
||||
/////////////////////////// Vector3d vtN2;
|
||||
/////////////////////////// int nSol = MyVol.IntersLineCylinderCuttedByPlanes(ptLineP, vtLineDir, ptBaseCen, vtAx, dRad, dH, bInOut, vPlanesVec, ptInt1, vtN1, ptInt2, vtN2);
|
||||
/////////////////////////// if (nSol == 1) {
|
||||
/////////////////////////// PtrOwner<CurveLine> pLine(CreateBasicCurveLine());
|
||||
/////////////////////////// pLine->Set(ptInt1, ptInt1 + vtN1);
|
||||
/////////////////////////// // inserisco nel DB
|
||||
/////////////////////////// return AddGeoObj(vsParams[1], vsParams[0], Release(pLine));
|
||||
/////////////////////////// }
|
||||
/////////////////////////// else if (nSol == 2) {
|
||||
/////////////////////////// PtrOwner<CurveLine> pLine1(CreateBasicCurveLine());
|
||||
/////////////////////////// pLine1->Set(ptInt1, ptInt1 + vtN1);
|
||||
/////////////////////////// PtrOwner<CurveLine> pLine2(CreateBasicCurveLine());
|
||||
/////////////////////////// pLine2->Set(ptInt2, ptInt2 + vtN2);
|
||||
/////////////////////////// // inserisco nel DB
|
||||
/////////////////////////// return AddGeoObj(vsParams[1], vsParams[0], Release(pLine1)) &&
|
||||
/////////////////////////// AddGeoObj(vsParams[2], vsParams[0], Release(pLine2));
|
||||
/////////////////////////// }
|
||||
///////////////////////////}
|
||||
///////////////////////////else if ( sCmd2 == "PLANE") {
|
||||
/////////////////////////// // Parametri : nParentId, nLineId, ptLineP, vtLineDir, ptParOrig, vtSeg1, vtSeg2, nExtNorm
|
||||
/////////////////////////// if (vsParams.size() != 8)
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// // recupero il riferimento in cui è immerso
|
||||
/////////////////////////// Frame3d frRef;
|
||||
/////////////////////////// if (!m_pGDB->GetGroupGlobFrame(GetIdParam(vsParams[0]), frRef))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// // recupero punto iniziale retta
|
||||
/////////////////////////// Point3d ptLineP;
|
||||
/////////////////////////// if (!GetPointParam(vsParams[2], frRef, ptLineP))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// // recupero vettore retta
|
||||
/////////////////////////// Vector3d vtLineDir;
|
||||
/////////////////////////// if (!GetVectorParam(vsParams[3], frRef, vtLineDir))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// vtLineDir.Normalize();
|
||||
/////////////////////////// // recupero origine parallelogramma
|
||||
/////////////////////////// Point3d ptParOrig;
|
||||
/////////////////////////// if (!GetPointParam(vsParams[4], frRef, ptParOrig))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// // recupero vettore segmento 1
|
||||
/////////////////////////// Vector3d vtSeg1;
|
||||
/////////////////////////// if (!GetVectorParam(vsParams[5], frRef, vtSeg1))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// // recupero vettore segmento 2
|
||||
/////////////////////////// Vector3d vtSeg2;
|
||||
/////////////////////////// if (!GetVectorParam(vsParams[6], frRef, vtSeg2))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// // intero per recupero flag nExtNorm
|
||||
/////////////////////////// int nExtNorm;
|
||||
/////////////////////////// if (!FromString(vsParams[7], nExtNorm))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// bool bExtNorm = nExtNorm == 0 ? false : true;
|
||||
/////////////////////////// // Intersezione
|
||||
/////////////////////////// VolZmap MyVol;
|
||||
/////////////////////////// Point3d ptInt;
|
||||
/////////////////////////// Vector3d vtN;
|
||||
/////////////////////////// int nSol = MyVol.IntersLineParallelogram( ptLineP, vtLineDir, ptParOrig, vtSeg1, vtSeg2, bExtNorm, ptInt, vtN) ;
|
||||
/////////////////////////// if (nSol == 1) {
|
||||
/////////////////////////// PtrOwner<CurveLine> pLine(CreateBasicCurveLine());
|
||||
/////////////////////////// pLine->Set(ptInt, ptInt + vtN);
|
||||
/////////////////////////// // inserisco nel DB
|
||||
/////////////////////////// return AddGeoObj(vsParams[1], vsParams[0], Release(pLine));
|
||||
/////////////////////////// }
|
||||
///////////////////////////}
|
||||
///////////////////////////else if (sCmd2 == "CONE") {
|
||||
/////////////////////////// // Parametri : nParentId, nLineId1, nLineId2, ptLineP, vtLineDir, ptVert, vtAx, dRad, dH, nInOut, ptPP1, vtPV1, ptPP2, vtPV2, ptPP3, vtPV3
|
||||
/////////////////////////// if (vsParams.size() != 16)
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// // recupero il riferimento in cui è immerso
|
||||
/////////////////////////// Frame3d frRef;
|
||||
/////////////////////////// if (!m_pGDB->GetGroupGlobFrame(GetIdParam(vsParams[0]), frRef))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// // recupero punto iniziale retta
|
||||
/////////////////////////// Point3d ptLineP;
|
||||
/////////////////////////// if (!GetPointParam(vsParams[3], frRef, ptLineP))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// // recupero vettore retta
|
||||
/////////////////////////// Vector3d vtLineDir;
|
||||
/////////////////////////// if (!GetVectorParam(vsParams[4], frRef, vtLineDir))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// vtLineDir.Normalize();
|
||||
/////////////////////////// // recupero vertice cono
|
||||
/////////////////////////// Point3d ptVert;
|
||||
/////////////////////////// if (!GetPointParam(vsParams[5], frRef, ptVert))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// // recupero vettore asse cono
|
||||
/////////////////////////// Vector3d vtAx;
|
||||
/////////////////////////// if (!GetVectorParam(vsParams[6], frRef, vtAx))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// vtAx.Normalize();
|
||||
/////////////////////////// // recupero raggio della base del cono
|
||||
/////////////////////////// double dRad;
|
||||
/////////////////////////// if (!FromString(vsParams[7], dRad))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// // recupero altezza del cono
|
||||
/////////////////////////// double dH;
|
||||
/////////////////////////// if (!FromString(vsParams[8], dH))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// // intero per recupero flag nExtNorm
|
||||
/////////////////////////// int nInOut;
|
||||
/////////////////////////// if (!FromString(vsParams[9], nInOut))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// bool bInOut = nInOut == 0 ? false : true;
|
||||
/////////////////////////// // recupero punto piano 1
|
||||
/////////////////////////// Point3d ptPP1;
|
||||
/////////////////////////// if (!GetPointParam(vsParams[10], frRef, ptPP1))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// // recupero vettore piano 1
|
||||
/////////////////////////// Vector3d vtPV1;
|
||||
/////////////////////////// if (!GetVectorParam(vsParams[11], frRef, vtPV1))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// vtPV1.Normalize();
|
||||
/////////////////////////// // recupero punto piano 2
|
||||
/////////////////////////// Point3d ptPP2;
|
||||
/////////////////////////// if (!GetPointParam(vsParams[12], frRef, ptPP2))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// // recupero vettore piano 2
|
||||
/////////////////////////// Vector3d vtPV2;
|
||||
/////////////////////////// if (!GetVectorParam(vsParams[13], frRef, vtPV2))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// vtPV2.Normalize();
|
||||
/////////////////////////// // recupero punto piano 3
|
||||
/////////////////////////// Point3d ptPP3;
|
||||
/////////////////////////// if (!GetPointParam(vsParams[14], frRef, ptPP3))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// // recupero vettore piano 3
|
||||
/////////////////////////// Vector3d vtPV3;
|
||||
/////////////////////////// if (!GetVectorParam(vsParams[15], frRef, vtPV3))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// vtPV3.Normalize();
|
||||
/////////////////////////// // definisco i piani
|
||||
/////////////////////////// Plane3d plPlane1;
|
||||
/////////////////////////// plPlane1.Set(ptPP1, vtPV1);
|
||||
/////////////////////////// Plane3d plPlane2;
|
||||
/////////////////////////// plPlane2.Set(ptPP2, vtPV2);
|
||||
/////////////////////////// Plane3d plPlane3;
|
||||
/////////////////////////// plPlane3.Set(ptPP3, vtPV3);
|
||||
/////////////////////////// vector<Plane3d> vPlanesVec;
|
||||
/////////////////////////// /*vPlanesVec.emplace_back( plPlane1) ;
|
||||
/////////////////////////// vPlanesVec.emplace_back( plPlane2) ;
|
||||
/////////////////////////// vPlanesVec.emplace_back( plPlane3) ;*/
|
||||
/////////////////////////// // Intersezione
|
||||
/////////////////////////// VolZmap MyVol;
|
||||
/////////////////////////// Point3d ptInt1;
|
||||
/////////////////////////// Vector3d vtN1;
|
||||
/////////////////////////// Point3d ptInt2;
|
||||
/////////////////////////// Vector3d vtN2;
|
||||
/////////////////////////// int nSol = MyVol.IntersLineConeCuttedByPlanes( ptLineP, vtLineDir, ptVert, vtAx, dRad, dH, bInOut, vPlanesVec, ptInt1, vtN1, ptInt2, vtN2);
|
||||
/////////////////////////// if (nSol == 1) {
|
||||
/////////////////////////// PtrOwner<CurveLine> pLine(CreateBasicCurveLine());
|
||||
/////////////////////////// pLine->Set(ptInt1, ptInt1 + vtN1);
|
||||
/////////////////////////// // inserisco nel DB
|
||||
/////////////////////////// return AddGeoObj(vsParams[1], vsParams[0], Release(pLine));
|
||||
/////////////////////////// }
|
||||
/////////////////////////// else if (nSol == 2) {
|
||||
/////////////////////////// PtrOwner<CurveLine> pLine1(CreateBasicCurveLine());
|
||||
/////////////////////////// pLine1->Set(ptInt1, ptInt1 + vtN1);
|
||||
/////////////////////////// PtrOwner<CurveLine> pLine2(CreateBasicCurveLine());
|
||||
/////////////////////////// pLine2->Set(ptInt2, ptInt2 + vtN2);
|
||||
/////////////////////////// // inserisco nel DB
|
||||
/////////////////////////// return AddGeoObj(vsParams[1], vsParams[0], Release(pLine1)) &&
|
||||
/////////////////////////// AddGeoObj(vsParams[2], vsParams[0], Release(pLine2));
|
||||
/////////////////////////// }
|
||||
///////////////////////////}
|
||||
///////////////////////////else if (sCmd2 == "SPHERE") {
|
||||
/////////////////////////// // Parametri: nParentId, nLineId1, nLineId2, ptLineP, vtLineD, ptCen, dRad, nInOut, ptPP1, vtPV1, ptPP2, vtPV2, ptPP3, vtPV3
|
||||
/////////////////////////// if (vsParams.size() != 14)
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// // recupero il riferimento in cui è immerso
|
||||
/////////////////////////// Frame3d frRef;
|
||||
/////////////////////////// if (!m_pGDB->GetGroupGlobFrame(GetIdParam(vsParams[0]), frRef))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// // recupero punto iniziale retta
|
||||
/////////////////////////// Point3d ptLineP;
|
||||
/////////////////////////// if (!GetPointParam(vsParams[3], frRef, ptLineP))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// // recupero vettore retta
|
||||
/////////////////////////// Vector3d vtLineD;
|
||||
/////////////////////////// if (!GetVectorParam(vsParams[4], frRef, vtLineD))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// vtLineD.Normalize();
|
||||
/////////////////////////// // recupero centro sfera
|
||||
/////////////////////////// Point3d ptCen;
|
||||
/////////////////////////// if (!GetPointParam(vsParams[5], frRef, ptCen))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// // recupero raggio della sfera
|
||||
/////////////////////////// double dRad;
|
||||
/////////////////////////// if (!FromString(vsParams[6], dRad))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// // intero per recupero flag nExtNorm
|
||||
/////////////////////////// int nInOut;
|
||||
/////////////////////////// if (!FromString(vsParams[7], nInOut))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// bool bInOut = nInOut == 0 ? false : true;
|
||||
/////////////////////////// // recupero punto piano 1
|
||||
/////////////////////////// Point3d ptPP1;
|
||||
/////////////////////////// if (!GetPointParam(vsParams[8], frRef, ptPP1))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// // recupero vettore piano 1
|
||||
/////////////////////////// Vector3d vtPV1;
|
||||
/////////////////////////// if (!GetVectorParam(vsParams[9], frRef, vtPV1))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// vtPV1.Normalize();
|
||||
/////////////////////////// // recupero punto piano 2
|
||||
/////////////////////////// Point3d ptPP2;
|
||||
/////////////////////////// if (!GetPointParam(vsParams[10], frRef, ptPP2))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// // recupero vettore piano 2
|
||||
/////////////////////////// Vector3d vtPV2;
|
||||
/////////////////////////// if (!GetVectorParam(vsParams[11], frRef, vtPV2))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// vtPV2.Normalize();
|
||||
/////////////////////////// // recupero punto piano 3
|
||||
/////////////////////////// Point3d ptPP3;
|
||||
/////////////////////////// if (!GetPointParam(vsParams[12], frRef, ptPP3))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// // recupero vettore piano 3
|
||||
/////////////////////////// Vector3d vtPV3;
|
||||
/////////////////////////// if (!GetVectorParam(vsParams[13], frRef, vtPV3))
|
||||
/////////////////////////// return false;
|
||||
/////////////////////////// vtPV3.Normalize();
|
||||
/////////////////////////// // definisco i piani
|
||||
/////////////////////////// Plane3d plPlane1;
|
||||
/////////////////////////// plPlane1.Set(ptPP1, vtPV1);
|
||||
/////////////////////////// Plane3d plPlane2;
|
||||
/////////////////////////// plPlane2.Set(ptPP2, vtPV2);
|
||||
/////////////////////////// Plane3d plPlane3;
|
||||
/////////////////////////// plPlane3.Set(ptPP3, vtPV3);
|
||||
/////////////////////////// vector<Plane3d> vPlanesVec;
|
||||
/////////////////////////// /*vPlanesVec.emplace_back( plPlane1) ;
|
||||
/////////////////////////// vPlanesVec.emplace_back( plPlane2) ;
|
||||
/////////////////////////// vPlanesVec.emplace_back( plPlane3) ;*/
|
||||
/////////////////////////// // Intersezione
|
||||
/////////////////////////// VolZmap MyVol;
|
||||
/////////////////////////// Point3d ptInt1;
|
||||
/////////////////////////// Vector3d vtN1;
|
||||
/////////////////////////// Point3d ptInt2;
|
||||
/////////////////////////// Vector3d vtN2;
|
||||
/////////////////////////// int nSol = MyVol.IntersLineSphereCuttedByPlanes(ptLineP, vtLineD, ptCen, dRad, bInOut, vPlanesVec, ptInt1, vtN1, ptInt2, vtN2);
|
||||
/////////////////////////// if (nSol == 1) {
|
||||
/////////////////////////// PtrOwner<CurveLine> pLine(CreateBasicCurveLine());
|
||||
/////////////////////////// pLine->Set(ptInt1, ptInt1 + vtN1);
|
||||
/////////////////////////// // inserisco nel DB
|
||||
/////////////////////////// return AddGeoObj(vsParams[1], vsParams[0], Release(pLine));
|
||||
/////////////////////////// }
|
||||
/////////////////////////// else if (nSol == 2) {
|
||||
/////////////////////////// PtrOwner<CurveLine> pLine1(CreateBasicCurveLine());
|
||||
/////////////////////////// pLine1->Set(ptInt1, ptInt1 + vtN1);
|
||||
/////////////////////////// PtrOwner<CurveLine> pLine2(CreateBasicCurveLine());
|
||||
/////////////////////////// pLine2->Set(ptInt2, ptInt2 + vtN2);
|
||||
/////////////////////////// // inserisco nel DB
|
||||
/////////////////////////// return AddGeoObj(vsParams[1], vsParams[0], Release(pLine1)) &&
|
||||
/////////////////////////// AddGeoObj(vsParams[2], vsParams[0], Release(pLine2));
|
||||
/////////////////////////// }
|
||||
///////////////////////////}
|
||||
///////////////////////////else
|
||||
/////////////////////////// return false ;
|
||||
///////////////////////////return true ;
|
||||
return true;
|
||||
}
|
||||
/*
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
+43
-43
@@ -495,7 +495,7 @@ SurfTriMesh::GeneralizedCut( const ICurve& cvCurve, bool bSaveOnEq)
|
||||
vPL.emplace_back( plInLoop) ;
|
||||
PNTVECTOR vPt ;
|
||||
INTVECTOR vTr ;
|
||||
if ( Triangulate().Make( vPL, vPt, vTr, TrgType::TRG_DEL_QUALITY)) {
|
||||
if ( Triangulate().Make( vPL, vPt, vTr, TrgType::TRG_STANDARD)) {
|
||||
// Inserisco i nuovi triangoli
|
||||
for ( int n = 0 ; n < int( vTr.size()) - 2 ; n += 3) {
|
||||
int nNewTriaVertId[3] = { vTr[n], vTr[n + 1], vTr[n + 2] } ;
|
||||
@@ -711,7 +711,7 @@ SurfTriMesh::GeneralizedCut( const ICurve& cvCurve, bool bSaveOnEq)
|
||||
Triangulate CreateTriangulation ;
|
||||
PNTVECTOR vPt ;
|
||||
INTVECTOR vTr ;
|
||||
if ( Triangulate().Make( vplPolyVec[nLoop], vPt, vTr, TrgType::TRG_DEL_QUALITY)) {
|
||||
if ( Triangulate().Make( vplPolyVec[nLoop], vPt, vTr, TrgType::TRG_STANDARD)) {
|
||||
// Inserisco i nuovi triangoli
|
||||
for ( int n = 0 ; n < int( vTr.size()) - 2 ; n += 3) {
|
||||
int nNewTriaVertId[3] = { vTr[n], vTr[n + 1], vTr[n + 2] } ;
|
||||
@@ -1350,7 +1350,7 @@ SurfTriMesh::RetriangulationForBooleanOperation( CHAINMAP& LoopLines, TRIA3DVECT
|
||||
// Eseguo triangolazione
|
||||
PNTVECTOR vPt ;
|
||||
INTVECTOR vTr ;
|
||||
if ( Triangulate().Make( vplPolyVec[nLoop], vPt, vTr, TrgType::TRG_DEL_QUALITY)) {
|
||||
if ( Triangulate().Make( vplPolyVec[nLoop], vPt, vTr, TrgType::TRG_STANDARD)) {
|
||||
// Inserisco i nuovi triangoli
|
||||
for ( int n = 0 ; n < int( vTr.size()) - 2 ; n += 3) {
|
||||
int nNewTriaVertId[3] = { vTr[n], vTr[n + 1], vTr[n + 2] } ;
|
||||
@@ -1446,7 +1446,7 @@ SurfTriMesh::RetriangulationForBooleanOperation( CHAINMAP& LoopLines, TRIA3DVECT
|
||||
|
||||
PNTVECTOR vPt ;
|
||||
INTVECTOR vTr ;
|
||||
if ( Triangulate().Make( vPolygons, vPt, vTr, TrgType::TRG_DEL_QUALITY)) {
|
||||
if ( Triangulate().Make( vPolygons, vPt, vTr, TrgType::TRG_STANDARD)) {
|
||||
// Inserisco i nuovi triangoli
|
||||
for ( int n = 0 ; n < int( vTr.size()) - 2 ; n += 3) {
|
||||
int nNewTriaVertId[3] = { vTr[n], vTr[n + 1], vTr[n + 2]} ;
|
||||
@@ -1582,7 +1582,7 @@ SurfTriMesh::RetriangulationForBooleanOperation( CHAINMAP& LoopLines, TRIA3DVECT
|
||||
}
|
||||
for ( int nL = 1 ; nL < int( vPolygons.size()) ; ++ nL) {
|
||||
vPolygons[nL].Invert() ;
|
||||
if ( Triangulate().Make( vPolygons[nL], vPt, vTr, TrgType::TRG_DEL_QUALITY)) {
|
||||
if ( Triangulate().Make( vPolygons[nL], vPt, vTr, TrgType::TRG_STANDARD)) {
|
||||
// Inserisco i nuovi triangoli
|
||||
for (int n = 0 ; n < int( vTr.size()) - 2 ; n += 3) {
|
||||
int nNewTriaVertId[3] = { vTr[n], vTr[n + 1], vTr[n + 2]} ;
|
||||
@@ -1949,6 +1949,7 @@ SurfTriMesh::IntersectTriMeshTriangle( SurfTriMesh& Other)
|
||||
if ( nTriaNum >= 0) {
|
||||
Triangle3d trTriaB ;
|
||||
SurfB.GetTriangle( nTriaNum, trTriaB) ;
|
||||
trTriaB.Validate();
|
||||
if ( ( ptFirstV - trTriaB.GetP(0)) * trTriaB.GetN() < - EPS_SMALL)
|
||||
nInOutNum = 1 ;
|
||||
else if ( ( ptFirstV - trTriaB.GetP(0)) * trTriaB.GetN() > EPS_SMALL)
|
||||
@@ -1985,6 +1986,7 @@ SurfTriMesh::IntersectTriMeshTriangle( SurfTriMesh& Other)
|
||||
if ( nTriaNum >= 0) {
|
||||
Triangle3d trTriaA ;
|
||||
GetTriangle( nTriaNum, trTriaA) ;
|
||||
trTriaA.Validate();
|
||||
if ( ( ptFirstV - trTriaA.GetP( 0)) * trTriaA.GetN() < - EPS_SMALL) {
|
||||
nInOutNum = 1 ;
|
||||
}
|
||||
@@ -2997,7 +2999,7 @@ TrimLineWithExtPolygon( const CurveLine& cvLine, const POLYLINEVECTOR& vContourV
|
||||
// Definisco le parti di linea dentro il poligono esteso.
|
||||
bool bStateInside = true ;
|
||||
for ( int nC = 0 ; nC < int( vMyContourVec.size()) ; ++ nC) {
|
||||
bStateInside = bStateInside && IsPointInsidePolyLine( cvMyLine.GetStart(), vMyContourVec[nC]) ;
|
||||
bStateInside = bStateInside && vMyContourVec[nC].IsPointInsidePolyLine( cvMyLine.GetStart()) ;
|
||||
}
|
||||
if ( bStateInside)
|
||||
vLinePart.emplace_back( 0, -1, LCP_ERROR) ;
|
||||
@@ -3082,7 +3084,7 @@ DistPointFacet( const Point3d& ptP, /*const*/ POLYLINEVECTOR& vPolyVec, double&
|
||||
dPointPlaneSignedDist = ( ptP - ptPlaneP) * vtPlaneN ;
|
||||
ptProjP = ptP + dPointPlaneSignedDist * vtPlaneN ;
|
||||
}
|
||||
if ( ! IsPointInsidePolyLine( ptProjP, vPolyVec[nLoop]))
|
||||
if ( ! vPolyVec[nLoop].IsPointInsidePolyLine( ptProjP))
|
||||
bPointIsInside = false ;
|
||||
}
|
||||
// Se la proiezione del punto sul piano della faccia � interno, ho finito.
|
||||
@@ -3096,7 +3098,7 @@ DistPointFacet( const Point3d& ptP, /*const*/ POLYLINEVECTOR& vPolyVec, double&
|
||||
dPointFacetDist = DBL_MAX ;
|
||||
for ( int nLoop = 0 ; nLoop < int( vPolyVec.size()) ; ++ nLoop) {
|
||||
double dDist ;
|
||||
if ( DistPointPolyLine( ptP, vPolyVec[nLoop], dDist) && dDist < dPointFacetDist)
|
||||
if ( vPolyVec[nLoop].DistPointPolyLine( ptP, dDist) && dDist < dPointFacetDist)
|
||||
dPointFacetDist = dDist ;
|
||||
}
|
||||
return true ;
|
||||
@@ -3212,14 +3214,14 @@ SurfTriMesh::SplitFacet( const INTERSCHAINMAP& IntersLineMap, PieceMap& NewFacet
|
||||
for ( int nLoop = 0 ; nLoop < int( vNewPieces[nPart].vPieceLoop.size()) && int( vLoopIndexes.size()) < 2 ; ++ nLoop) {
|
||||
int nSegNum ;
|
||||
double dParOnSeg ;
|
||||
if ( PointPositionOnPolyLine( cvOpenChain[nLastChainNum][0].ptSt, vNewPieces[nPart].vPieceLoop[nLoop], nSegNum, dParOnSeg, 9 * EPS_SMALL)) {
|
||||
if ( vNewPieces[nPart].vPieceLoop[nLoop].PointPositionOnPolyLine( cvOpenChain[nLastChainNum][0].ptSt, nSegNum, dParOnSeg, 9 * EPS_SMALL)) {
|
||||
vLoopIndexes.emplace_back( nLoop) ;
|
||||
if ( vLoopIndexes.size() > 1) {
|
||||
swap( vLoopIndexes[0], vLoopIndexes[1]) ;
|
||||
}
|
||||
}
|
||||
if ( PointPositionOnPolyLine( cvOpenChain[nLastChainNum][cvOpenChain[nLastChainNum].size() - 1].ptEn,
|
||||
vNewPieces[nPart].vPieceLoop[nLoop], nSegNum, dParOnSeg, 9 * EPS_SMALL)) {
|
||||
if ( vNewPieces[nPart].vPieceLoop[nLoop].PointPositionOnPolyLine( cvOpenChain[nLastChainNum][cvOpenChain[nLastChainNum].size() - 1].ptEn,
|
||||
nSegNum, dParOnSeg, 9 * EPS_SMALL)) {
|
||||
vLoopIndexes.emplace_back( nLoop) ;
|
||||
}
|
||||
}
|
||||
@@ -3229,7 +3231,7 @@ SurfTriMesh::SplitFacet( const INTERSCHAINMAP& IntersLineMap, PieceMap& NewFacet
|
||||
// La catena finisce sul loop ove inizia. Divido la nuova parte.
|
||||
if ( vLoopIndexes[0] == vLoopIndexes[1]) {
|
||||
// Cambio inizio al loop iniziale.
|
||||
ChangePolyLineStart( cvOpenChain[nLastChainNum].back().ptEn, vNewPieces[nPart].vPieceLoop[vLoopIndexes[0]], 9 * EPS_SMALL) ;
|
||||
vNewPieces[nPart].vPieceLoop[vLoopIndexes[0]].ChangePolyLineStart( cvOpenChain[nLastChainNum].back().ptEn, 9 * EPS_SMALL) ;
|
||||
// Divido il loop della parte
|
||||
// Loop1
|
||||
PolyLine NewLoop1 ;
|
||||
@@ -3241,14 +3243,13 @@ SurfTriMesh::SplitFacet( const INTERSCHAINMAP& IntersLineMap, PieceMap& NewFacet
|
||||
}
|
||||
// Spezzo il loop successivo alla catena nel punto in cui comincia la catena successiva.
|
||||
PolyLine SplitLoop1, SplitLoop2 ;
|
||||
SplitPolyLineAtPoint( cvOpenChain[nLastChainNum][0].ptSt,
|
||||
vNewPieces[nPart].vPieceLoop[vLoopIndexes[0]],
|
||||
SplitLoop1, SplitLoop2, 9 * EPS_SMALL) ;
|
||||
vNewPieces[nPart].vPieceLoop[vLoopIndexes[0]].SplitPolyLineAtPoint( cvOpenChain[nLastChainNum][0].ptSt,
|
||||
SplitLoop1, SplitLoop2, 9 * EPS_SMALL) ;
|
||||
// Aggiungo i punti precedenti il punto di frattura nella in NewLoop1.
|
||||
AddPolyLineToPolyLine( NewLoop1, SplitLoop1, 10 * EPS_SMALL) ;
|
||||
NewLoop1.AddPolyLineToPolyLine( SplitLoop1, 10 * EPS_SMALL) ;
|
||||
// Loop2
|
||||
PolyLine NewLoop2 ;
|
||||
AddPolyLineToPolyLine( NewLoop2, SplitLoop2, 10 * EPS_SMALL) ;
|
||||
NewLoop2.AddPolyLineToPolyLine( SplitLoop2, 10 * EPS_SMALL) ;
|
||||
// Inserisco i punti della catena nella PolyLine del nuovo loop.
|
||||
for ( int m = int( cvOpenChain[nLastChainNum].size()) - 1 ; m >= 0 ; -- m) {
|
||||
NewLoop2.AddUPoint( 0., cvOpenChain[nLastChainNum][m].ptEn) ;
|
||||
@@ -3270,7 +3271,7 @@ SurfTriMesh::SplitFacet( const INTERSCHAINMAP& IntersLineMap, PieceMap& NewFacet
|
||||
Point3d ptPointInnerLoop ;
|
||||
vNewPieces[nPart].vPieceLoop[nIL].GetFirstPoint( ptPointInnerLoop) ;
|
||||
if ( PieceInn.vPieceLoop[0].GetPointNbr() < PieceOut.vPieceLoop[0].GetPointNbr()) {
|
||||
if ( IsPointInsidePolyLine( ptPointInnerLoop, PieceInn.vPieceLoop[0])) {
|
||||
if ( PieceInn.vPieceLoop[0].IsPointInsidePolyLine( ptPointInnerLoop)) {
|
||||
PieceInn.vPieceLoop.emplace_back( vNewPieces[nPart].vPieceLoop[nIL]) ;
|
||||
}
|
||||
else {
|
||||
@@ -3278,7 +3279,7 @@ SurfTriMesh::SplitFacet( const INTERSCHAINMAP& IntersLineMap, PieceMap& NewFacet
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( IsPointInsidePolyLine( ptPointInnerLoop, PieceOut.vPieceLoop[0])) {
|
||||
if ( PieceOut.vPieceLoop[0].IsPointInsidePolyLine( ptPointInnerLoop)) {
|
||||
PieceOut.vPieceLoop.emplace_back( vNewPieces[nPart].vPieceLoop[nIL]) ;
|
||||
}
|
||||
else {
|
||||
@@ -3320,7 +3321,7 @@ SurfTriMesh::SplitFacet( const INTERSCHAINMAP& IntersLineMap, PieceMap& NewFacet
|
||||
continue ;
|
||||
Point3d ptPointInnerLoop ;
|
||||
vNewPieces[nPart].vPieceLoop[nIL].GetFirstPoint( ptPointInnerLoop) ;
|
||||
if ( IsPointInsidePolyLine( ptPointInnerLoop, DetachedPiece.vPieceLoop[0])) {
|
||||
if ( DetachedPiece.vPieceLoop[0].IsPointInsidePolyLine( ptPointInnerLoop)) {
|
||||
DetachedPiece.vPieceLoop.emplace_back( vNewPieces[nPart].vPieceLoop[nIL]) ;
|
||||
vNewPieces[nPart].vPieceLoop.erase( vNewPieces[nPart].vPieceLoop.begin() + nIL) ;
|
||||
// Cambio il numero dei loop talgiati
|
||||
@@ -3350,14 +3351,14 @@ SurfTriMesh::SplitFacet( const INTERSCHAINMAP& IntersLineMap, PieceMap& NewFacet
|
||||
int nIter = 0 ;
|
||||
while ( vLoopIndexes.back() != vLoopIndexes[0] && nIter == 0) {
|
||||
// Cambio inizio del loop corrente in modo che il punto di inizio sia il punto finale dell'ultima catena trovata.
|
||||
ChangePolyLineStart( cvOpenChain[vChainIndex.back()].back().ptEn, vNewPieces[nPart].vPieceLoop[vLoopIndexes.back()], 9 * EPS_SMALL) ;
|
||||
vNewPieces[nPart].vPieceLoop[vLoopIndexes.back()].ChangePolyLineStart( cvOpenChain[vChainIndex.back()].back().ptEn, 9 * EPS_SMALL) ;
|
||||
// Cerco catene che iniziano sul loop coorente
|
||||
vector<PositionOnPolyLine> vChainStartingOnLoop ;
|
||||
for ( int nCh = 0 ; nCh < nLastChainNum ; ++ nCh) {
|
||||
int nSegNum ;
|
||||
double dParOnSeg ;
|
||||
if ( PointPositionOnPolyLine( cvOpenChain[nCh][0].ptSt, vNewPieces[nPart].vPieceLoop[vLoopIndexes.back()], nSegNum, dParOnSeg, 9 * EPS_SMALL)) {
|
||||
vChainStartingOnLoop.emplace_back( PositionOnPolyLine(nCh, nSegNum, dParOnSeg)) ;
|
||||
if ( vNewPieces[nPart].vPieceLoop[vLoopIndexes.back()].PointPositionOnPolyLine( cvOpenChain[nCh][0].ptSt, nSegNum, dParOnSeg, 9 * EPS_SMALL)) {
|
||||
vChainStartingOnLoop.emplace_back( PositionOnPolyLine(nCh, nSegNum, dParOnSeg)) ;
|
||||
}
|
||||
}
|
||||
// Ordino le catene secondo la vicinanza lungo il loop del loro punto d'inizio al punto d'inizio del loop stesso.
|
||||
@@ -3386,7 +3387,7 @@ SurfTriMesh::SplitFacet( const INTERSCHAINMAP& IntersLineMap, PieceMap& NewFacet
|
||||
double dParOnSeg ;
|
||||
// La catena termina su questo loop diverso da quello corrente.
|
||||
if ( nLoop != vLoopIndexes.back() &&
|
||||
PointPositionOnPolyLine( cvOpenChain[nCh][nLastLineIndex].ptEn, vNewPieces[nPart].vPieceLoop[nLoop], nSegNum, dParOnSeg, 9 * EPS_SMALL)) {
|
||||
vNewPieces[nPart].vPieceLoop[nLoop].PointPositionOnPolyLine( cvOpenChain[nCh][nLastLineIndex].ptEn, nSegNum, dParOnSeg, 9 * EPS_SMALL)) {
|
||||
nIter = 0 ;
|
||||
// Salvo l'indice della catena e quello del loop.
|
||||
vChainIndex.emplace_back( nCh) ;
|
||||
@@ -3400,7 +3401,7 @@ SurfTriMesh::SplitFacet( const INTERSCHAINMAP& IntersLineMap, PieceMap& NewFacet
|
||||
}
|
||||
}
|
||||
// Cambio inizio al loop iniziale.
|
||||
ChangePolyLineStart( cvOpenChain[vChainIndex.back()].back().ptEn, vNewPieces[nPart].vPieceLoop[vLoopIndexes[0]], 9 * EPS_SMALL) ;
|
||||
vNewPieces[nPart].vPieceLoop[vLoopIndexes[0]].ChangePolyLineStart( cvOpenChain[vChainIndex.back()].back().ptEn, 9 * EPS_SMALL) ;
|
||||
// Divido i loop della parte.
|
||||
POLYLINEVECTOR vPolySecondPartVec ;
|
||||
PolyLine NewLoop1 ;
|
||||
@@ -3413,18 +3414,17 @@ SurfTriMesh::SplitFacet( const INTERSCHAINMAP& IntersLineMap, PieceMap& NewFacet
|
||||
}
|
||||
// Spezzo il loop successivo alla catena nel punto in cui comincia la catena successiva.
|
||||
PolyLine SplitLoop1, SplitLoop2 ;
|
||||
SplitPolyLineAtPoint( cvOpenChain[vChainIndex[( n + 1) % int( vChainIndex.size())]][0].ptSt,
|
||||
vNewPieces[nPart].vPieceLoop[vLoopIndexes[n + 1]],
|
||||
SplitLoop1, SplitLoop2, 9 * EPS_SMALL) ;
|
||||
vNewPieces[nPart].vPieceLoop[vLoopIndexes[n + 1]].SplitPolyLineAtPoint( cvOpenChain[vChainIndex[( n + 1) % int( vChainIndex.size())]][0].ptSt,
|
||||
SplitLoop1, SplitLoop2, 9 * EPS_SMALL) ;
|
||||
// Aggiungo i punti precedenti il punto di frattura in NewLoop1.
|
||||
AddPolyLineToPolyLine( NewLoop1, SplitLoop1, 10 * EPS_SMALL) ;
|
||||
NewLoop1.AddPolyLineToPolyLine( SplitLoop1, 10 * EPS_SMALL) ;
|
||||
// Salvo la parte dopo il punto di frattura in un apposito vettore.
|
||||
vPolySecondPartVec.emplace_back( SplitLoop2) ;
|
||||
}
|
||||
PolyLine NewLoop2 ;
|
||||
for ( int n = int( vChainIndex.size()) - 1 ; n >= 0 ; -- n) {
|
||||
// Aggiungo i punti successivi il punto di frattura in NewLoop2.
|
||||
AddPolyLineToPolyLine( NewLoop2, vPolySecondPartVec[n], 10 * EPS_SMALL) ;
|
||||
NewLoop2.AddPolyLineToPolyLine( vPolySecondPartVec[n], 10 * EPS_SMALL) ;
|
||||
// Inserisco i punti della catena nella PolyLine del nuovo loop.
|
||||
for ( int m = int( cvOpenChain[vChainIndex[n]].size()) - 1 ; m >= 0 ; -- m) {
|
||||
NewLoop2.AddUPoint( 0., cvOpenChain[vChainIndex[n]][m].ptEn) ;
|
||||
@@ -3460,7 +3460,7 @@ SurfTriMesh::SplitFacet( const INTERSCHAINMAP& IntersLineMap, PieceMap& NewFacet
|
||||
Point3d ptPointInnerLoop ;
|
||||
vNewPieces[nPart].vPieceLoop[nIL].GetFirstPoint( ptPointInnerLoop) ;
|
||||
if ( PieceInn.vPieceLoop[0].GetPointNbr() < PieceOut.vPieceLoop[0].GetPointNbr()) {
|
||||
if ( IsPointInsidePolyLine( ptPointInnerLoop, PieceInn.vPieceLoop[0])) {
|
||||
if ( PieceInn.vPieceLoop[0].IsPointInsidePolyLine( ptPointInnerLoop)) {
|
||||
PieceInn.vPieceLoop.emplace_back( vNewPieces[nPart].vPieceLoop[nIL]) ;
|
||||
}
|
||||
else {
|
||||
@@ -3468,7 +3468,7 @@ SurfTriMesh::SplitFacet( const INTERSCHAINMAP& IntersLineMap, PieceMap& NewFacet
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( IsPointInsidePolyLine( ptPointInnerLoop, PieceOut.vPieceLoop[0])) {
|
||||
if ( PieceOut.vPieceLoop[0].IsPointInsidePolyLine( ptPointInnerLoop)) {
|
||||
PieceOut.vPieceLoop.emplace_back( vNewPieces[nPart].vPieceLoop[nIL]) ;
|
||||
}
|
||||
else {
|
||||
@@ -3545,7 +3545,7 @@ SurfTriMesh::SplitFacet( const INTERSCHAINMAP& IntersLineMap, PieceMap& NewFacet
|
||||
continue ;
|
||||
Point3d ptPointInnerLoop ;
|
||||
vNewPieces[nPart].vPieceLoop[nIL].GetFirstPoint( ptPointInnerLoop) ;
|
||||
if ( IsPointInsidePolyLine( ptPointInnerLoop, DetachedPiece.vPieceLoop[0])) {
|
||||
if ( DetachedPiece.vPieceLoop[0].IsPointInsidePolyLine( ptPointInnerLoop)) {
|
||||
DetachedPiece.vPieceLoop.emplace_back( vNewPieces[nPart].vPieceLoop[nIL]) ;
|
||||
vNewPieces[nPart].vPieceLoop.erase( vNewPieces[nPart].vPieceLoop.begin() + nIL) ;
|
||||
// Cambio il numero dei loop talgiati
|
||||
@@ -3604,8 +3604,8 @@ SurfTriMesh::SplitFacet( const INTERSCHAINMAP& IntersLineMap, PieceMap& NewFacet
|
||||
++ itInnNext ;
|
||||
if ( itInnNext != LoopList.end())
|
||||
ptInnNextP = itInnNext->first ;
|
||||
if ( IsPointInsidePolyLine( ptInnP, vNewPieces[nPieceN].vPieceLoop[0]) || ( itInnNext != LoopList.end() &&
|
||||
IsPointInsidePolyLine( 0.5 * ( ptInnP + ptInnNextP), vNewPieces[nPieceN].vPieceLoop[0]))) {
|
||||
if ( vNewPieces[nPieceN].vPieceLoop[0].IsPointInsidePolyLine( ptInnP) || ( itInnNext != LoopList.end() &&
|
||||
vNewPieces[nPieceN].vPieceLoop[0].IsPointInsidePolyLine( 0.5 * ( ptInnP + ptInnNextP)))) {
|
||||
double dPieceArea ;
|
||||
vNewPieces[nPieceN].vPieceLoop[0].IsClosedAndFlat( Plane3d(), dPieceArea) ;
|
||||
if ( vNewPieces[nPieceN].vPieceLoop[0].IsClosedAndFlat( Plane3d(), dPieceArea) && dPieceArea < dIncluderPieceArea) {
|
||||
@@ -3634,7 +3634,7 @@ SurfTriMesh::SplitFacet( const INTERSCHAINMAP& IntersLineMap, PieceMap& NewFacet
|
||||
PNTULIST& SecLevLoopList = vNewPieces[nIncluderPiece].vPieceLoop[nSI].GetUPointList() ;
|
||||
for ( auto itSL = SecLevLoopList.begin() ; itSL != SecLevLoopList.end() ; ++ itSL) {
|
||||
Point3d ptPntSL = itSL->first ;
|
||||
if ( IsPointInsidePolyLine( ptPntSL, vNewPieces.back().vPieceLoop.back())) {
|
||||
if ( vNewPieces.back().vPieceLoop.back().IsPointInsidePolyLine( ptPntSL)) {
|
||||
vSecondLevel.emplace_back( nSI) ;
|
||||
break ;
|
||||
}
|
||||
@@ -3661,7 +3661,7 @@ SurfTriMesh::SplitFacet( const INTERSCHAINMAP& IntersLineMap, PieceMap& NewFacet
|
||||
PNTULIST& SecLevLoopList = vNewPieces[nIncluderPiece].vPieceLoop[nSI].GetUPointList() ;
|
||||
for ( auto itSL = SecLevLoopList.begin() ; itSL != SecLevLoopList.end() ; ++ itSL) {
|
||||
Point3d ptPntSL = itSL->first ;
|
||||
if ( IsPointInsidePolyLine( ptPntSL, vNewPieces.back().vPieceLoop.back())) {
|
||||
if ( vNewPieces.back().vPieceLoop.back().IsPointInsidePolyLine( ptPntSL)) {
|
||||
vSecondLevel.emplace_back( nSI) ;
|
||||
break ;
|
||||
}
|
||||
@@ -4208,8 +4208,8 @@ SplitPolyLineContour( const POLYLINEVECTOR& vContourVec, POLYLINEVECTOR& vContou
|
||||
AuxPoly.AddUPoint( 0, vPointsVec[nP]) ;
|
||||
// Cambio origine al contorno e lo divido.
|
||||
vContourVec1.emplace_back() ; vContourVec2.emplace_back() ;
|
||||
if ( ChangePolyLineStart( vPointsVec[nSplitI], AuxPoly, 9 * EPS_SMALL) &&
|
||||
SplitPolyLineAtPoint( vPointsVec[nSplitJ], AuxPoly, vContourVec1[0], vContourVec2[0], 9 * EPS_SMALL)) {
|
||||
if ( AuxPoly.ChangePolyLineStart( vPointsVec[nSplitI], 9 * EPS_SMALL) &&
|
||||
AuxPoly.SplitPolyLineAtPoint( vPointsVec[nSplitJ], vContourVec1[0], vContourVec2[0], 9 * EPS_SMALL)) {
|
||||
// Chiudo i contorni.
|
||||
vContourVec1[0].AddUPoint( 0, vPointsVec[nSplitI]) ;
|
||||
vContourVec2[0].AddUPoint( 0, vPointsVec[nSplitJ]) ;
|
||||
@@ -4218,7 +4218,7 @@ SplitPolyLineContour( const POLYLINEVECTOR& vContourVec, POLYLINEVECTOR& vContou
|
||||
const PNTULIST& InnContourList = MyPolyVecRef[nC].GetUPointList() ;
|
||||
for ( auto it = InnContourList.begin() ; it != InnContourList.end() ; ++ it) {
|
||||
if ( vContourVec1[0].GetPointNbr() < vContourVec2[0].GetPointNbr()) {
|
||||
if ( IsPointInsidePolyLine( it->first, vContourVec1[0])) {
|
||||
if ( vContourVec1[0].IsPointInsidePolyLine( it->first)) {
|
||||
vContourVec1.emplace_back( vContourVec[nC]) ;
|
||||
break ;
|
||||
}
|
||||
@@ -4228,7 +4228,7 @@ SplitPolyLineContour( const POLYLINEVECTOR& vContourVec, POLYLINEVECTOR& vContou
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( IsPointInsidePolyLine( it->first, vContourVec2[0])) {
|
||||
if ( vContourVec2[0].IsPointInsidePolyLine( it->first)) {
|
||||
vContourVec2.emplace_back( vContourVec[nC]) ;
|
||||
break ;
|
||||
}
|
||||
@@ -4270,7 +4270,7 @@ SurfTriMesh::RetriangulateFacetPieces( const PieceMap& NewFacet,
|
||||
for ( int nPart = 0 ; nPart < nPartNum ; ++ nPart) {
|
||||
PNTVECTOR vPt ;
|
||||
INTVECTOR vTr ;
|
||||
if ( Triangulate().Make( PiecesVector[nPart].vPieceLoop, vPt, vTr, TrgType::TRG_DEL_QUALITY)) {
|
||||
if ( Triangulate().Make( PiecesVector[nPart].vPieceLoop, vPt, vTr, TrgType::TRG_STANDARD)) {
|
||||
// Inserisco i nuovi triangoli
|
||||
for ( int n = 0 ; n < int( vTr.size()) - 2 ; n += 3) {
|
||||
int nNewTriaVertId[3] = { vTr[n], vTr[n + 1], vTr[n + 2]} ;
|
||||
@@ -4362,7 +4362,7 @@ SurfTriMesh::RetriangulateFacetPieces( const PieceMap& NewFacet,
|
||||
bool bContinue = SplitPolyLineContour( PiecesVector[nPart].vPieceLoop, vSubPieceLoop[0], vSubPieceLoop[1]) ;
|
||||
while ( bContinue) {
|
||||
for ( int nSub = 0 ; nSub < int( vSubPieceLoop.size()) ; ++ nSub) {
|
||||
if (Triangulate().Make(vSubPieceLoop[nSub], vPt, vTr, TrgType::TRG_DEL_QUALITY)) {
|
||||
if (Triangulate().Make(vSubPieceLoop[nSub], vPt, vTr, TrgType::TRG_STANDARD)) {
|
||||
// Inserisco i nuovi triangoli
|
||||
for (int n = 0; n < int(vTr.size()) - 2; n += 3) {
|
||||
int nNewTriaVertId[3] = { vTr[n], vTr[n + 1], vTr[n + 2] };
|
||||
|
||||
@@ -29,7 +29,7 @@ using namespace std ;
|
||||
Tool::Tool( bool bApproxWithLines)
|
||||
: m_dLinTol( LIN_TOL_STD), m_dAngTolDeg( ANG_TOL_APPROX_DEG), m_nType( UNDEF), m_nCurrentNum( 0), m_dHeight( 0), m_dTipHeight( 0),
|
||||
m_dRadius( 0), m_dRCorner( 0), m_dTipRadius( 0), m_dRefRadius( 0), m_dCutterHeight( 0), m_dMrtChsWidth( 0), m_dMrtChsThickness( 0),
|
||||
m_bApproxWithLines( bApproxWithLines)
|
||||
m_bAllPartCut( true), m_bApproxWithLines( bApproxWithLines)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -77,6 +77,7 @@ class Tool
|
||||
|
||||
private :
|
||||
bool m_bApproxWithLines ;
|
||||
bool m_bAllPartCut ;
|
||||
double m_dLinTol ;
|
||||
double m_dAngTolDeg ;
|
||||
std::string m_sName ;
|
||||
|
||||
@@ -302,6 +302,21 @@ class VolZmap : public IVolZmap, public IGeoObjRW
|
||||
inline bool TestParaBBox( int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtD, const Vector3d& vtA,
|
||||
double dLenX, double dLenY, double dLenZ,
|
||||
int& nStI, int& nStJ, int& nEnI, int& nEnJ) ;
|
||||
|
||||
// Asportazioni superfici elementari vuote
|
||||
/*bool SurfCyl_ZDrilling( int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir,
|
||||
double dHei, double dRad, bool bTapB, bool bTapT) ;
|
||||
bool SurfCyl_Drilling( int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir,
|
||||
double dHei, double dRad, bool bTapB, bool bTapT) ;*/
|
||||
bool SurfCyl_ZMilling( int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir,
|
||||
double dHei, double dRad, bool bOuterCutter, bool bTapB, bool bTapT) ;
|
||||
bool SurfCyl_Milling( int nGrid, const Point3d& ptS, const Point3d& ptE,
|
||||
const Vector3d& vtToolDir, double dHei, double dRad, bool bTapB, bool bTapT) ;
|
||||
bool SurfConus_ZDrilling( int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir, double dHei, double dMaxRad, double dMinRad,
|
||||
const Vector3d& vtArcNormMaxR, const Vector3d& vtArcNormMinR) ;
|
||||
bool SurfConus_ZMilling( int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir, double dHei, double dMaxRad, double dMinRad,
|
||||
const Vector3d& vtArcNormMaxR, const Vector3d& vtArcNormMinR) ;
|
||||
|
||||
// Intersezioni
|
||||
bool IntersLineBox( const Point3d& ptP, const Vector3d& vtV, const Point3d& ptMin, const Point3d& ptMax) const ;
|
||||
bool IntersLineBox( const Point3d& ptP, const Vector3d& vtV, const Point3d& ptMin, const Point3d& ptMax,
|
||||
@@ -331,6 +346,30 @@ class VolZmap : public IVolZmap, public IGeoObjRW
|
||||
const Frame3d& frTruncPyramFrame, double dSegMin, double dSegMax, double dHeight,
|
||||
Point3d& ptInt1, Vector3d& vtN1, Point3d& ptInt2, Vector3d& vtN2) const ;
|
||||
bool TestIntersPlaneZmapBBox( const Plane3d& plPlane) const ;
|
||||
// Intersezioni 2
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/*public:*/
|
||||
int IntersLineParallelogram( const Point3d& ptLineP, const Vector3d& vtLineDir,
|
||||
const Point3d& ptParOrig, const Vector3d& vtSeg1, const Vector3d& vtSeg2,
|
||||
bool bExtNorm, Point3d& ptInt, Vector3d& vtN) const ;
|
||||
int IntersLineCylinderCuttedByPlanes( const Point3d& ptLineP, const Vector3d& vtLineDir,
|
||||
const Point3d& ptBaseCen, const Vector3d& vtAx, double dRad, double dH, bool bInOut,
|
||||
const std::vector<Plane3d>& vPlanesVec,
|
||||
Point3d& ptInt1, Vector3d& vtN1, Point3d& ptInt2, Vector3d& vtN2) const ;
|
||||
int IntersLineCircSweptSurfCuttedByPlanes( const Point3d& ptLineP, const Vector3d& vtLineDir,
|
||||
const Point3d& ptCen, const Vector3d& vtAx, double dRad, const Vector3d& vtSweptVec, bool bInOut,
|
||||
const std::vector<Plane3d>& vPlanesVec,
|
||||
Point3d& ptInt1, Vector3d& vtN1, Point3d& ptInt2, Vector3d& vtN2) const ;
|
||||
int IntersLineConeCuttedByPlanes( const Point3d& ptLineP, const Vector3d& vtLineDir,
|
||||
const Point3d& ptVert, const Vector3d& vtAx, double dRad, double dH, bool bInOut,
|
||||
const std::vector<Plane3d>& vPlanesVec,
|
||||
Point3d& ptInt1, Vector3d& vtN1, Point3d& ptInt2, Vector3d& vtN2) const ;
|
||||
int IntersLineSphereCuttedByPlanes( const Point3d& ptLineP, const Vector3d& vtLineD,
|
||||
const Point3d& ptCen, double dRad, bool bInOut,
|
||||
const std::vector<Plane3d>& vPlanesVec,
|
||||
Point3d& ptInt1, Vector3d& vtN1, Point3d& ptInt2, Vector3d& vtN2) const ;
|
||||
/*private:*/
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Voxel: esistenza e passaggio da N a ijk per i voxel
|
||||
bool IsValidVoxel( int nN) const ;
|
||||
bool IsValidVoxel( int nI, int nJ, int nK) const ;
|
||||
|
||||
+1136
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user