EgtGraphics 1.9f1 :

- migliorata gestione punti notevoli con Trimesh e con Region
- in selezione con Region si setta chunk toccato come Aux.
This commit is contained in:
Dario Sassi
2018-06-22 09:45:31 +00:00
parent 3c8c5d0462
commit f6cb250e62
3 changed files with 105 additions and 33 deletions
+44 -1
View File
@@ -23,7 +23,9 @@
#include "/EgtDev/Include/EGkCurve.h"
#include "/EgtDev/Include/EGkDistPointCurve.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
#include "/EgtDev/Include/EGkExtText.h"
#include "/EgtDev/Include/EGkIntersLinePlane.h"
#include "/EgtDev/Include/EGkIntersLineSurfTm.h"
#include "/EgtDev/Include/EGkGdbConst.h"
#include "/EgtDev/Include/EGkGeomDB.h"
@@ -346,7 +348,7 @@ Scene::GetPointFromSelect( int nSelId, const Point3d& ptView, Point3d& ptSel, in
// lo porto da spazio grafico a spazio geometrico globale
Point3d ptRef ;
UnProject( ptWinZ, ptRef) ;
// lo porto nel frame della curva
// lo porto nel frame della superficie
ptRef.ToLoc( frEnt) ;
// recupero la direzione di mira e la porto nel riferimento della superficie
Vector3d vtDir = - m_vtDirCamera ;
@@ -371,6 +373,47 @@ Scene::GetPointFromSelect( int nSelId, const Point3d& ptView, Point3d& ptSel, in
ptSel.ToGlob( frEnt) ;
nAux = vInfo[0].nT ;
}
// se regione
else if ( pGObj->GetType() == SRF_FLATRGN) {
// recupero la regione
const ISurfFlatRegion* pReg = GetSurfFlatRegion( pGObj) ;
// il punto di riferimento deriva da XY su viewport e Z da selezione
Point3d ptWinZ( ptView.x, ptView.y, GetSelectedObjWinZ()) ;
// lo porto da spazio grafico a spazio geometrico globale
Point3d ptRef ;
UnProject( ptWinZ, ptRef) ;
// lo porto nel frame della regione
ptRef.ToLoc( frEnt) ;
// recupero la direzione di mira e la porto nel riferimento della regione
Vector3d vtDir = - m_vtDirCamera ;
vtDir.ToLoc( frEnt) ;
// recupero il piano della regione
Plane3d plReg ;
plReg.Set( pReg->GetPlanePoint(), pReg->GetNormVersor()) ;
// interseco la linea di mira con il piano della regione
Point3d ptInt ;
if ( IntersLinePlane( ptRef, vtDir, INFINITO, plReg, ptInt, false) != ILPT_YES)
return false ;
// assegno il punto
ptSel = ptInt ;
ptSel.ToGlob( frEnt) ;
// determino il chunk
nAux = 0 ;
if ( pReg->GetChunkCount() > 1) {
// verifico a quale contorno esterno di chunk è più vicino (potrebbe essere appena fuori dal bordo il centro del mirino)
double dMinSqDist = INFINITO * INFINITO ;
for ( int nC = 0 ; nC < pReg->GetChunkCount() ; ++ nC) {
PtrOwner<ICurve> pCrv( pReg->GetLoop( nC, 0)) ;
if ( IsNull( pCrv))
return false ;
double dSqDist ;
if ( DistPointCurve( ptInt, *pCrv).GetSqDist( dSqDist) && dSqDist < dMinSqDist) {
nAux = nC ;
dMinSqDist = dSqDist ;
}
}
}
}
// se testo
else if ( pGObj->GetType() == EXT_TEXT) {
// recupero il testo