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;
|
||||
}
|
||||
/*
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user