EgtGeomKernel 1.9g1 :
- migliorata CollisionAvoidance con utensili generici - gestione Tool potenziata con possibilità di restituire il profilo.
This commit is contained in:
+1
-1
@@ -30,7 +30,7 @@ CreateCAvToolSurfTm( void)
|
||||
// CAvToolSurfTm
|
||||
//----------------------------------------------------------------------------
|
||||
CAvToolSurfTm::CAvToolSurfTm( void)
|
||||
: m_pSTm( nullptr)
|
||||
: m_pSTm( nullptr), m_Tool( false)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
+4
-2
@@ -28,10 +28,12 @@ class CAvToolSurfTm : public ICAvToolSurfTm
|
||||
bool SetStdTool( double dH, double dR, double dCornR) override ;
|
||||
bool SetAdvTool( double dH, double dR, double dTipH, double dTipR, double dCornR) override ;
|
||||
bool SetGenTool( const ICurveComposite* pToolOutline) override ;
|
||||
double GetToolRadius( void) override
|
||||
double GetToolRadius( void) const override
|
||||
{ return m_Tool.GetRadius() ; }
|
||||
double GetToolHeight( void) override
|
||||
double GetToolHeight( void) const override
|
||||
{ return m_Tool.GetHeigth() ; }
|
||||
const ICurveComposite* GetToolOutline( void) const override
|
||||
{ return m_Tool.GetOutline() ;}
|
||||
bool TestPosition( const Point3d& ptT, const Vector3d& vtDir, double& dTotDist) override ;
|
||||
bool TestPath( PNTULIST& lPntM, const Vector3d& vtDir, double dLinTol) override ;
|
||||
|
||||
|
||||
+319
-136
@@ -12,6 +12,8 @@
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "CurveLine.h"
|
||||
#include "CurveArc.h"
|
||||
#include "CAvToolTriangle.h"
|
||||
#include "IntersLineSurfStd.h"
|
||||
#include "IntersLineTria.h"
|
||||
@@ -20,6 +22,57 @@
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static bool
|
||||
GetTopTapFromPrevCurve( const ICurve* pPrevCurve)
|
||||
{
|
||||
if ( pPrevCurve == nullptr)
|
||||
return false ;
|
||||
if ( pPrevCurve->GetType() == CRV_LINE) {
|
||||
const ICurveLine* pPrevLine = GetCurveLine( pPrevCurve) ;
|
||||
Point3d ptPrevStart = pPrevLine->GetStart() ;
|
||||
Point3d ptPrevEnd = pPrevLine->GetEnd() ;
|
||||
if ( abs( ptPrevStart.y - ptPrevEnd.y) > EPS_SMALL ||
|
||||
ptPrevStart.x > ptPrevEnd.x)
|
||||
return true ;
|
||||
}
|
||||
else if ( pPrevCurve->GetType() == CRV_ARC) {
|
||||
const ICurveArc* pPrevArc = GetCurveArc( pPrevCurve) ;
|
||||
Point3d ptPrevStart ; pPrevArc->GetStartPoint( ptPrevStart) ;
|
||||
Point3d ptPrevEnd ; pPrevArc->GetEndPoint( ptPrevEnd) ;
|
||||
Point3d ptPrevCen = pPrevArc->GetCenter() ;
|
||||
double dRadius = pPrevArc->GetRadius() ;
|
||||
if ( abs( ptPrevCen.x) > EPS_SMALL)
|
||||
return true ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static bool
|
||||
GetBotTapFromNextCurve( const ICurve* pNextCurve)
|
||||
{
|
||||
if ( pNextCurve == nullptr)
|
||||
return false ;
|
||||
if ( pNextCurve->GetType() == CRV_LINE) {
|
||||
const ICurveLine* pNextLine = GetCurveLine( pNextCurve) ;
|
||||
Point3d ptNextStart = pNextLine->GetStart() ;
|
||||
Point3d ptNextEnd = pNextLine->GetEnd() ;
|
||||
if ( abs( ptNextStart.y - ptNextEnd.y) > EPS_SMALL || ptNextStart.x < ptNextEnd.x)
|
||||
return true ;
|
||||
}
|
||||
else if ( pNextCurve->GetType() == CRV_ARC) {
|
||||
const ICurveArc* pNextArc = GetCurveArc( pNextCurve) ;
|
||||
Point3d ptNextStart ; pNextArc->GetStartPoint( ptNextStart) ;
|
||||
Point3d ptNextEnd ; pNextArc->GetEndPoint( ptNextEnd) ;
|
||||
Point3d ptNextCen = pNextArc->GetCenter() ;
|
||||
double dRadius = pNextArc->GetRadius() ;
|
||||
if ( abs( ptNextCen.x) > EPS_SMALL)
|
||||
return true ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// La funzione determina la minima distanza di allontanamento lungo una direzione fissata
|
||||
// per evitare la collisione tra un utensile ed un triangolo.
|
||||
@@ -29,6 +82,9 @@ double
|
||||
CAvToolTriangle( const Tool& tlTool, const Point3d& ptToolOrig, const Vector3d& vtToolAx,
|
||||
const Triangle3d& trTria, const Vector3d& vtMove)
|
||||
{
|
||||
// Se avvicinamento non devo fare nulla
|
||||
if ( vtMove * trTria.GetN() < - EPS_ZERO)
|
||||
return 0. ;
|
||||
// se utensile cilindrico
|
||||
if ( tlTool.GetType() == Tool::CYLMILL) {
|
||||
// parametri geometrici
|
||||
@@ -57,7 +113,8 @@ CAvToolTriangle( const Tool& tlTool, const Point3d& ptToolOrig, const Vector3d&
|
||||
return dDist2 ;
|
||||
return ( dDist + dDist2) ;
|
||||
}
|
||||
else if ( tlTool.GetType() == Tool::GEN) {
|
||||
// se utensile a naso di toro
|
||||
else if ( tlTool.GetType() == Tool::BULLNOSEMILL) {
|
||||
// parametri geometrici
|
||||
double dCylHeigth = tlTool.GetHeigth() - tlTool.GetTipHeigth() ;
|
||||
Point3d ptTorusCen = ptToolOrig - dCylHeigth * vtToolAx ;
|
||||
@@ -104,6 +161,117 @@ CAvToolTriangle( const Tool& tlTool, const Point3d& ptToolOrig, const Vector3d&
|
||||
return dDist2 ;
|
||||
return ( dDist + dDist2) ;
|
||||
}
|
||||
// se utensile generico
|
||||
else if ( tlTool.GetType() == Tool::GEN) {
|
||||
// distanza di allontanamento
|
||||
double dDist = 0 ;
|
||||
// riferimento per componenti
|
||||
Point3d ptCompOrig = ptToolOrig - tlTool.GetHeigth() * vtToolAx ;
|
||||
// analizzo le curve del profilo a partire dall'ultima
|
||||
const CurveComposite* pToolProfile = tlTool.GetOutline() ;
|
||||
const ICurve* pCurve = pToolProfile->GetLastCurve() ;
|
||||
const ICurve* pNextCurve = nullptr ;
|
||||
while ( pCurve != nullptr) {
|
||||
// distanza di allontanamento del tratto corrente
|
||||
double dDist2 = 0 ;
|
||||
// curva precedente
|
||||
const ICurve* pPrevCurve = pToolProfile->GetPrevCurve() ;
|
||||
// Se segmento
|
||||
if ( pCurve->GetType() == CRV_LINE) {
|
||||
// Recupero gli estremi
|
||||
const ICurveLine* pLine = GetCurveLine( pCurve) ;
|
||||
Point3d ptStart = pLine->GetStart() ;
|
||||
Point3d ptEnd = pLine->GetEnd() ;
|
||||
// Ne determino l'altezza
|
||||
double dHeight = abs( ptStart.y - ptEnd.y) ;
|
||||
if ( dHeight > EPS_SMALL) {
|
||||
// Verifiche curva precedente per eventuale tappo sopra
|
||||
bool bTop = GetTopTapFromPrevCurve( pPrevCurve) ;
|
||||
// Verifiche curva successiva per eventuale tappo sotto
|
||||
bool bBot = GetBotTapFromNextCurve( pNextCurve) ;
|
||||
// Calcolo distanza di allontanamento del componente corrente
|
||||
if ( abs( ptStart.x - ptEnd.x) < EPS_SMALL) {
|
||||
double dRadius = ptStart.x ;
|
||||
// riferimento del cilindro in alto
|
||||
ptCompOrig += dHeight * vtToolAx ;
|
||||
dDist2 = CAvCylinderTriangle( ptCompOrig, vtToolAx, dHeight, dRadius, trTria, vtMove, bTop, bBot) ;
|
||||
}
|
||||
else if ( ptStart.x > ptEnd.x) {
|
||||
double dMaxRad = ptStart.x ;
|
||||
double dMinRad = ptEnd.x ;
|
||||
// riferimento del cono in basso (base più piccola)
|
||||
dDist2 = CAvTrConeTriangle( ptCompOrig, vtToolAx, dMinRad, dMaxRad, dHeight, trTria, vtMove, bTop, bBot) ;
|
||||
// sposto riferimento in alto
|
||||
ptCompOrig += dHeight * vtToolAx ;
|
||||
}
|
||||
else if ( ptStart.x < ptEnd.x) {
|
||||
double dMaxRad = ptEnd.x ;
|
||||
double dMinRad = ptStart.x ;
|
||||
// riferimento del cono in alto (base più piccola)
|
||||
ptCompOrig += dHeight * vtToolAx ;
|
||||
dDist2 = CAvTrConeTriangle( ptCompOrig, - vtToolAx, dMinRad, dMaxRad, dHeight, trTria, vtMove, bTop, bBot) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Se arco
|
||||
else if ( pCurve->GetType() == CRV_ARC) {
|
||||
// Recupero estremi, centro e raggio
|
||||
const ICurveArc* pArc = GetCurveArc( pCurve) ;
|
||||
Point3d ptStart ; pArc->GetStartPoint( ptStart) ;
|
||||
Point3d ptEnd ; pArc->GetEndPoint( ptEnd) ;
|
||||
Point3d ptCen = pArc->GetCenter() ;
|
||||
double dRadius = pArc->GetRadius() ;
|
||||
// Calcolo della distanza di allontanamento del componente corrente
|
||||
// Sfera
|
||||
if ( abs( ptCen.x) < EPS_SMALL) {
|
||||
// riferimento sul centro sfera
|
||||
ptCompOrig += ( ptCen.y - ptEnd.y) * vtToolAx ;
|
||||
dDist2 = CAvSphereTriangle( ptCompOrig, dRadius, trTria, vtMove) ;
|
||||
// sposto riferimento in alto
|
||||
ptCompOrig += ( ptStart.y - ptCen.y) * vtToolAx ;
|
||||
}
|
||||
// Toro
|
||||
else {
|
||||
// Verifiche curva precedente per eventuale tappo sopra
|
||||
bool bTop = GetTopTapFromPrevCurve( pPrevCurve) ;
|
||||
// Verifiche curva successiva per eventuale tappo sotto
|
||||
bool bBot = GetBotTapFromNextCurve( pNextCurve) ;
|
||||
// riferimento sul centro toro
|
||||
ptCompOrig += ( ptCen.y - ptEnd.y) * vtToolAx ;
|
||||
// verifica presenza semitori
|
||||
bool bHalfTorusDown = ( ptEnd.y < ptCen.y - EPS_SMALL) ;
|
||||
bool bHalfTorusUp = ( ptStart.y > ptCen.y + EPS_SMALL) ;
|
||||
// semi-toro sotto
|
||||
if (bHalfTorusDown) {
|
||||
double dMyDist = CAvTorusTriangle( ptCompOrig, vtToolAx, ptCen.x, dRadius, trTria, vtMove,
|
||||
( bHalfTorusUp ? true : bTop), bBot) ;
|
||||
if ( dMyDist < - EPS_SMALL)
|
||||
return dMyDist ;
|
||||
dDist2 = max( dDist2, dMyDist) ;
|
||||
}
|
||||
// semi-toro sopra
|
||||
if ( bHalfTorusUp) {
|
||||
double dMyDist = CAvTorusTriangle( ptCompOrig, - vtToolAx, ptCen.x, dRadius, trTria, vtMove,
|
||||
bTop, ( bHalfTorusDown ? true : bBot)) ;
|
||||
if ( dMyDist < - EPS_SMALL)
|
||||
return dMyDist ;
|
||||
dDist2 = max( dDist2, dMyDist) ;
|
||||
}
|
||||
// sposto riferimento in alto
|
||||
ptCompOrig += ( ptStart.y - ptCen.y) * vtToolAx ;
|
||||
}
|
||||
}
|
||||
// Aggiornamento distanza allontanamento
|
||||
if ( dDist2 < - EPS_SMALL)
|
||||
return dDist2 ;
|
||||
dDist += dDist2 ;
|
||||
ptCompOrig += dDist2 * vtMove ;
|
||||
// passo alla curva precedente
|
||||
pNextCurve = pCurve ;
|
||||
pCurve = pPrevCurve ;
|
||||
}
|
||||
return dDist ;
|
||||
}
|
||||
// altrimenti utensile di tipo non gestito
|
||||
else
|
||||
return - 1. ;
|
||||
@@ -117,13 +285,13 @@ CAvToolTriangle( const Tool& tlTool, const Point3d& ptToolOrig, const Vector3d&
|
||||
double
|
||||
CAvSphereTriangle( const Point3d& ptSpheCen, double dSpheRad, const Triangle3d& trTria, const Vector3d& vtMove)
|
||||
{
|
||||
// Se la sfera sta già tutta dalla parte del movimento rispetto al piano del triangolo non va allontanata
|
||||
// Se la sfera sta già tutta dalla parte esterna del triangolo, non va allontanata
|
||||
Vector3d vtVert0 = ptSpheCen - trTria.GetP( 0) ;
|
||||
Vector3d vtVert1 = ptSpheCen - trTria.GetP( 1) ;
|
||||
Vector3d vtVert2 = ptSpheCen - trTria.GetP( 2) ;
|
||||
if ( vtVert0 * vtMove > dSpheRad - EPS_SMALL &&
|
||||
vtVert1 * vtMove > dSpheRad - EPS_SMALL &&
|
||||
vtVert2 * vtMove > dSpheRad - EPS_SMALL)
|
||||
if ( vtVert0 * trTria.GetN() > dSpheRad - EPS_SMALL &&
|
||||
vtVert1 * trTria.GetN() > dSpheRad - EPS_SMALL &&
|
||||
vtVert2 * trTria.GetN() > dSpheRad - EPS_SMALL)
|
||||
return 0. ;
|
||||
|
||||
// Valuto Tangenza col piano
|
||||
@@ -151,13 +319,14 @@ CAvSphereTriangle( const Point3d& ptSpheCen, double dSpheRad, const Triangle3d&
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Calcola la distanza di allontanamento lungo una direzione fissata di una sfera da un piano.
|
||||
// Se ritorno -1 non è errore, ma sfera interseca piano e movimento nel piano.
|
||||
double
|
||||
SpherePlaneLeakDist( const Point3d& ptSpheCen, double dSpheRad,
|
||||
const Point3d& ptPlane, const Vector3d& vtPlaneN, const Vector3d& vtMove)
|
||||
{
|
||||
// Se la direzione di allontanamento sta nel piano
|
||||
if ( abs( vtPlaneN * vtMove) < EPS_SMALL) {
|
||||
if ( abs( ( ptSpheCen - ptPlane) * vtPlaneN) > dSpheRad)
|
||||
if ( abs( vtPlaneN * vtMove) < EPS_ZERO) {
|
||||
if ( abs( ( ptSpheCen - ptPlane) * vtPlaneN) > dSpheRad - EPS_SMALL)
|
||||
return 0. ;
|
||||
else
|
||||
return -1. ;
|
||||
@@ -191,8 +360,8 @@ SphereSegmentLeakDist( const Point3d& ptSpheCen, double dSpheRad,
|
||||
}
|
||||
// Controllo con gli estremi
|
||||
Point3d ptSegEnd = ptSeg + dSegLen * vtSegDir ;
|
||||
double dDistStart = SpherePointLeakDist( ptSpheCen, dSpheRad, ptSeg, vtMove) ;
|
||||
double dDistEnd = SpherePointLeakDist( ptSpheCen, dSpheRad, ptSegEnd, vtMove) ;
|
||||
double dDistStart = SpherePointLeakDist( ptSpheCen, dSpheRad - EPS_SMALL, ptSeg, vtMove) ;
|
||||
double dDistEnd = SpherePointLeakDist( ptSpheCen, dSpheRad - EPS_SMALL, ptSegEnd, vtMove) ;
|
||||
// Restituisco il massimo
|
||||
return max( dLeakDistIn, max( dDistStart, dDistEnd)) ;
|
||||
}
|
||||
@@ -366,10 +535,9 @@ CylSegmentLeakDistOrtMotion( const Point3d& ptCylOrig, const Vector3d& vtCylAx,
|
||||
const Point3d& ptSeg, const Vector3d& vtSeg, double dSegLen, const Vector3d& vtMove,
|
||||
bool bTop, bool bBot)
|
||||
{
|
||||
double dTopTol = bTop ? EPS_SMALL : - EPS_SMALL ;
|
||||
double dBotTol = bBot ? - EPS_SMALL : EPS_SMALL ;
|
||||
// Le variabili fanno rifermiento a un sistema di riferimento
|
||||
// con origine nel centro del disco nella posizione iniziale.
|
||||
double dTopTol = ( bTop ? EPS_SMALL : - EPS_SMALL) ;
|
||||
double dBotTol = ( bBot ? - EPS_SMALL : EPS_SMALL) ;
|
||||
// Riferimento con origine nel centro del disco nella posizione iniziale.
|
||||
// X := vtCylAx, Y:= vtMove, Z:= vtCylAx ^ vtMove.
|
||||
Vector3d vtPlane = vtCylAx ^ vtMove ;
|
||||
vtPlane.Normalize() ;
|
||||
@@ -382,8 +550,11 @@ CylSegmentLeakDistOrtMotion( const Point3d& ptCylOrig, const Vector3d& vtCylAx,
|
||||
Vector3d vtSegEnd1 = dCordEnd1 * vtCylAx ;
|
||||
Vector3d vtSegStart23 = vtSegStart - vtSegStart1 ;
|
||||
Vector3d vtSegEnd23 = vtSegEnd - vtSegEnd1 ;
|
||||
// Se entrambi gli estremi del segmento sono a un lato
|
||||
// del cilindro non vi può essere interferenza.
|
||||
// Se entrambi gli estremi sono sopra o sotto, non ci può essere interferenza
|
||||
if ( ( dCordStart1 > dTopTol && dCordEnd1 > dTopTol) ||
|
||||
( dCordStart1 < - dCylHei + dBotTol && dCordEnd1 < - dCylHei + dBotTol))
|
||||
return 0. ;
|
||||
// Se entrambi gli estremi del segmento sono a un lato, non ci può essere interferenza
|
||||
double dCordStart2 = vtSegStart23 * vtPlane ;
|
||||
double dCordEnd2 = vtSegEnd23 * vtPlane ;
|
||||
if ( ( dCordStart2 > dCylRad && dCordEnd2 > dCylRad) ||
|
||||
@@ -393,49 +564,46 @@ CylSegmentLeakDistOrtMotion( const Point3d& ptCylOrig, const Vector3d& vtCylAx,
|
||||
double dBaseLeakDist = DiskSegmentLeakDistOrtMot( ptCylOrig, vtCylAx, dCylRad, ptSeg, vtSeg, dSegLen, vtMove) ;
|
||||
double dBottomLeakDist = DiskSegmentLeakDistOrtMot( ptCylOrig - dCylHei * vtCylAx, vtCylAx, dCylRad,
|
||||
ptSeg, vtSeg, dSegLen, vtMove) ;
|
||||
|
||||
|
||||
double dSurfLeakDist = 0. ;
|
||||
if ( ( dCordStart1 < dTopTol && dCordStart1 > - dCylHei + dBotTol) ||
|
||||
( dCordEnd1 < dTopTol && dCordEnd1 > - dCylHei + dBotTol)) {
|
||||
// Se il vettore del segmento è parallelo all'asse del cilindro,
|
||||
// il suo prodotto vettoriale con il versore dell'asse è nullo.
|
||||
Vector3d vtRad = vtCylAx ^ vtSeg ;
|
||||
if ( ! vtRad.Normalize()) {
|
||||
dSurfLeakDist = max( ( ptSeg - ptCylOrig) * vtMove, 0.) ;
|
||||
// Se il vettore del segmento è parallelo all'asse del cilindro,
|
||||
// il suo prodotto vettoriale con il versore dell'asse è nullo.
|
||||
Vector3d vtRad = vtCylAx ^ vtSeg ;
|
||||
if ( ! vtRad.Normalize()) {
|
||||
dSurfLeakDist = max( ( ptSeg - ptCylOrig) * vtMove, 0.) ;
|
||||
}
|
||||
// Se il versore radiale NON è ortogonale a quello di movimento può esserci tangenza,
|
||||
// altrimenti il versore del segmento non ha componenti ortogonali al piano
|
||||
// generato da asse cilindro e moto e non può esserci tangenza.
|
||||
else if ( abs( vtRad * vtMove) > EPS_SMALL) {
|
||||
// Nella posizione finale il cilindro e la retta del segmento sono tangenti.
|
||||
// Vettore che spicca dal punto di tangenza fra cilindro e retta
|
||||
// associata al segmento e termina sull'asse del cilindro.
|
||||
vtRad *= dCylRad ;
|
||||
// Lunghezza della componente del vettore radiale ortogonale alla linea di movimento
|
||||
double dDotRemRad = abs( vtRad * vtMove) ;
|
||||
double dOrtLen = sqrt( max( dCylRad * dCylRad - dDotRemRad * dDotRemRad, 0.)) ;
|
||||
// Cerco lungo la retta un punto che stia nel segmento e abbia distanza dal piano
|
||||
// abbia distanza dal piano +/- dOrtLen.
|
||||
Vector3d vtPlane = vtMove ^ vtCylAx ;
|
||||
vtPlane.Normalize() ;
|
||||
Vector3d vtD = ptSeg - ptCylOrig ;
|
||||
double dDotPlaneD = vtD * vtPlane ;
|
||||
double dDotPlaneSeg = vtSeg * vtPlane ;
|
||||
double dPlusU = ( dOrtLen - dDotPlaneD) / dDotPlaneSeg ;
|
||||
double dMinusU = ( - dOrtLen - dDotPlaneD) / dDotPlaneSeg ;
|
||||
Point3d ptTanPlus = ptSeg + dPlusU * vtSeg ;
|
||||
Point3d ptTanMinus = ptSeg + dMinusU * vtSeg ;
|
||||
double dTanCordPlus1 = ( ptTanPlus - ptCylOrig) * vtCylAx ;
|
||||
double dTanCordMinus1 = ( ptTanMinus - ptCylOrig) * vtCylAx ;
|
||||
if ( ( dPlusU > - EPS_SMALL && dPlusU < dSegLen + EPS_SMALL) &&
|
||||
( dTanCordPlus1 < dTopTol && dTanCordPlus1 > - dCylHei + dBotTol)) {
|
||||
dSurfLeakDist = max( ( ( ptSeg - ptCylOrig) + dPlusU * vtSeg) * vtMove + dDotRemRad, 0.) ;
|
||||
}
|
||||
// Se il versore radiale NON è ortogonale a quello di movimento può esserci tangenza,
|
||||
// altrimenti il versore del segmento non ha componenti ortogonali al piano
|
||||
// generato da asse cilindro e moto e non può esserci tangenza.
|
||||
else if ( ! ( abs( vtRad * vtMove) < EPS_SMALL)) {
|
||||
// Nella posizione finale il cilindro e la retta del segmento sono tangenti.
|
||||
// Vettore che spicca dal punto di tangenza fra cilindro e retta
|
||||
// associata al segmento e termina sull'asse del cilindro.
|
||||
vtRad *= dCylRad ;
|
||||
// Lunghezza della componente del vettore radiale ortogonale alla linea di movimento
|
||||
double dDotRemRad = abs( vtRad * vtMove) ;
|
||||
double dOrtLen = sqrt( max( dCylRad * dCylRad - dDotRemRad * dDotRemRad, 0.)) ;
|
||||
// Cerco lungo la retta un punto che stia nel segmento e abbia distanza dal piano
|
||||
// abbia distanza dal piano +/- dOrtLen.
|
||||
Vector3d vtPlane = vtMove ^ vtCylAx ;
|
||||
vtPlane.Normalize() ;
|
||||
Vector3d vtD = ptSeg - ptCylOrig ;
|
||||
double dDotPlaneD = vtD * vtPlane ;
|
||||
double dDotPlaneSeg = vtSeg * vtPlane ;
|
||||
double dPlusU = ( dOrtLen - dDotPlaneD) / dDotPlaneSeg ;
|
||||
double dMinusU = ( - dOrtLen - dDotPlaneD) / dDotPlaneSeg ;
|
||||
Point3d ptTanPlus = ptSeg + dPlusU * vtSeg ;
|
||||
Point3d ptTanMinus = ptSeg + dMinusU * vtSeg ;
|
||||
double dTanCordPlus1 = ( ptTanPlus - ptCylOrig) * vtCylAx ;
|
||||
double dTanCordMinus1 = ( ptTanMinus - ptCylOrig) * vtCylAx ;
|
||||
if ( ( dPlusU > - EPS_SMALL && dPlusU < dSegLen + EPS_SMALL) &&
|
||||
( dTanCordPlus1 < dTopTol && dTanCordPlus1 > - dCylHei + dBotTol)) {
|
||||
dSurfLeakDist = max( ( ( ptSeg - ptCylOrig) + dPlusU * vtSeg) * vtMove + dDotRemRad, 0.) ;
|
||||
}
|
||||
if ( dMinusU > - EPS_SMALL && dMinusU < dSegLen + EPS_SMALL &&
|
||||
( dTanCordMinus1 < dTopTol && dTanCordMinus1 > - dCylHei + dBotTol)) {
|
||||
double dNewDist = max( ( ( ptSeg - ptCylOrig) + dMinusU * vtSeg) * vtMove + dDotRemRad, 0.) ;
|
||||
dSurfLeakDist = max( dNewDist, dSurfLeakDist) ;
|
||||
}
|
||||
if ( dMinusU > - EPS_SMALL && dMinusU < dSegLen + EPS_SMALL &&
|
||||
( dTanCordMinus1 < dTopTol && dTanCordMinus1 > - dCylHei + dBotTol)) {
|
||||
double dNewDist = max( ( ( ptSeg - ptCylOrig) + dMinusU * vtSeg) * vtMove + dDotRemRad, 0.) ;
|
||||
dSurfLeakDist = max( dNewDist, dSurfLeakDist) ;
|
||||
}
|
||||
}
|
||||
return max( max( dBaseLeakDist, dBottomLeakDist), max( dSurfLeakDist, 0.)) ;
|
||||
@@ -609,10 +777,10 @@ TrConeTriangleInteriorLeakDistLongMot( const Point3d& ptMinBase, const Vector3d&
|
||||
// altrimenti sono i dischi a determinare l'allontanamento
|
||||
double dMove = 0 ;
|
||||
if ( ( nMinLeakType == 1 && IsPointInsideTriangle( ptMinTouch, trTria)) ||
|
||||
( nMinLeakType == 3 && CoplanarDiscTriangleInterferance( ptMinTouch, dMinBaseR, trTria)))
|
||||
( nMinLeakType == 4 && CoplanarDiscTriangleInterferance( ptMinTouch, dMinBaseR, trTria)))
|
||||
dMove = max( dMinLeakDist, 0.) ;
|
||||
if ( ( nMaxLeakType == 1 && IsPointInsideTriangle( ptMaxTouch, trTria)) ||
|
||||
( nMaxLeakType == 3 && CoplanarDiscTriangleInterferance( ptMaxTouch, dMaxBaseR, trTria)))
|
||||
( nMaxLeakType == 4 && CoplanarDiscTriangleInterferance( ptMaxTouch, dMaxBaseR, trTria)))
|
||||
dMove = max( dMove, dMaxLeakDist) ;
|
||||
return dMove ;
|
||||
}
|
||||
@@ -944,13 +1112,18 @@ TorusTriangleInteriorLeakDistOrtMot( const Point3d& ptTorusCen, const Vector3d&
|
||||
// Se piano ortogonale all'asse del toro non ci può essere tangenza
|
||||
if ( ! vtPlaneOrtToAx.Normalize( EPS_ZERO))
|
||||
return 0. ;
|
||||
// Se la componente del versore normale al triangolo nella direzione
|
||||
// del moto è nulla, non può esserci contatto con l'interno
|
||||
double dDotMoveN = vtMove * trTria.GetN() ;
|
||||
if ( abs( dDotMoveN) < EPS_ZERO)
|
||||
return 0. ;
|
||||
// Scarto il primo contatto
|
||||
if ( vtPlaneOrtToAx * vtMove < 0.)
|
||||
return 0. ;
|
||||
vtPlaneOrtToAx *= dMaxRad ;
|
||||
// Trovo il punto che toccherà il piano
|
||||
Point3d ptTouch = ptTorusCen - vtPlaneOrtToAx - dMinRad * trTria.GetN() ;
|
||||
double dLeakDist = max( ( ( trTria.GetP( 0) - ptTouch) * trTria.GetN()) / ( vtMove * trTria.GetN()), 0.) ;
|
||||
double dLeakDist = max( ( ( trTria.GetP( 0) - ptTouch) * trTria.GetN()) / dDotMoveN, 0.) ;
|
||||
// Se il punto di contatto è interno al triangolo restituisco distanza di fuga non negativa
|
||||
if ( IsPointInsideTriangle( ptTouch + dLeakDist * vtMove, trTria))
|
||||
return dLeakDist ;
|
||||
@@ -959,6 +1132,16 @@ TorusTriangleInteriorLeakDistOrtMot( const Point3d& ptTorusCen, const Vector3d&
|
||||
|
||||
// DISTANZA DI ALLONTANAMENTO PER DISCHI
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
double
|
||||
DiskPointLeakDistLongMot( const Point3d& ptDiskCen, double dDiskRad,
|
||||
const Point3d& ptP, const Vector3d& vtMove)
|
||||
{
|
||||
if ( GetPointLineSqDist( ptP, ptDiskCen, vtMove) < dDiskRad * dDiskRad)
|
||||
return PointPlaneSignedDist( ptP, ptDiskCen, vtMove) ;
|
||||
return 0. ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
double
|
||||
DiskSegmentLeakDistLongMot( const Point3d& ptDiskCen, double dDiskRad,
|
||||
@@ -1067,69 +1250,6 @@ DiskTriaInteriorLeakDistLongMot( const Point3d& ptDiskCen, double dDiskRad,
|
||||
return max( dDistPlus, dDistMinus) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Valuta l'allontanamento di un disco, che trasla lungo il proprio asse di simmetria,
|
||||
// da un piano. Il disco è descritto dal suo centro nella posizione iniziale e dal raggio.
|
||||
// Il piano è descritto da un suo punto e dal suo versore normale. Il moto è descritto
|
||||
// dal versore di traslazione.
|
||||
// La funzione restituisce un intero che descrive la situazione di allontanamento e,
|
||||
// nel caso che abbia senso, per referenza restituisce il punto in cui avviene
|
||||
// l'estremo contatto.
|
||||
// 0: Nessun contatto
|
||||
// 1: Un contatto
|
||||
// 2: Disco e piano ortogonali, il contatto è una semiretta
|
||||
// 3: Disco e piano paralleli, la superficie di contatto è il disco intero
|
||||
// Nel caso 0 il parametro ptTouch non ha senso, così come nel caso 2.
|
||||
// Nel caso 3 ptTouch è il centro del disco nella posizione finale.
|
||||
int
|
||||
DiskPlaneLastContactLongMot( const Point3d& ptDiskCen, double dDiskRad,
|
||||
const Point3d& ptPlane, const Vector3d& vtPlane,
|
||||
const Vector3d& vtMove, Point3d& ptTouch)
|
||||
{
|
||||
// Se disco e piano sono paralleli
|
||||
if ( AreSameOrOppositeVectorApprox( vtMove, vtPlane)) {
|
||||
double dDist = PointPlaneSignedDist( ptPlane, ptDiskCen, vtMove) ;
|
||||
if ( dDist > - EPS_SMALL) {
|
||||
ptTouch = ptDiskCen + dDist * vtMove ;
|
||||
return 4 ;
|
||||
}
|
||||
return 0 ;
|
||||
}
|
||||
// Vettore radiale
|
||||
Vector3d vtRadLine = vtMove * ( vtPlane * vtMove) - vtPlane ;
|
||||
// Disco e piano ortogonali
|
||||
if ( vtRadLine.IsNormalized()) {
|
||||
double dDist = abs( PointPlaneSignedDist(ptPlane, ptDiskCen, vtMove)) ;
|
||||
if ( abs( dDist - dDiskRad) < EPS_SMALL)
|
||||
return 2 ;
|
||||
else if ( dDist < dDiskRad)
|
||||
return 3 ;
|
||||
return 0 ;
|
||||
}
|
||||
// Cerco un punto di contatto nell'interno del triangolo. Se tale punto
|
||||
// esiste, la retta intersezione fra il piano del triangolo e quello del
|
||||
// disco è tangente alla circonferenza.
|
||||
vtRadLine.Normalize() ;
|
||||
// Punti delle due rette candidate all'intersezione col triangolo
|
||||
Point3d ptStPlus = ptDiskCen + dDiskRad * vtRadLine ;
|
||||
Point3d ptStMinus = ptDiskCen - dDiskRad * vtRadLine ;
|
||||
// Parametri d'intersezione delle rette col piano
|
||||
double dDistPlus = ( ( ptPlane - ptStPlus) * vtPlane) / ( vtMove * vtPlane) ;
|
||||
double dDistMinus = ( ( ptPlane - ptStMinus) * vtPlane) / ( vtMove * vtPlane) ;
|
||||
double dDist ;
|
||||
if ( dDistPlus > dDistMinus) {
|
||||
dDist = dDistPlus ;
|
||||
ptTouch = ptStPlus + dDist * vtMove ;
|
||||
}
|
||||
else {
|
||||
dDist = dDistMinus ;
|
||||
ptTouch = ptStMinus + dDist * vtMove ;
|
||||
}
|
||||
if ( dDist > - EPS_SMALL)
|
||||
return 1 ;
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
double
|
||||
DiskPointLeakDistOrtMot( const Point3d& ptDisc, const Vector3d& vtDiskAx, double dDiskRad,
|
||||
@@ -1256,16 +1376,16 @@ ThreePointPlaneSignedDist( const Triangle3d& trTria, const Point3d& ptPlane, con
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Dati un piano, descritto da un suo punto e dal versore normale,
|
||||
// e una retta, descritta da un suo punto e dal versore direzione,
|
||||
// e un numero reale d, determina se esiste un punto sulla retta che ha distanza con
|
||||
// segno d dal piano. I casi possibili sono:
|
||||
// Nessun punto dista d dal piano (retta parallela al piano con distanza diversa da d),
|
||||
// viene restituito 0 e il valore di dPar non ha senso.
|
||||
// Un solo punto dista d dal piano (retta non parallela al piano), viene restituito 1
|
||||
// e il valore di dPar è il parametro del punto sulla retta.
|
||||
// Tutti i punti distano d dal piano (retta parallela al piano con distanza d), viene
|
||||
// restituito 2 e qualunque valore di dPar ha senso.
|
||||
// Calcola, se esiste, il punto di una retta a distanza con segno data da un piano.
|
||||
// Il piano è descritto da punto e versore normale.
|
||||
// La retta è descritta da punto e versore direzione.
|
||||
// I casi possibili sono:
|
||||
// - Nessun punto della retta dista d dal piano (retta parallela al piano con distanza diversa da d),
|
||||
// viene restituito 0 e il valore di dPar non ha senso.
|
||||
// - Un solo punto della retta dista d dal piano (retta non parallela al piano), viene restituito 1
|
||||
// e il valore di dPar è il parametro del punto sulla retta.
|
||||
// - Tutti i punti della retta distano d dal piano (retta parallela al piano con distanza d), viene
|
||||
// restituito 2 e qualunque valore di dPar ha senso.
|
||||
int
|
||||
LinePlaneDDistPar( const Point3d& ptPlane, const Vector3d& vtPlane, const Point3d& ptLine, const Vector3d& vtLine,
|
||||
double dDist, double& dPar)
|
||||
@@ -1412,12 +1532,12 @@ CoplanarDiscTriangleInterferance( const Point3d& ptCen, double dRad, const Trian
|
||||
// non hanno necessariamente il significato di lunghezza;
|
||||
// perché non è richiesto che i vettori siano normalizzati.
|
||||
bool
|
||||
FindMinDistPar( const Point3d& ptL1, const Point3d& ptL2,
|
||||
const Vector3d& vtV1, const Vector3d& vtV2,
|
||||
double& dU1, double& dU2)
|
||||
FindLineLineMinDistPar( const Point3d& ptL1, const Vector3d& vtV1,
|
||||
const Point3d& ptL2, const Vector3d& vtV2,
|
||||
double& dU1, double& dU2)
|
||||
{
|
||||
// Se le rette sono parallele
|
||||
if ( abs( abs( vtV1 * vtV2) - 1) < EPS_ZERO)
|
||||
if ( AreSameOrOppositeVectorExact( vtV1, vtV2))
|
||||
return false ;
|
||||
|
||||
// Vettore congiungente i punti iniziali
|
||||
@@ -1482,3 +1602,66 @@ SphereLineTangentPoints( const Point3d& ptSpheCen, double dSpheRad,
|
||||
}
|
||||
return nRoots ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Valuta l'allontanamento di un disco, lungo il proprio asse di simmetria, da un piano.
|
||||
// Il disco è descritto dal centro nella posizione iniziale e dal raggio (la normale è il versore traslazione).
|
||||
// Il piano è descritto da un suo punto e dal suo versore normale.
|
||||
// Il moto è descritto dal versore di traslazione.
|
||||
// Il valore restituito è un intero che descrive la situazione di allontanamento e,
|
||||
// quando sensato, per referenza restituisce il punto di ultimo contatto.
|
||||
// 0: Nessun contatto
|
||||
// 1: Un contatto
|
||||
// 2: Disco e piano ortogonali, con disco tg al piano, il contatto è una semiretta
|
||||
// 3: Disco e piano ortogonali, con disco secante il piano, il contatto è una striscia
|
||||
// 4: Disco e piano paralleli, come ultimo contatto si restituisce il centro.
|
||||
// Nel caso 0 il parametro ptTouch non ha senso, così come nel caso 2 e nel caso 3
|
||||
int
|
||||
DiskPlaneLastContactLongMot( const Point3d& ptDiskCen, double dDiskRad,
|
||||
const Point3d& ptPlane, const Vector3d& vtPlane,
|
||||
const Vector3d& vtMove, Point3d& ptTouch)
|
||||
{
|
||||
// Se disco e piano sono paralleli
|
||||
if ( AreSameOrOppositeVectorApprox( vtMove, vtPlane)) {
|
||||
double dDist = PointPlaneSignedDist( ptPlane, ptDiskCen, vtMove) ;
|
||||
if ( dDist > - EPS_SMALL) {
|
||||
ptTouch = ptDiskCen + dDist * vtMove ;
|
||||
return 4 ;
|
||||
}
|
||||
return 0 ;
|
||||
}
|
||||
// Vettore radiale
|
||||
Vector3d vtRadLine = vtMove * ( vtPlane * vtMove) - vtPlane ;
|
||||
// Disco e piano ortogonali
|
||||
if ( vtRadLine.IsNormalized()) {
|
||||
double dDist = abs( PointPlaneSignedDist(ptPlane, ptDiskCen, vtMove)) ;
|
||||
if ( abs( dDist - dDiskRad) < EPS_SMALL)
|
||||
return 2 ;
|
||||
else if ( dDist < dDiskRad)
|
||||
return 3 ;
|
||||
return 0 ;
|
||||
}
|
||||
// Cerco un punto di contatto nell'interno del triangolo. Se tale punto
|
||||
// esiste, la retta intersezione fra il piano del triangolo e quello del
|
||||
// disco è tangente alla circonferenza.
|
||||
vtRadLine.Normalize() ;
|
||||
// Punti delle due rette candidate all'intersezione col triangolo
|
||||
Point3d ptStPlus = ptDiskCen + dDiskRad * vtRadLine ;
|
||||
Point3d ptStMinus = ptDiskCen - dDiskRad * vtRadLine ;
|
||||
// Parametri d'intersezione delle rette col piano
|
||||
double dDistPlus = ( ( ptPlane - ptStPlus) * vtPlane) / ( vtMove * vtPlane) ;
|
||||
double dDistMinus = ( ( ptPlane - ptStMinus) * vtPlane) / ( vtMove * vtPlane) ;
|
||||
double dDist ;
|
||||
if ( dDistPlus > dDistMinus) {
|
||||
dDist = dDistPlus ;
|
||||
ptTouch = ptStPlus + dDist * vtMove ;
|
||||
}
|
||||
else {
|
||||
dDist = dDistMinus ;
|
||||
ptTouch = ptStMinus + dDist * vtMove ;
|
||||
}
|
||||
if ( dDist > - EPS_SMALL)
|
||||
return 1 ;
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
|
||||
+10
-8
@@ -71,20 +71,19 @@ double TorusTriangleInteriorLeakDistOrtMot( const Point3d& ptTorusCen, const Vec
|
||||
const Triangle3d& trTria, const Vector3d& vtMove) ;
|
||||
|
||||
// Dischi
|
||||
double DiskPointLeakDistLongMot( const Point3d& ptDiskCen, double dDiskRad,
|
||||
const Point3d& ptP, const Vector3d& vtMove) ;
|
||||
double DiskSegmentLeakDistLongMot( const Point3d& ptDiskCen, double dDiskRad,
|
||||
const Point3d& ptSeg, const Vector3d& vtSeg, double dSegLen, const Vector3d& vtMove) ;
|
||||
int DiskPlaneLastContactLongMot( const Point3d& ptDiskCen, double dDiskRad,
|
||||
const Point3d& ptPlane, const Vector3d& vtPlane,
|
||||
const Vector3d& vtMove, Point3d& ptTouch) ;
|
||||
double DiskTriaInteriorLeakDistLongMot( const Point3d& ptDiskCen, double dDiskRad,
|
||||
const Triangle3d& trTria, const Vector3d& vtMove) ;
|
||||
double DiskPointLeakDistOrtMot( const Point3d& ptDisc, const Vector3d& vtDiskAx, double dDiscRad,
|
||||
const Point3d& ptP, const Vector3d& vtMove) ;
|
||||
double DiskSegmentLeakDistOrtMot( const Point3d& ptDiskCen, const Vector3d& vtDiskAx, double dDiskRad,
|
||||
const Point3d& ptSeg, const Vector3d& vtSeg, double dSegLen, const Vector3d& vtMove) ;
|
||||
double DiskPlaneLeakDistOrtMot( const Point3d& ptDiskCen, const Vector3d& vtDiskAx, double dDiskRad,
|
||||
const Point3d& ptPlane, const Vector3d& vtPlane,
|
||||
const Vector3d& vtMove, Point3d& ptContact) ;
|
||||
double DiskPointLeakDistOrtMot( const Point3d& ptDisc, const Vector3d& vtDiskAx, double dDiscRad,
|
||||
const Point3d& ptP, const Vector3d& vtMove) ;
|
||||
|
||||
// Funzioni geometriche di base
|
||||
double GetPointLineSqDist( const Point3d& ptP, const Point3d& ptLine, const Vector3d& vtLine) ;
|
||||
@@ -97,12 +96,15 @@ double LineSegmentSqDist( const Point3d& ptPLn, const Vector3d& vtDLn,
|
||||
const Point3d& ptPSg, const Vector3d& vtDSg, double dSgLen) ;
|
||||
bool IsPointInsideTriangle( const Point3d& ptP, const Triangle3d& trTria) ;
|
||||
bool CoplanarDiscTriangleInterferance( const Point3d& ptCen, double dRad, const Triangle3d& trTria) ;
|
||||
bool FindMinDistPar( const Point3d& ptL1, const Point3d& ptL2,
|
||||
const Vector3d& vtV1, const Vector3d& vtV2,
|
||||
double& dU1, double& dU2) ;
|
||||
bool FindLineLineMinDistPar( const Point3d& ptL1, const Vector3d& vtV1,
|
||||
const Point3d& ptL2, const Vector3d& vtV2,
|
||||
double& dU1, double& dU2) ;
|
||||
int SphereLineTangentPoints( const Point3d& ptSpheCen, double dSpheRad,
|
||||
const Point3d& ptSeg, const Vector3d& vtSegDir, double dSegLen,
|
||||
const Vector3d& vtMove, double& dU1, double& dU2) ;
|
||||
int DiskPlaneLastContactLongMot( const Point3d& ptDiskCen, double dDiskRad,
|
||||
const Point3d& ptPlane, const Vector3d& vtPlane,
|
||||
const Vector3d& vtMove, Point3d& ptTouch) ;
|
||||
|
||||
// Altre funzioni
|
||||
inline double EvalSecondDegreePolynomial( double dCoeff0, double dCoeff1, double dCoeff2, double dVariable)
|
||||
|
||||
Binary file not shown.
+18
-18
@@ -3003,7 +3003,7 @@ GdbExecutor::LineDiscInters( const STRVECTOR& vsParams)
|
||||
return false ;
|
||||
|
||||
double dU1, dU2 ;
|
||||
int nIntType = LineDisc( ptDisc, ptLine, vtDisc, vtLine, dRadius, dU1, dU2) ;
|
||||
int nIntType = LineDisc( ptLine, vtLine, ptDisc, vtDisc, dRadius, dU1, dU2) ;
|
||||
|
||||
Point3d ptPS = ptLine + dU1 * vtLine ;
|
||||
Point3d ptPE = ptLine + dU2 * vtLine ;
|
||||
@@ -3073,7 +3073,7 @@ GdbExecutor::RayDiscInters( const STRVECTOR& vsParams)
|
||||
return false ;
|
||||
|
||||
double dU1, dU2 ;
|
||||
int nIntType = RayDisc( ptDisc, ptLine, vtDisc, vtLine, dRadius, dU1, dU2) ;
|
||||
int nIntType = RayDisc( ptLine, vtLine, ptDisc, vtDisc, dRadius, dU1, dU2) ;
|
||||
|
||||
Point3d ptPS = ptLine + dU1 * vtLine ;
|
||||
Point3d ptPE = ptLine + dU2 * vtLine ;
|
||||
@@ -3147,7 +3147,7 @@ GdbExecutor::SegmentDiscInters( const STRVECTOR& vsParams)
|
||||
return false ;
|
||||
|
||||
double dU1, dU2 ;
|
||||
int nIntType = SegmentDisc( ptDisc, ptLine, vtDisc, vtLine, dRadius, dLen, dU1, dU2) ;
|
||||
int nIntType = SegmentDisc( ptLine, vtLine, dLen, ptDisc, vtDisc, dRadius, dU1, dU2) ;
|
||||
|
||||
Point3d ptPS = ptLine + dU1 * vtLine ;
|
||||
Point3d ptPE = ptLine + dU2 * vtLine ;
|
||||
@@ -3212,7 +3212,7 @@ GdbExecutor::LineSphereInters( const STRVECTOR& vsParams)
|
||||
return false ;
|
||||
|
||||
double dU1, dU2 ;
|
||||
int nIntType = LineSphere( ptC, ptP, vtV, dRadius, dU1, dU2) ;
|
||||
int nIntType = LineSphere( ptP, vtV, ptC, dRadius, dU1, dU2) ;
|
||||
|
||||
Point3d ptPS = ptP + dU1 * vtV ;
|
||||
Point3d ptPE = ptP + dU2 * vtV ;
|
||||
@@ -3265,7 +3265,7 @@ GdbExecutor::RaySphereInters( const STRVECTOR& vsParams)
|
||||
return false ;
|
||||
|
||||
double dU1, dU2 ;
|
||||
int nIntType = RaySphere( ptC, ptP, vtV, dRadius, dU1, dU2) ;
|
||||
int nIntType = RaySphere( ptP, vtV, ptC, dRadius, dU1, dU2) ;
|
||||
|
||||
Point3d ptPS = ptP + dU1 * vtV ;
|
||||
Point3d ptPE = ptP + dU2 * vtV ;
|
||||
@@ -3329,7 +3329,7 @@ GdbExecutor::SegmentSphereInters( const STRVECTOR& vsParams)
|
||||
return false ;
|
||||
|
||||
double dU1, dU2 ;
|
||||
int nIntType = SegmentSphere( ptC, ptP, vtV, dRadius, dLen, dU1, dU2) ;
|
||||
int nIntType = SegmentSphere( ptP, vtV, dLen, ptC, dRadius, dU1, dU2) ;
|
||||
|
||||
|
||||
if ( nIntType == S_ERROR_INT)
|
||||
@@ -3396,7 +3396,7 @@ GdbExecutor::LineSemiSphereInters( const STRVECTOR& vsParams)
|
||||
return false ;
|
||||
|
||||
double dU1, dU2 ;
|
||||
int nIntType = LineSemiSphere( ptC, ptP, vtSphOr, vtV, dRadius, dU1, dU2) ;
|
||||
int nIntType = LineSemiSphere( ptP, vtV, ptC, vtSphOr, dRadius, dU1, dU2) ;
|
||||
|
||||
Point3d ptPS = ptP + dU1 * vtV ;
|
||||
Point3d ptPE = ptP + dU2 * vtV ;
|
||||
@@ -3455,7 +3455,7 @@ GdbExecutor::RaySemiSphereInters( const STRVECTOR& vsParams)
|
||||
return false ;
|
||||
|
||||
double dU1, dU2 ;
|
||||
int nIntType = RaySemiSphere( ptC, ptP, vtSphOr, vtV, dRadius, dU1, dU2) ;
|
||||
int nIntType = RaySemiSphere( ptP, vtV, ptC, vtSphOr, dRadius, dU1, dU2) ;
|
||||
|
||||
Point3d ptPS = ptP + dU1 * vtV ;
|
||||
Point3d ptPE = ptP + dU2 * vtV ;
|
||||
@@ -3524,7 +3524,7 @@ GdbExecutor::SegmentSemiSphereInters( const STRVECTOR& vsParams)
|
||||
return false ;
|
||||
|
||||
double dU1, dU2 ;
|
||||
int nIntType = SegmentSemiSphere( ptC, ptP, vtSphOr, vtV, dRadius, dLen, dU1, dU2) ;
|
||||
int nIntType = SegmentSemiSphere( ptP, vtV, dLen, ptC, vtSphOr, dRadius, dU1, dU2) ;
|
||||
|
||||
|
||||
if ( nIntType == S_ERROR_INT)
|
||||
@@ -3598,7 +3598,7 @@ GdbExecutor::LinCompSemiSphereInters( const STRVECTOR& vsParams)
|
||||
return false ;
|
||||
|
||||
double dU1, dU2 ;
|
||||
int nIntType = LinCompSemiSphere( ptC, ptP, vtSphOr, vtV, dRadius, dLen, nLinType, dU1, dU2) ;
|
||||
int nIntType = LinCompSemiSphere( ptP, vtV, dLen, nLinType, ptC, vtSphOr, dRadius, dU1, dU2) ;
|
||||
|
||||
if ( nIntType == S_ERROR_INT)
|
||||
return false ;
|
||||
@@ -3966,7 +3966,7 @@ GdbExecutor::SegmentConeInters( const STRVECTOR& vsParams)
|
||||
return false ;
|
||||
|
||||
double dU1, dU2 ;
|
||||
int nTypeInt = SegmentCone( ptVCone, ptLine, vtCone, vtLine, dRadius, dHeigth, dLen, dU1, dU2) ;
|
||||
int nTypeInt = SegmentCone( ptLine, vtLine, dLen, ptVCone, vtCone, dRadius, dHeigth, dU1, dU2) ;
|
||||
Point3d ptPS = ptLine + dU1 * vtLine ;
|
||||
Point3d ptPE = ptLine + dU2 * vtLine ;
|
||||
|
||||
@@ -4049,7 +4049,7 @@ GdbExecutor::LineTruncateConeInters( const STRVECTOR& vsParams)
|
||||
return false ;
|
||||
|
||||
double dU1, dU2 ;
|
||||
int nTypeInt = LineTruncatedCone( ptMinBase, ptLine, vtCone, vtLine, dMinRad, dMaxRad, dConeHeigth, dU1, dU2) ;
|
||||
int nTypeInt = LineTruncatedCone( ptLine, vtLine, ptMinBase, vtCone, dMinRad, dMaxRad, dConeHeigth, dU1, dU2) ;
|
||||
Point3d ptPS = ptLine + dU1 * vtLine ;
|
||||
Point3d ptPE = ptLine + dU2 * vtLine ;
|
||||
|
||||
@@ -4133,7 +4133,7 @@ GdbExecutor::RayTruncateConeInters( const STRVECTOR& vsParams)
|
||||
return false ;
|
||||
|
||||
double dU1, dU2 ;
|
||||
int nTypeInt = RayTruncatedCone( ptMinBase, ptLine, vtCone, vtLine, dMinRad, dMaxRad, dConeHeigth, dU1, dU2) ;
|
||||
int nTypeInt = RayTruncatedCone( ptLine, vtLine, ptMinBase, vtCone, dMinRad, dMaxRad, dConeHeigth, dU1, dU2) ;
|
||||
Point3d ptPS = ptLine + dU1 * vtLine ;
|
||||
Point3d ptPE = ptLine + dU2 * vtLine ;
|
||||
|
||||
@@ -4220,7 +4220,7 @@ GdbExecutor::SegmentTruncateConeInters( const STRVECTOR& vsParams)
|
||||
return false ;
|
||||
|
||||
double dU1, dU2 ;
|
||||
int nTypeInt = SegmentTruncatedCone( ptMinBase, ptLine, vtCone, vtLine, dMinRad, dMaxRad, dConeHeigth, dLen, dU1, dU2) ;
|
||||
int nTypeInt = SegmentTruncatedCone( ptLine, vtLine, dLen, ptMinBase, vtCone, dMinRad, dMaxRad, dConeHeigth, dU1, dU2) ;
|
||||
Point3d ptPS = ptLine + dU1 * vtLine ;
|
||||
Point3d ptPE = ptLine + dU2 * vtLine ;
|
||||
|
||||
@@ -4300,7 +4300,7 @@ GdbExecutor::LineTorusInters( const STRVECTOR& vsParams)
|
||||
|
||||
std::vector<double> vdP ;
|
||||
std::vector<bool> vbT ;
|
||||
int nTypeInt = LineTorus( ptTorus, ptLine, vtTorus, vtLine, dMinRad, dMaxRad, vdP, vbT) ;
|
||||
int nTypeInt = LineTorus( ptLine, vtLine, ptTorus, vtTorus, dMinRad, dMaxRad, vbT, vdP) ;
|
||||
|
||||
if ( nTypeInt == T_ERROR)
|
||||
return false ;
|
||||
@@ -4417,7 +4417,7 @@ GdbExecutor::RayTorusInters( const STRVECTOR& vsParams)
|
||||
|
||||
std::vector<double> vdP ;
|
||||
std::vector<bool> vbT ;
|
||||
int nTypeInt = RayTorus( ptTorus, ptLine, vtTorus, vtLine, dMinRad, dMaxRad, vdP, vbT) ;
|
||||
int nTypeInt = RayTorus( ptLine, vtLine, ptTorus, vtTorus, dMinRad, dMaxRad, vbT, vdP) ;
|
||||
|
||||
if ( nTypeInt == T_ERROR)
|
||||
return false ;
|
||||
@@ -4573,7 +4573,7 @@ GdbExecutor::SegmentTorusInters( const STRVECTOR& vsParams)
|
||||
|
||||
std::vector<double> vdP ;
|
||||
std::vector<bool> vbT ;
|
||||
int nTypeInt = SegmentTorus( ptTorus, ptLine, vtTorus, vtLine, dMinRad, dMaxRad, dSgLen, vdP, vbT) ;
|
||||
int nTypeInt = SegmentTorus( ptLine, vtLine, dSgLen, ptTorus, vtTorus, dMinRad, dMaxRad, vbT, vdP) ;
|
||||
|
||||
if ( nTypeInt == T_ERROR)
|
||||
return false ;
|
||||
@@ -4747,7 +4747,7 @@ GdbExecutor::LinCompTorusPartInters( const STRVECTOR& vsParams)
|
||||
|
||||
std::vector<double> vdP ;
|
||||
std::vector<bool> vbT ;
|
||||
int nTypeInt = LinCompTorusExtInt( ptTorus, ptLine, vtTorus, vtLine, dMinRad, dMaxRad, dSgLen, nLinType, vdP, vbT) ;
|
||||
int nTypeInt = LinCompTorusExtInt( ptLine, vtLine, dSgLen, nLinType, ptTorus, vtTorus, dMinRad, dMaxRad, vbT, vdP) ;
|
||||
|
||||
if ( nTypeInt == T_ERROR)
|
||||
return false ;
|
||||
|
||||
+123
-81
@@ -18,8 +18,10 @@
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int LineDisc( const Point3d& ptPDisc, const Point3d& ptPLine, const Vector3d& vtVDisc, const Vector3d& vtVLine,
|
||||
double dRad, double& dU1, double& dU2)
|
||||
int
|
||||
LineDisc( const Point3d& ptPLine, const Vector3d& vtVLine,
|
||||
const Point3d& ptPDisc, const Vector3d& vtVDisc, double dRad,
|
||||
double& dU1, double& dU2)
|
||||
{
|
||||
int nIntType ;
|
||||
// Se il raggio non è significativamente
|
||||
@@ -115,10 +117,12 @@ int LineDisc( const Point3d& ptPDisc, const Point3d& ptPLine, const Vector3d& vt
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int RayDisc( const Point3d& ptPDisc, const Point3d& ptPLine, const Vector3d& vtVDisc, const Vector3d& vtVLine,
|
||||
double dRad, double& dU1, double& dU2)
|
||||
int
|
||||
RayDisc( const Point3d& ptPLine, const Vector3d& vtVLine,
|
||||
const Point3d& ptPDisc, const Vector3d& vtVDisc, double dRad,
|
||||
double& dU1, double& dU2)
|
||||
{
|
||||
int nIntType = LineDisc( ptPDisc, ptPLine, vtVDisc, vtVLine, dRad, dU1, dU2) ;
|
||||
int nIntType = LineDisc( ptPLine, vtVLine, ptPDisc, vtVDisc, dRad, dU1, dU2) ;
|
||||
if ( nIntType == D_ERROR_INT)
|
||||
return nIntType ;
|
||||
|
||||
@@ -148,10 +152,12 @@ int RayDisc( const Point3d& ptPDisc, const Point3d& ptPLine, const Vector3d& vtV
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int SegmentDisc( const Point3d& ptPDisc, const Point3d& ptPLine, const Vector3d& vtVDisc, const Vector3d& vtVLine,
|
||||
double dRad, double dLen, double& dU1, double& dU2)
|
||||
int
|
||||
SegmentDisc( const Point3d& ptPLine, const Vector3d& vtVLine, double dLen,
|
||||
const Point3d& ptPDisc, const Vector3d& vtVDisc, double dRad,
|
||||
double& dU1, double& dU2)
|
||||
{
|
||||
int nIntType = LineDisc( ptPDisc, ptPLine, vtVDisc, vtVLine, dRad, dU1, dU2) ;
|
||||
int nIntType = LineDisc( ptPLine, vtVLine, ptPDisc, vtVDisc, dRad, dU1, dU2) ;
|
||||
if ( nIntType == D_ERROR_INT)
|
||||
return nIntType ;
|
||||
|
||||
@@ -182,8 +188,10 @@ int SegmentDisc( const Point3d& ptPDisc, const Point3d& ptPLine, const Vector3d&
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int LineSphere( const Point3d& ptSphC, const Point3d& ptPLine, const Vector3d& vtVLine,
|
||||
double dRad, double& dU1, double& dU2)
|
||||
int
|
||||
LineSphere( const Point3d& ptPLine, const Vector3d& vtVLine,
|
||||
const Point3d& ptSphC, double dRad,
|
||||
double& dU1, double& dU2)
|
||||
{
|
||||
int nIntType = S_ERROR_INT ;
|
||||
// Se il raggio non è significativamente
|
||||
@@ -219,10 +227,12 @@ int LineSphere( const Point3d& ptSphC, const Point3d& ptPLine, const Vector3d& v
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int RaySphere( const Point3d& ptSphC, const Point3d& ptPLine, const Vector3d& vtVLine,
|
||||
double dRad, double& dU1, double& dU2)
|
||||
int
|
||||
RaySphere( const Point3d& ptPLine, const Vector3d& vtVLine,
|
||||
const Point3d& ptSphC, double dRad,
|
||||
double& dU1, double& dU2)
|
||||
{
|
||||
int nIntType = LineSphere( ptSphC, ptPLine, vtVLine, dRad, dU1, dU2) ;
|
||||
int nIntType = LineSphere( ptPLine, vtVLine, ptSphC, dRad, dU1, dU2) ;
|
||||
if ( nIntType == S_ERROR_INT)
|
||||
return nIntType ;
|
||||
|
||||
@@ -250,10 +260,12 @@ int RaySphere( const Point3d& ptSphC, const Point3d& ptPLine, const Vector3d& vt
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int SegmentSphere( const Point3d& ptSphC, const Point3d& ptPLine, const Vector3d& vtVLine,
|
||||
double dRad, double dLen, double& dU1, double& dU2)
|
||||
int
|
||||
SegmentSphere( const Point3d& ptPLine, const Vector3d& vtVLine, double dLen,
|
||||
const Point3d& ptSphC, double dRad,
|
||||
double& dU1, double& dU2)
|
||||
{
|
||||
int nIntType = LineSphere( ptSphC, ptPLine, vtVLine, dRad, dU1, dU2) ;
|
||||
int nIntType = LineSphere( ptPLine, vtVLine, ptSphC, dRad, dU1, dU2) ;
|
||||
if ( nIntType == S_ERROR_INT)
|
||||
return nIntType ;
|
||||
|
||||
@@ -296,11 +308,12 @@ int SegmentSphere( const Point3d& ptSphC, const Point3d& ptPLine, const Vector3d
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int LineSemiSphere( const Point3d& ptSphC, const Point3d& ptPLine,
|
||||
const Vector3d& vtSSphOrient, const Vector3d& vtVLine,
|
||||
double dRad, double& dU1, double& dU2)
|
||||
int
|
||||
LineSemiSphere( const Point3d& ptPLine, const Vector3d& vtVLine,
|
||||
const Point3d& ptSphC, const Vector3d& vtSSphOrient, double dRad,
|
||||
double& dU1, double& dU2)
|
||||
{
|
||||
int nIntType = LineSphere( ptSphC, ptPLine, vtVLine, dRad, dU1, dU2) ;
|
||||
int nIntType = LineSphere( ptPLine, vtVLine, ptSphC, dRad, dU1, dU2) ;
|
||||
if ( nIntType == S_ERROR_INT || ( ! vtSSphOrient.IsNormalized()))
|
||||
return S_ERROR_INT ;
|
||||
// Un punto di tangenza
|
||||
@@ -340,11 +353,12 @@ int LineSemiSphere( const Point3d& ptSphC, const Point3d& ptPLine,
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int RaySemiSphere( const Point3d& ptSphC, const Point3d& ptPLine,
|
||||
const Vector3d& vtSSphOrient, const Vector3d& vtVLine,
|
||||
double dRad, double& dU1, double& dU2)
|
||||
int
|
||||
RaySemiSphere( const Point3d& ptPLine, const Vector3d& vtVLine,
|
||||
const Point3d& ptSphC, const Vector3d& vtSSphOrient, double dRad,
|
||||
double& dU1, double& dU2)
|
||||
{
|
||||
int nIntType = RaySphere( ptSphC, ptPLine, vtVLine, dRad, dU1, dU2) ;
|
||||
int nIntType = RaySphere( ptPLine, vtVLine, ptSphC, dRad, dU1, dU2) ;
|
||||
if ( nIntType == S_ERROR_INT || ( ! vtSSphOrient.IsNormalized()))
|
||||
return S_ERROR_INT ;
|
||||
// Un Punto in cui la semi-retta interferisce con la semi-sfera
|
||||
@@ -384,11 +398,12 @@ int RaySemiSphere( const Point3d& ptSphC, const Point3d& ptPLine,
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int SegmentSemiSphere( const Point3d& ptSphC, const Point3d& ptPLine,
|
||||
const Vector3d& vtSSphOrient, const Vector3d& vtVLine,
|
||||
double dRad, double dLen, double& dU1, double& dU2)
|
||||
int
|
||||
SegmentSemiSphere( const Point3d& ptPLine, const Vector3d& vtVLine, double dLen,
|
||||
const Point3d& ptSphC, const Vector3d& vtSSphOrient, double dRad,
|
||||
double& dU1, double& dU2)
|
||||
{
|
||||
int nIntType = SegmentSphere( ptSphC, ptPLine, vtVLine, dRad, dLen, dU1, dU2) ;
|
||||
int nIntType = SegmentSphere( ptPLine, vtVLine, dLen, ptSphC, dRad, dU1, dU2) ;
|
||||
if ( nIntType == S_ERROR_INT || ( ! vtSSphOrient.IsNormalized()))
|
||||
return S_ERROR_INT ;
|
||||
// Un Punto in cui il segmento interferisce con la semi-sfera
|
||||
@@ -428,20 +443,21 @@ int SegmentSemiSphere( const Point3d& ptSphC, const Point3d& ptPLine,
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int LinCompSemiSphere( const Point3d& ptSphC, const Point3d& ptPLine,
|
||||
const Vector3d& vtSSphOrient, const Vector3d& vtVLine,
|
||||
double dRad, double dLen, int nLinType, double& dU1, double& dU2)
|
||||
int
|
||||
LinCompSemiSphere( const Point3d& ptPLine, const Vector3d& vtVLine, double dLen, int nLinType,
|
||||
const Point3d& ptSphC, const Vector3d& vtSSphOrient, double dRad,
|
||||
double& dU1, double& dU2)
|
||||
{
|
||||
int nIntType ;
|
||||
// Retta
|
||||
if ( nLinType == Line)
|
||||
nIntType = LineSphere( ptSphC, ptPLine, vtVLine, dRad, dU1, dU2) ;
|
||||
nIntType = LineSphere( ptPLine, vtVLine, ptSphC, dRad, dU1, dU2) ;
|
||||
// Semi-retta
|
||||
else if ( nLinType == Ray)
|
||||
nIntType = RaySphere( ptSphC, ptPLine, vtVLine, dRad, dU1, dU2) ;
|
||||
nIntType = RaySphere( ptPLine, vtVLine, ptSphC, dRad, dU1, dU2) ;
|
||||
// Segmento
|
||||
else if ( nLinType == Segment)
|
||||
nIntType = SegmentSphere( ptSphC, ptPLine, vtVLine, dRad, dLen, dU1, dU2) ;
|
||||
nIntType = SegmentSphere( ptPLine, vtVLine, dLen, ptSphC, dRad, dU1, dU2) ;
|
||||
// Errore
|
||||
else
|
||||
nIntType = S_ERROR_INT ;
|
||||
@@ -690,8 +706,9 @@ IntersLineSemiFiniteCylinder( const Point3d& ptPLine, const Vector3d& vtVLine,
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
RaySemiFiniteCylinder( const Point3d& ptPCyl, const Point3d& ptPLine, const Vector3d& vtVCyl, const Vector3d& vtVLine,
|
||||
double dCylRad, double& dU1, double& dU2)
|
||||
RaySemiFiniteCylinder( const Point3d& ptPLine, const Vector3d& vtVLine,
|
||||
const Point3d& ptPCyl, const Vector3d& vtVCyl, double dCylRad,
|
||||
double& dU1, double& dU2)
|
||||
{
|
||||
int nIntType = IntersLineSemiFiniteCylinder( ptPLine, vtVLine, ptPCyl, vtVCyl, dCylRad, dU1, dU2) ;
|
||||
if ( nIntType == CC_ERROR_INT)
|
||||
@@ -736,8 +753,9 @@ RaySemiFiniteCylinder( const Point3d& ptPCyl, const Point3d& ptPLine, const Vect
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
SegmentSemiFiniteCylinder( const Point3d& ptPCyl, const Point3d& ptPLine, const Vector3d& vtVCyl, const Vector3d& vtVLine,
|
||||
double dCylRad, double dLen, double& dU1, double& dU2)
|
||||
SegmentSemiFiniteCylinder( const Point3d& ptPLine, const Vector3d& vtVLine, double dLen,
|
||||
const Point3d& ptPCyl, const Vector3d& vtVCyl, double dCylRad,
|
||||
double& dU1, double& dU2)
|
||||
{
|
||||
int nIntType = IntersLineSemiFiniteCylinder( ptPLine, vtVLine, ptPCyl, vtVCyl, dCylRad, dU1, dU2) ;
|
||||
if ( nIntType == CC_ERROR_INT)
|
||||
@@ -861,8 +879,9 @@ IntersLineCylinder( const Point3d& ptPLine, const Vector3d& vtVLine,
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
RayCylinder( const Point3d& ptPCyl, const Point3d& ptPLine, const Vector3d& vtVCyl, const Vector3d& vtVLine,
|
||||
double dCylRad, double dCylHeigth, double& dU1, double& dU2)
|
||||
RayCylinder( const Point3d& ptPLine, const Vector3d& vtVLine,
|
||||
const Point3d& ptPCyl, const Vector3d& vtVCyl, double dCylRad, double dCylHeigth,
|
||||
double& dU1, double& dU2)
|
||||
{
|
||||
int nIntType = IntersLineCylinder( ptPLine, vtVLine, ptPCyl, vtVCyl, dCylRad, dCylHeigth, dU1, dU2) ;
|
||||
if ( nIntType == CC_ERROR_INT)
|
||||
@@ -972,8 +991,9 @@ IntersSegmentCylinder( const Point3d& ptPLine, const Vector3d& vtVLine, double d
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
LineInfiniteCone( const Point3d& ptVCone, const Point3d& ptPLine, const Vector3d& vtDCone, const Vector3d& vtDLine,
|
||||
double dConeRad, double dConeHeigth, double& dU1, double& dU2)
|
||||
LineInfiniteCone( const Point3d& ptPLine, const Vector3d& vtDLine,
|
||||
const Point3d& ptVCone, const Vector3d& vtDCone, double dConeRad, double dConeHeigth,
|
||||
double& dU1, double& dU2)
|
||||
{
|
||||
int nIntType ;
|
||||
// Raggio e altezza del cono devono essere maggiori di zero
|
||||
@@ -1117,10 +1137,12 @@ LineInfiniteCone( const Point3d& ptVCone, const Point3d& ptPLine, const Vector3d
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int RayInfiniteCone( const Point3d& ptVCone, const Point3d& ptPLine, const Vector3d& vtDCone, const Vector3d& vtDLine,
|
||||
double dConeRad, double dConeHeigth, double& dU1, double& dU2)
|
||||
int
|
||||
RayInfiniteCone( const Point3d& ptPLine, const Vector3d& vtDLine,
|
||||
const Point3d& ptVCone, const Vector3d& vtDCone, double dConeRad, double dConeHeigth,
|
||||
double& dU1, double& dU2)
|
||||
{
|
||||
int nIntType = LineInfiniteCone( ptVCone, ptPLine, vtDCone, vtDLine, dConeRad, dConeHeigth, dU1, dU2) ;
|
||||
int nIntType = LineInfiniteCone( ptPLine, vtDLine, ptVCone, vtDCone, dConeRad, dConeHeigth, dU1, dU2) ;
|
||||
if ( nIntType == CC_ERROR_INT)
|
||||
return nIntType ;
|
||||
|
||||
@@ -1163,10 +1185,12 @@ int RayInfiniteCone( const Point3d& ptVCone, const Point3d& ptPLine, const Vecto
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int SegmentInfiniteCone( const Point3d& ptVCone, const Point3d& ptPLine, const Vector3d& vtDCone, const Vector3d& vtDLine,
|
||||
double dConeRad, double dConeHeigth, double dSgLen, double& dU1, double& dU2)
|
||||
int
|
||||
SegmentInfiniteCone( const Point3d& ptPLine, const Vector3d& vtDLine, double dSgLen,
|
||||
const Point3d& ptVCone, const Vector3d& vtDCone, double dConeRad, double dConeHeigth,
|
||||
double& dU1, double& dU2)
|
||||
{
|
||||
int nIntType = LineInfiniteCone( ptVCone, ptPLine, vtDCone, vtDLine, dConeRad, dConeHeigth, dU1, dU2) ;
|
||||
int nIntType = LineInfiniteCone( ptPLine, vtDLine, ptVCone, vtDCone, dConeRad, dConeHeigth, dU1, dU2) ;
|
||||
if ( nIntType == CC_ERROR_INT)
|
||||
return nIntType ;
|
||||
|
||||
@@ -1233,10 +1257,12 @@ int SegmentInfiniteCone( const Point3d& ptVCone, const Point3d& ptPLine, const V
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int LineCone( const Point3d& ptVCone, const Point3d& ptPLine, const Vector3d& vtDCone, const Vector3d& vtDLine,
|
||||
double dConeRad, double dConeHeigth, double& dU1, double& dU2)
|
||||
int
|
||||
LineCone( const Point3d& ptPLine, const Vector3d& vtDLine,
|
||||
const Point3d& ptVCone, const Vector3d& vtDCone, double dConeRad, double dConeHeigth,
|
||||
double& dU1, double& dU2)
|
||||
{
|
||||
int nIntType = LineInfiniteCone( ptVCone, ptPLine, vtDCone, vtDLine, dConeRad, dConeHeigth, dU1, dU2) ;
|
||||
int nIntType = LineInfiniteCone( ptPLine, vtDLine, ptVCone, vtDCone, dConeRad, dConeHeigth, dU1, dU2) ;
|
||||
if ( nIntType == CC_ERROR_INT)
|
||||
return nIntType ;
|
||||
// Tangnte dell'angolo semi-apertura del cono
|
||||
@@ -1285,10 +1311,12 @@ int LineCone( const Point3d& ptVCone, const Point3d& ptPLine, const Vector3d& vt
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int RayCone( const Point3d& ptVCone, const Point3d& ptPLine, const Vector3d& vtDCone, const Vector3d& vtDLine,
|
||||
double dConeRad, double dConeHeigth, double& dU1, double& dU2)
|
||||
int
|
||||
RayCone( const Point3d& ptPLine, const Vector3d& vtDLine,
|
||||
const Point3d& ptVCone, const Vector3d& vtDCone, double dConeRad, double dConeHeigth,
|
||||
double& dU1, double& dU2)
|
||||
{
|
||||
int nIntType = LineCone( ptVCone, ptPLine, vtDCone, vtDLine, dConeRad, dConeHeigth, dU1, dU2) ;
|
||||
int nIntType = LineCone( ptPLine, vtDLine, ptVCone, vtDCone, dConeRad, dConeHeigth, dU1, dU2) ;
|
||||
if ( nIntType == CC_ERROR_INT)
|
||||
return nIntType ;
|
||||
// Parte della retta associata
|
||||
@@ -1332,10 +1360,12 @@ int RayCone( const Point3d& ptVCone, const Point3d& ptPLine, const Vector3d& vtD
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int SegmentCone( const Point3d& ptVCone, const Point3d& ptPLine, const Vector3d& vtDCone, const Vector3d& vtDLine,
|
||||
double dConeRad, double dConeHeigth, double dSgLen, double& dU1, double& dU2)
|
||||
int
|
||||
SegmentCone( const Point3d& ptPLine, const Vector3d& vtDLine, double dSgLen,
|
||||
const Point3d& ptVCone, const Vector3d& vtDCone, double dConeRad, double dConeHeigth,
|
||||
double& dU1, double& dU2)
|
||||
{
|
||||
int nIntType = LineCone( ptVCone, ptPLine, vtDCone, vtDLine, dConeRad, dConeHeigth, dU1, dU2) ;
|
||||
int nIntType = LineCone( ptPLine, vtDLine, ptVCone, vtDCone, dConeRad, dConeHeigth, dU1, dU2) ;
|
||||
if ( nIntType == CC_ERROR_INT)
|
||||
return nIntType ;
|
||||
|
||||
@@ -1398,8 +1428,10 @@ int SegmentCone( const Point3d& ptVCone, const Point3d& ptPLine, const Vector3d&
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int LineTruncatedCone( const Point3d& ptMinBase, const Point3d& ptPLine, const Vector3d& vtDCone, const Vector3d& vtDLine,
|
||||
double dMinRad, double dMaxRad, double dHeigth, double& dU1, double& dU2)
|
||||
int
|
||||
LineTruncatedCone( const Point3d& ptPLine, const Vector3d& vtDLine,
|
||||
const Point3d& ptMinBase, const Vector3d& vtDCone, double dMinRad, double dMaxRad, double dHeigth,
|
||||
double& dU1, double& dU2)
|
||||
{
|
||||
// Controlli sull'ammissibilità del tronco di cono
|
||||
if ( ! ( dMinRad > EPS_SMALL && dMaxRad > EPS_SMALL && dHeigth > EPS_SMALL))
|
||||
@@ -1408,7 +1440,7 @@ int LineTruncatedCone( const Point3d& ptMinBase, const Point3d& ptPLine, const V
|
||||
double dDeltaH = dMinRad * dHeigth / ( dMaxRad - dMinRad) ;
|
||||
Point3d ptVCone = ptMinBase - dDeltaH * vtDCone ;
|
||||
|
||||
int nIntType = LineInfiniteCone( ptVCone, ptPLine, vtDCone, vtDLine, dMinRad, dDeltaH, dU1, dU2) ;
|
||||
int nIntType = LineInfiniteCone( ptPLine, vtDLine, ptVCone, vtDCone, dMinRad, dDeltaH, dU1, dU2) ;
|
||||
if ( nIntType == CC_ERROR_INT)
|
||||
return nIntType ;
|
||||
|
||||
@@ -1468,10 +1500,12 @@ int LineTruncatedCone( const Point3d& ptMinBase, const Point3d& ptPLine, const V
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int RayTruncatedCone( const Point3d& ptMinBase, const Point3d& ptPLine, const Vector3d& vtDCone, const Vector3d& vtDLine,
|
||||
double dMinRad, double dMaxRad, double dHeigth, double& dU1, double& dU2)
|
||||
int
|
||||
RayTruncatedCone( const Point3d& ptPLine, const Vector3d& vtDLine,
|
||||
const Point3d& ptMinBase, const Vector3d& vtDCone, double dMinRad, double dMaxRad, double dHeigth,
|
||||
double& dU1, double& dU2)
|
||||
{
|
||||
int nIntType = LineTruncatedCone( ptMinBase, ptPLine, vtDCone, vtDLine, dMinRad, dMaxRad, dHeigth, dU1, dU2) ;
|
||||
int nIntType = LineTruncatedCone( ptPLine, vtDLine, ptMinBase, vtDCone, dMinRad, dMaxRad, dHeigth, dU1, dU2) ;
|
||||
if ( nIntType == CC_ERROR_INT)
|
||||
return nIntType ;
|
||||
|
||||
@@ -1517,10 +1551,12 @@ int RayTruncatedCone( const Point3d& ptMinBase, const Point3d& ptPLine, const Ve
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int SegmentTruncatedCone( const Point3d& ptMinBase, const Point3d& ptPLine, const Vector3d& vtDCone, const Vector3d& vtDLine,
|
||||
double dMinRad, double dMaxRad, double dHeigth, double dSgLen, double& dU1, double& dU2)
|
||||
int
|
||||
SegmentTruncatedCone( const Point3d& ptPLine, const Vector3d& vtDLine, double dSgLen,
|
||||
const Point3d& ptMinBase, const Vector3d& vtDCone, double dMinRad, double dMaxRad, double dHeigth,
|
||||
double& dU1, double& dU2)
|
||||
{
|
||||
int nIntType = LineTruncatedCone( ptMinBase, ptPLine, vtDCone, vtDLine, dMinRad, dMaxRad, dHeigth, dU1, dU2) ;
|
||||
int nIntType = LineTruncatedCone( ptPLine, vtDLine, ptMinBase, vtDCone, dMinRad, dMaxRad, dHeigth, dU1, dU2) ;
|
||||
if ( nIntType == CC_ERROR_INT)
|
||||
return nIntType ;
|
||||
// Parte della retta associata giace sul tronco
|
||||
@@ -1583,8 +1619,10 @@ int SegmentTruncatedCone( const Point3d& ptMinBase, const Point3d& ptPLine, cons
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int LineTorus( const Point3d& ptOTorus, const Point3d& ptLine, const Vector3d& vtAxTorus, const Vector3d& vtLine,
|
||||
double dMinRad, double dMaxRad, vector<double>& vdPar, vector<bool>& vbType)
|
||||
int
|
||||
LineTorus( const Point3d& ptLine, const Vector3d& vtLine,
|
||||
const Point3d& ptOTorus, const Vector3d& vtAxTorus, double dMinRad, double dMaxRad,
|
||||
vector<bool>& vbType, vector<double>& vdPar)
|
||||
{
|
||||
int nIntType = T_ERROR ;
|
||||
// Si richiede che i vettori siano normalizzati
|
||||
@@ -1734,10 +1772,12 @@ int LineTorus( const Point3d& ptOTorus, const Point3d& ptLine, const Vector3d& v
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int RayTorus( const Point3d& ptOTorus, const Point3d& ptLine, const Vector3d& vtAxTorus, const Vector3d& vtLine,
|
||||
double dMinRad, double dMaxRad, vector<double>& vdPar, vector<bool>& vbType)
|
||||
int
|
||||
RayTorus( const Point3d& ptLine, const Vector3d& vtLine,
|
||||
const Point3d& ptOTorus, const Vector3d& vtAxTorus, double dMinRad, double dMaxRad,
|
||||
vector<bool>& vbType, vector<double>& vdPar)
|
||||
{
|
||||
int nIntType = LineTorus( ptOTorus, ptLine, vtAxTorus, vtLine, dMinRad, dMaxRad, vdPar, vbType) ;
|
||||
int nIntType = LineTorus( ptLine, vtLine, ptOTorus, vtAxTorus, dMinRad, dMaxRad, vbType, vdPar) ;
|
||||
if ( nIntType == T_ERROR || nIntType == T_NO_INT)
|
||||
return nIntType ;
|
||||
|
||||
@@ -1818,10 +1858,12 @@ int RayTorus( const Point3d& ptOTorus, const Point3d& ptLine, const Vector3d& vt
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int SegmentTorus( const Point3d& ptOTorus, const Point3d& ptLine, const Vector3d& vtAxTorus, const Vector3d& vtLine,
|
||||
double dMinRad, double dMaxRad, double dSgLen, vector<double>& vdPar, vector<bool>& vbType)
|
||||
int
|
||||
SegmentTorus( const Point3d& ptLine, const Vector3d& vtLine, double dSgLen,
|
||||
const Point3d& ptOTorus, const Vector3d& vtAxTorus, double dMinRad, double dMaxRad,
|
||||
vector<bool>& vbType, vector<double>& vdPar)
|
||||
{
|
||||
int nIntType = LineTorus( ptOTorus, ptLine, vtAxTorus, vtLine, dMinRad, dMaxRad, vdPar, vbType) ;
|
||||
int nIntType = LineTorus( ptLine, vtLine, ptOTorus, vtAxTorus, dMinRad, dMaxRad, vbType, vdPar) ;
|
||||
if ( nIntType == T_ERROR || nIntType == T_NO_INT)
|
||||
return nIntType ;
|
||||
|
||||
@@ -1904,21 +1946,21 @@ int SegmentTorus( const Point3d& ptOTorus, const Point3d& ptLine, const Vector3d
|
||||
//----------------------------------------------------------------------------
|
||||
// Valuta la posizione reciproca fra un componente lineare e la parte inferiore
|
||||
// ed esterna rispetto al centro di una superficie torica.
|
||||
int LinCompTorusExtInt( const Point3d& ptOTorus, const Point3d& ptLine,
|
||||
const Vector3d& vtAxTorus, const Vector3d& vtLine,
|
||||
double dMinRad, double dMaxRad, double dSgLen, int nLinType,
|
||||
vector<double>& vdPar, vector<bool>& vbType)
|
||||
int
|
||||
LinCompTorusExtInt( const Point3d& ptLine, const Vector3d& vtLine, double dSgLen, int nLinType,
|
||||
const Point3d& ptOTorus, const Vector3d& vtAxTorus, double dMinRad, double dMaxRad,
|
||||
vector<bool>& vbType, vector<double>& vdPar)
|
||||
{
|
||||
int nIntType ;
|
||||
// Retta
|
||||
if ( nLinType == Line)
|
||||
nIntType = LineTorus( ptOTorus, ptLine, vtAxTorus, vtLine, dMinRad, dMaxRad, vdPar, vbType) ;
|
||||
nIntType = LineTorus( ptLine, vtLine, ptOTorus, vtAxTorus, dMinRad, dMaxRad, vbType, vdPar) ;
|
||||
// Semi-retta
|
||||
else if ( nLinType == Ray)
|
||||
nIntType = RayTorus( ptOTorus, ptLine, vtAxTorus, vtLine, dMinRad, dMaxRad, vdPar, vbType) ;
|
||||
nIntType = RayTorus( ptLine, vtLine, ptOTorus, vtAxTorus, dMinRad, dMaxRad, vbType, vdPar) ;
|
||||
// Segmento
|
||||
else if ( nLinType == Segment)
|
||||
nIntType = SegmentTorus( ptOTorus, ptLine, vtAxTorus, vtLine, dMinRad, dMaxRad, dSgLen, vdPar, vbType) ;
|
||||
nIntType = SegmentTorus( ptLine, vtLine, dSgLen, ptOTorus, vtAxTorus, dMinRad, dMaxRad, vbType, vdPar) ;
|
||||
// Errore
|
||||
else
|
||||
nIntType = S_ERROR_INT ;
|
||||
|
||||
+77
-57
@@ -47,64 +47,70 @@ enum LinCompDiscIntersType { D_ERROR_INT = - 1, D_NO_INTERS = 0, D_BOUNDARY_INT_
|
||||
// Valuta la posizione reciproca fra una retta e un disco.
|
||||
// Nel caso in cui parte della retta giaccia all'interno del disco dU1 è il parametro a
|
||||
// cui la retta entra e dU2 quello a cui esce.
|
||||
int LineDisc( const Point3d& ptPDisc, const Point3d& ptPLine, const Vector3d& vtVDisc, const Vector3d& vtVLine,
|
||||
double dRad, double& dU1, double& dU2) ;
|
||||
int LineDisc( const Point3d& ptPLine, const Vector3d& vtVLine,
|
||||
const Point3d& ptPDisc, const Vector3d& vtVDisc, double dRad,
|
||||
double& dU1, double& dU2) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Valuta la posizione reciproca fra una semi-retta e un disco.
|
||||
// Nel caso in cui parte della semi-retta giaccia all'interno del disco dU1 è il parametro a
|
||||
// cui la semi-retta entra e dU2 quello a cui esce.
|
||||
int RayDisc( const Point3d& ptPDis, const Point3d& ptPLine, const Vector3d& vtVDisc, const Vector3d& vtVLine,
|
||||
double dRad, double& dU1, double& dU2) ;
|
||||
int RayDisc( const Point3d& ptPLine, const Vector3d& vtVLine,
|
||||
const Point3d& ptPDis, const Vector3d& vtVDisc, double dRad,
|
||||
double& dU1, double& dU2) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Valuta la posizione reciproca fra un segmento e un disco.
|
||||
// Nel caso in cui parte del segmento giaccia all'interno del disco dU1 è il parametro a
|
||||
// cui il segmento entra e dU2 quello a cui esce.
|
||||
int SegmentDisc( const Point3d& ptPDisc, const Point3d& ptPLine, const Vector3d& vtVDisc, const Vector3d& vtVLine,
|
||||
double dRad, double dLen, double& dU1, double& dU2) ;
|
||||
int SegmentDisc( const Point3d& ptPLine, const Vector3d& vtVLine, double dLen,
|
||||
const Point3d& ptPDisc, const Vector3d& vtVDisc, double dRad,
|
||||
double& dU1, double& dU2) ;
|
||||
|
||||
// Costanti tipologia di intersezione fra un componente lineare e una sfera
|
||||
enum LinCompSphereIntersType { S_ERROR_INT = - 1, S_NO_INTERS = 0, S_ONE_INT_SEC = 1, S_TWO_INT = 2, S_ONE_INT_TAN = 3} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Valuta la posizione reciproca fra una retta e una sfera.
|
||||
int LineSphere( const Point3d& ptSphC, const Point3d& ptPLine, const Vector3d& vtVLine,
|
||||
double dRad, double& dU1, double& dU2) ;
|
||||
int LineSphere( const Point3d& ptPLine, const Vector3d& vtVLine,
|
||||
const Point3d& ptSphC, double dRad,
|
||||
double& dU1, double& dU2) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Valuta la posizione reciproca fra una semi-retta e una sfera.
|
||||
int RaySphere( const Point3d& ptSphC, const Point3d& ptPLine, const Vector3d& vtVLine,
|
||||
double dRad, double& dU1, double& dU2) ;
|
||||
int RaySphere( const Point3d& ptPLine, const Vector3d& vtVLine,
|
||||
const Point3d& ptSphC, double dRad,
|
||||
double& dU1, double& dU2) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Valuta la posizione reciproca fra un segmento e una sfera.
|
||||
int SegmentSphere( const Point3d& ptSphC, const Point3d& ptPLine, const Vector3d& vtVLine,
|
||||
double dRad, double dLen, double& dU1, double& dU2) ;
|
||||
int SegmentSphere( const Point3d& ptPLine, const Vector3d& vtVLine, double dLen,
|
||||
const Point3d& ptSphC, double dRad,
|
||||
double& dU1, double& dU2) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Valuta la posizione reciproca fra una retta e una superficie semi-sferica
|
||||
int LineSemiSphere( const Point3d& ptSphC, const Point3d& ptPLine,
|
||||
const Vector3d& vtSSphOrient, const Vector3d& vtVLine,
|
||||
int LineSemiSphere( const Point3d& ptPLine, const Vector3d& vtVLine,
|
||||
const Point3d& ptSphC, const Vector3d& vtSSphOrient,
|
||||
double dRad, double& dU1, double& dU2) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Valuta la posizione reciproca fra una semi-retta e una superficie semi-sferica
|
||||
int RaySemiSphere( const Point3d& ptSphC, const Point3d& ptPLine,
|
||||
const Vector3d& vtSSphOrient, const Vector3d& vtVLine,
|
||||
double dRad, double& dU1, double& dU2) ;
|
||||
int RaySemiSphere( const Point3d& ptPLine, const Vector3d& vtVLine,
|
||||
const Point3d& ptSphC, const Vector3d& vtSSphOrient, double dRad,
|
||||
double& dU1, double& dU2) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Valuta la posizione reciproca fra un segmento e una sfera.
|
||||
int SegmentSemiSphere( const Point3d& ptSphC, const Point3d& ptPLine,
|
||||
const Vector3d& vtSSphOrient, const Vector3d& vtVLine,
|
||||
double dRad, double dLen, double& dU1, double& dU2) ;
|
||||
int SegmentSemiSphere( const Point3d& ptPLine, const Vector3d& vtVLine, double dLen,
|
||||
const Point3d& ptSphC, const Vector3d& vtSSphOrient, double dRad,
|
||||
double& dU1, double& dU2) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Valuta la posizione reciproca fra un segmento e una sfera.
|
||||
int LinCompSemiSphere( const Point3d& ptSphC, const Point3d& ptPLine,
|
||||
const Vector3d& vtSSphOrient, const Vector3d& vtVLine,
|
||||
double dRad, double dLen, int nLinType, double& dU1, double& dU2) ;
|
||||
int LinCompSemiSphere( const Point3d& ptPLine, const Vector3d& vtVLine, double dLen, int nLinType,
|
||||
const Point3d& ptSphC, const Vector3d& vtSSphOrient, double dRad,
|
||||
double& dU1, double& dU2) ;
|
||||
|
||||
// Costanti tipologia di intersezione fra un componente lineare e
|
||||
// un solido cilindrico o conico
|
||||
@@ -147,15 +153,17 @@ int IntersLineSemiFiniteCylinder( const Point3d& ptPLine, const Vector3d& vtVLin
|
||||
// Valuta la posizione reciproca fra una semi-retta e un cilindro semi-finito.
|
||||
// Nel caso in cui parte della semi-retta giaccia sul cilindro, nIntType vale INF_INT
|
||||
// e almeno un parametro ha valore finito.
|
||||
int RaySemiFiniteCylinder( const Point3d& ptPCyl, const Point3d& ptPLine, const Vector3d& vtVCyl, const Vector3d& vtVLine,
|
||||
double dCylRad, double& dU1, double& dU2) ;
|
||||
int RaySemiFiniteCylinder( const Point3d& ptPLine, const Vector3d& vtVLine,
|
||||
const Point3d& ptPCyl, const Vector3d& vtVCyl, double dCylRad,
|
||||
double& dU1, double& dU2) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Valuta la posizione reciproca fra un cilindro semi-finito e un segmento.
|
||||
// Nel caso in cui il segmento giaccia sul cilindro, nIntType vale INF_INT e dU1 e dU2
|
||||
// hanno entrambi valori finiti.
|
||||
int SegmentSemiFiniteCylinder( const Point3d& ptPCyl, const Point3d& ptPLine, const Vector3d& vtVCyl, const Vector3d& vtVLine,
|
||||
double dCylRad, double dLen, double& dU1, double& dU2) ;
|
||||
int SegmentSemiFiniteCylinder( const Point3d& ptPLine, const Vector3d& vtVLine, double dLen,
|
||||
const Point3d& ptPCyl, const Vector3d& vtVCyl, double dCylRad,
|
||||
double& dU1, double& dU2) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Valuta la posizione reciproca fra una retta e un cilindro.
|
||||
@@ -169,8 +177,9 @@ int IntersLineCylinder( const Point3d& ptPLine, const Vector3d& vtVLine,
|
||||
// Valuta la posizione reciproca fra una semi-retta e un cilindro.
|
||||
// Nel caso in cui parte della semi-retta giaccia sul cilindro, nIntType vale INF_INT e entrambi
|
||||
// i parametri dU1 e dU2 hanno senso.
|
||||
int RayCylinder( const Point3d& ptPCyl, const Point3d& ptPLine, const Vector3d& vtVCyl, const Vector3d& vtVLine,
|
||||
double dCylRad, double dCylHeigth, double& dU1, double& dU2) ;
|
||||
int RayCylinder( const Point3d& ptPLine, const Vector3d& vtVLine,
|
||||
const Point3d& ptPCyl, const Vector3d& vtVCyl, double dCylRad, double dCylHeigth,
|
||||
double& dU1, double& dU2) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Valuta la posizione reciproca fra un segmento e un cilindro.
|
||||
@@ -184,64 +193,73 @@ int IntersSegmentCylinder( const Point3d& ptPLine, const Vector3d& vtVLine, doub
|
||||
// Valuta la posizione reciproca fra una retta e un cono infinito.
|
||||
// Nel caso in cui parte della retta giaccia sul cono, nIntType vale INF_INT e entrambi i
|
||||
// i parametri dU1 e dU2 hanno senso; uno è finito e l'altro no.
|
||||
int LineInfiniteCone( const Point3d& ptVCone, const Point3d& ptPLine, const Vector3d& vtDCone, const Vector3d& vtDLine,
|
||||
double dConeRad, double dConeHeigth, double& dU1, double& dU2) ;
|
||||
int LineInfiniteCone( const Point3d& ptPLine, const Vector3d& vtDLine,
|
||||
const Point3d& ptVCone, const Vector3d& vtDCone, double dConeRad, double dConeHeigth,
|
||||
double& dU1, double& dU2) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Valuta la posizione reciproca fra una semi-retta e un cono infinito.
|
||||
// Nel caso in cui parte della semi-retta giaccia sul cono, nIntType vale INF_INT e entrambi i
|
||||
// i parametri dU1 e dU2 hanno senso.
|
||||
int RayInfiniteCone( const Point3d& ptVCone, const Point3d& ptPLine, const Vector3d& vtDCone, const Vector3d& vtDLine,
|
||||
double dConeRad, double dConeHeigth, double& dU1, double& dU2) ;
|
||||
int RayInfiniteCone( const Point3d& ptPLine, const Vector3d& vtDLine,
|
||||
const Point3d& ptVCone, const Vector3d& vtDCone, double dConeRad, double dConeHeigth,
|
||||
double& dU1, double& dU2) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Valuta la posizione reciproca fra un segmento e un cono infinito.
|
||||
// Nel caso in cui parte del segmento giaccia sul cono, nIntType vale INF_INT e entrambi i
|
||||
// i parametri dU1 e dU2 hanno senso.
|
||||
int SegmentInfiniteCone( const Point3d& ptVCone, const Point3d& ptPLine, const Vector3d& vtDCone, const Vector3d& vtDLine,
|
||||
double dConeRad, double dConeHeigth, double dSgLen, double& dU1, double& dU2) ;
|
||||
int SegmentInfiniteCone( const Point3d& ptPLine, const Vector3d& vtDLine, double dSgLen,
|
||||
const Point3d& ptVCone, const Vector3d& vtDCone, double dConeRad, double dConeHeigth,
|
||||
double& dU1, double& dU2) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Valuta la posizione reciproca fra una retta e un cono.
|
||||
// Nel caso in cui parte del segmento giaccia sul cono, nIntType vale INF_INT e entrambi i
|
||||
// i parametri dU1 e dU2 hanno senso.
|
||||
int LineCone( const Point3d& ptVCone, const Point3d& ptPLine, const Vector3d& vtDCone, const Vector3d& vtDLine,
|
||||
double dConeRad, double dConeHeigth, double& dU1, double& dU2) ;
|
||||
int LineCone( const Point3d& ptPLine, const Vector3d& vtDLine,
|
||||
const Point3d& ptVCone, const Vector3d& vtDCone, double dConeRad, double dConeHeigth,
|
||||
double& dU1, double& dU2) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Valuta la posizione reciproca fra una semi-retta e un cono.
|
||||
// Nel caso in cui parte della semi-retta giaccia sul cono, nIntType vale INF_INT e entrambi i
|
||||
// i parametri dU1 e dU2 hanno senso.
|
||||
int RayCone( const Point3d& ptVCone, const Point3d& ptPLine, const Vector3d& vtDCone, const Vector3d& vtDLine,
|
||||
double dConeRad, double dConeHeigth, double& dU1, double& dU2) ;
|
||||
int RayCone( const Point3d& ptPLine, const Vector3d& vtDLine,
|
||||
const Point3d& ptVCone, const Vector3d& vtDCone, double dConeRad, double dConeHeigth,
|
||||
double& dU1, double& dU2) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Valuta la posizione reciproca fra un segmento e un cono.
|
||||
// Nel caso in cui parte del segmento giaccia sul cono, nIntType vale INF_INT e entrambi i
|
||||
// i parametri dU1 e dU2 hanno senso.
|
||||
int SegmentCone( const Point3d& ptVCone, const Point3d& ptPLine, const Vector3d& vtDCone, const Vector3d& vtDLine,
|
||||
double dConeRad, double dConeHeigth, double dSgLen, double& dU1, double& dU2) ;
|
||||
int SegmentCone( const Point3d& ptPLine, const Vector3d& vtDLine, double dSgLen,
|
||||
const Point3d& ptVCone, const Vector3d& vtDCone, double dConeRad, double dConeHeigth,
|
||||
double& dU1, double& dU2) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Valuta la posizione reciproca di una retta e un tronco di cono
|
||||
// Nel caso in cui parte della retta giaccia sul tronco di cono, nIntType vale
|
||||
// INF_INT e entrambi i parametri dU1 e dU2 hanno senso.
|
||||
int LineTruncatedCone( const Point3d& ptMinBase, const Point3d& ptPLine, const Vector3d& vtDCone, const Vector3d& vtDLine,
|
||||
double dMinRad, double dMaxRad, double dHeigth, double& dU1, double& dU2) ;
|
||||
int LineTruncatedCone( const Point3d& ptPLine, const Vector3d& vtDLine,
|
||||
const Point3d& ptMinBase, const Vector3d& vtDCone, double dMinRad, double dMaxRad, double dHeigth,
|
||||
double& dU1, double& dU2) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Valuta la posizione reciproca di una semi-retta e un tronco di cono.
|
||||
// Nel caso in cui parte della semi-retta giaccia sul tronco di cono, nIntType vale
|
||||
// INF_INT e entrambi i parametri dU1 e dU2 hanno senso.
|
||||
int RayTruncatedCone( const Point3d& ptMinBase, const Point3d& ptPLine, const Vector3d& vtDCone, const Vector3d& vtDLine,
|
||||
double dMinRad, double dMaxRad, double dHeigth, double& dU1, double& dU2) ;
|
||||
int RayTruncatedCone( const Point3d& ptPLine, const Vector3d& vtDLine,
|
||||
const Point3d& ptMinBase, const Vector3d& vtDCone ,double dMinRad, double dMaxRad, double dHeigth,
|
||||
double& dU1, double& dU2) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Valuta la posizione reciproca di un segmento e un tronco di cono.
|
||||
// Nel caso in cui parte del segmento giaccia sul tronco di cono, nIntType vale
|
||||
// INF_INT e entrambi i parametri dU1 e dU2 hanno senso.
|
||||
int SegmentTruncatedCone( const Point3d& ptMinBase, const Point3d& ptPLine, const Vector3d& vtDCone, const Vector3d& vtDLine,
|
||||
double dMinRad, double dMaxRad, double dHeigth, double dSgLen, double& dU1, double& dU2) ;
|
||||
int SegmentTruncatedCone( const Point3d& ptPLine, const Vector3d& vtDLine, double dSgLen,
|
||||
const Point3d& ptMinBase, const Vector3d& vtDCone, double dMinRad, double dMaxRad, double dHeigth,
|
||||
double& dU1, double& dU2) ;
|
||||
|
||||
// Cosntani tipologia di intersezione fra un componente lineare e un toro
|
||||
enum LinCompTorusIntersType { T_ERROR = - 1, T_NO_INT = 0, T_ONE_TAN = 1, T_ONE_SEC = 2, T_TWO_TAN = 3, T_TWO_SEC = 4,
|
||||
@@ -250,24 +268,26 @@ enum LinCompTorusIntersType { T_ERROR = - 1, T_NO_INT = 0, T_ONE_TAN = 1, T_ONE_
|
||||
//----------------------------------------------------------------------------
|
||||
// Valuta la posizione reciproca fra una retta e un toro.
|
||||
// Punti e vettori devono essere espressi nel medesimo sistema di riferimento.
|
||||
int LineTorus( const Point3d& ptOTorus, const Point3d& ptLine, const Vector3d& vtAxTorus, const Vector3d& vtLine,
|
||||
double dMinRad, double dMaxRad, std::vector<double>& vdPar, std::vector<bool>& vbType) ; //double dU1, double dU2, double dU3, double dU4) ;
|
||||
int LineTorus( const Point3d& ptLine, const Vector3d& vtLine,
|
||||
const Point3d& ptOTorus, const Vector3d& vtAxTorus, double dMinRad, double dMaxRad,
|
||||
std::vector<bool>& vbType, std::vector<double>& vdPar) ; //double dU1, double dU2, double dU3, double dU4) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int RayTorus( const Point3d& ptOTorus, const Point3d& ptLine, const Vector3d& vtAxTorus, const Vector3d& vtLine,
|
||||
double dMinRad, double dMaxRad, std::vector<double>& vdPar, std::vector<bool>& vbType) ;
|
||||
int RayTorus( const Point3d& ptLine, const Vector3d& vtLine,
|
||||
const Point3d& ptOTorus, const Vector3d& vtAxTorus, double dMinRad, double dMaxRad,
|
||||
std::vector<bool>& vbType, std::vector<double>& vdPar) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int SegmentTorus( const Point3d& ptOTorus, const Point3d& ptLine, const Vector3d& vtAxTorus, const Vector3d& vtLine,
|
||||
double dMinRad, double dMaxRad, double dSgLen, std::vector<double>& vdPar, std::vector<bool>& vbType) ;
|
||||
int SegmentTorus( const Point3d& ptLine, const Vector3d& vtLine, double dSgLen,
|
||||
const Point3d& ptOTorus, const Vector3d& vtAxTorus, double dMinRad, double dMaxRad,
|
||||
std::vector<bool>& vbType, std::vector<double>& vdPar) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Valuta la posizione reciproca fra un componente lineare e la parte inferiore
|
||||
// ed esterna rispetto al centro di una superficie torica.
|
||||
int LinCompTorusExtInt( const Point3d& ptOTorus, const Point3d& ptLine,
|
||||
const Vector3d& vtAxTorus, const Vector3d& vtLine,
|
||||
double dMinRad, double dMaxRad, double dSgLen, int nLinType,
|
||||
std::vector<double>& vdPar, std::vector<bool>& vbType) ;
|
||||
int LinCompTorusExtInt( const Point3d& ptLine, const Vector3d& vtLine, double dSgLen, int nLinType,
|
||||
const Point3d& ptOTorus, const Vector3d& vtAxTorus, double dMinRad, double dMaxRad,
|
||||
std::vector<bool>& vbType, std::vector<double>& vdPar) ;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2016
|
||||
// EgalTech 2015-2018
|
||||
//----------------------------------------------------------------------------
|
||||
// File : VolZmap.cpp Data : 22.01.15 Versione : 1.6a4
|
||||
// File : Tool.cpp Data : 04.07.18 Versione : 1.9g1
|
||||
// Contenuto : Implementazione della classe Tool
|
||||
//
|
||||
//
|
||||
@@ -25,10 +25,11 @@
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
Tool::Tool( void)
|
||||
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_dMrtChsWidth( 0), m_dMrtChsThickness( 0)
|
||||
{
|
||||
m_dTipHeight( 0), m_dRadius( 0), m_dRCorner( 0), m_dTipRadius( 0), m_dMrtChsWidth( 0), m_dMrtChsThickness( 0),
|
||||
m_bApproxWithLines( bApproxWithLines)
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -50,15 +51,16 @@ Tool::SetTolerances( double dLinTol, double dAngTolDeg)
|
||||
bool
|
||||
Tool::SetStdTool( const string& sToolName, double dH, double dR, double dCornR, int nToolNum)
|
||||
{
|
||||
// assegno il nome
|
||||
// Impostazioni generali
|
||||
m_sName = sToolName ;
|
||||
// Aggiorno il numero dell'utensile corrente
|
||||
m_nCurrentNum = nToolNum ;
|
||||
// Imposto il tipo di utensile a indefinito
|
||||
m_nType = UNDEF ;
|
||||
m_Outline.Clear() ;
|
||||
|
||||
// verifica sulle minime dimensioni globali
|
||||
if ( dH < EPS_SMALL || dR < EPS_SMALL)
|
||||
return false ;
|
||||
if ( dH < EPS_SMALL || dR < EPS_SMALL || dCornR < - EPS_SMALL)
|
||||
return false ;
|
||||
|
||||
// utensile cilindrico
|
||||
if ( dCornR < EPS_SMALL) {
|
||||
m_nType = CYLMILL ;
|
||||
@@ -67,28 +69,40 @@ Tool::SetStdTool( const string& sToolName, double dH, double dR, double dCornR,
|
||||
m_dTipHeight = 0 ;
|
||||
m_dTipRadius = m_dRadius ;
|
||||
m_dRCorner = 0 ;
|
||||
// profilo
|
||||
Point3d pt0( 0, 0, 0) ;
|
||||
Point3d pt1( m_dRadius, 0, 0) ;
|
||||
Point3d pt3( m_dRadius, - m_dHeight, 0) ;
|
||||
Point3d pt4( 0, - m_dHeight, 0) ;
|
||||
m_Outline.Clear() ;
|
||||
m_Outline.AddPoint( pt0) ;
|
||||
m_Outline.AddLine( pt1);
|
||||
m_Outline.AddLine( pt3) ;
|
||||
m_Outline.AddLine( pt4) ;
|
||||
}
|
||||
// utensile naso di toro
|
||||
else if ( dCornR < dR - EPS_SMALL) {
|
||||
else if ( dCornR < dR - EPS_SMALL) {
|
||||
m_nType = BULLNOSEMILL ;
|
||||
m_dHeight = dH ;
|
||||
m_dRadius = dR ;
|
||||
m_dTipHeight = dCornR ;
|
||||
m_dTipRadius = dR - dCornR ;
|
||||
m_dTipRadius = dR - dCornR ;
|
||||
m_dRCorner = dCornR ;
|
||||
// come profilo
|
||||
// profilo
|
||||
Point3d pt0( 0, 0, 0) ;
|
||||
Point3d pt1( m_dRadius, 0, 0) ;
|
||||
Point3d pt2( m_dRadius, - m_dHeight + m_dTipHeight, 0) ;
|
||||
Point3d pt3( m_dTipRadius, - m_dHeight, 0) ;
|
||||
Point3d pt4( 0, - m_dHeight, 0) ;
|
||||
m_Outline.Clear() ;
|
||||
CurveLine Line ;
|
||||
Line.Set( pt0, pt1) ;
|
||||
m_Outline.AddCurve( Line) ;
|
||||
m_Outline.AddPoint( pt0) ;
|
||||
m_Outline.AddLine( pt1);
|
||||
m_Outline.AddLine( pt2);
|
||||
m_Outline.AddArcTg( pt3) ;
|
||||
m_Outline.AddLine( pt4) ;
|
||||
return SetGenTool( sToolName, & m_Outline, nToolNum) ;
|
||||
// se da approosimare
|
||||
if ( m_bApproxWithLines)
|
||||
return SetGenTool( sToolName, &m_Outline, nToolNum) ;
|
||||
}
|
||||
// utensile sferico
|
||||
else if ( dCornR < dR + EPS_SMALL) {
|
||||
@@ -98,11 +112,21 @@ Tool::SetStdTool( const string& sToolName, double dH, double dR, double dCornR,
|
||||
m_dTipHeight = m_dRadius ;
|
||||
m_dTipRadius = 0 ;
|
||||
m_dRCorner = m_dRadius ;
|
||||
// profilo
|
||||
Point3d pt0( 0, 0, 0) ;
|
||||
Point3d pt1( m_dRadius, 0, 0) ;
|
||||
Point3d pt2( m_dRadius, - m_dHeight + m_dTipHeight, 0) ;
|
||||
Point3d pt4( 0, - m_dHeight, 0) ;
|
||||
m_Outline.Clear() ;
|
||||
m_Outline.AddPoint( pt0) ;
|
||||
m_Outline.AddLine( pt1);
|
||||
m_Outline.AddLine( pt2);
|
||||
m_Outline.AddArcTg( pt4) ;
|
||||
}
|
||||
// impossibile
|
||||
else
|
||||
return false ;
|
||||
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -111,115 +135,140 @@ bool
|
||||
Tool::SetAdvTool( const string& sToolName, double dH, double dR,
|
||||
double dTipH, double dTipR, double dCornR, int nToolNum)
|
||||
{
|
||||
// Setto il nome
|
||||
// Impostazioni generali
|
||||
m_sName = sToolName ;
|
||||
m_nCurrentNum = nToolNum ;
|
||||
m_nType = UNDEF ;
|
||||
m_Outline.Clear() ;
|
||||
|
||||
// Verifica dimensioni globali
|
||||
if ( dH < EPS_SMALL || dR < EPS_SMALL)
|
||||
if ( dH < EPS_SMALL || dR < EPS_SMALL || dTipH < - EPS_SMALL || dTipR < - EPS_SMALL || dCornR < - EPS_SMALL)
|
||||
return false ;
|
||||
|
||||
// Se altezza punta nulla, ricado nel caso standard
|
||||
if ( dTipH < EPS_SMALL || abs( dTipR - dR) < EPS_SMALL)
|
||||
return SetStdTool( sToolName, dH, dR, dCornR, nToolNum) ;
|
||||
|
||||
// Caso avanzato
|
||||
// Caso avanzato
|
||||
m_dHeight = dH ;
|
||||
m_dRadius = dR ;
|
||||
m_dTipHeight = dTipH ;
|
||||
m_dTipHeight = min( max( dTipH, 0.), m_dHeight) ;
|
||||
m_dTipRadius = max( dTipR, 0.) ;
|
||||
|
||||
// Se raggio corner nullo, allora utensile conico
|
||||
if ( dCornR < EPS_SMALL) {
|
||||
m_nType = CONEMILL ;
|
||||
m_dRCorner = 0 ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
// Altrimenti utensile generico.
|
||||
m_dRCorner = dCornR ;
|
||||
m_Outline.Clear() ;
|
||||
|
||||
// Definisco il profilo
|
||||
Point3d pt0( 0, 0, 0) ;
|
||||
Point3d pt1( m_dRadius, 0, 0) ;
|
||||
Point3d pt2( m_dRadius, - m_dHeight + m_dTipHeight, 0) ;
|
||||
Point3d pt5( 0, - m_dHeight, 0) ;
|
||||
|
||||
if ( m_dTipRadius < m_dRadius) {
|
||||
|
||||
CurveLine LineSt ;
|
||||
LineSt.Set( pt0, pt1) ;
|
||||
|
||||
Point3d ptInt( dTipR, - dH, 0) ;
|
||||
Point3d ptLast( 0, - dH, 0) ;
|
||||
|
||||
CurveLine cLine1 ;
|
||||
cLine1.Set( pt2, ptInt) ;
|
||||
CurveLine cLine2 ;
|
||||
cLine2.Set( ptInt, ptLast) ;
|
||||
|
||||
Point3d ptIn1 = ptInt + Y_AX * dCornR ;
|
||||
Point3d ptIn2 = ptInt - X_AX * dCornR ;
|
||||
|
||||
double dTrim1, dTrim2 ;
|
||||
PtrOwner< ICurveArc> pArc( CreateFillet( cLine1, ptIn1, cLine2, ptIn2, Z_AX, dCornR, dTrim1, dTrim2)) ;
|
||||
if ( IsNull( pArc))
|
||||
return false ;
|
||||
cLine1.TrimEndAtParam( abs( dTrim1)) ;
|
||||
cLine2.TrimStartAtParam( abs( dTrim2)) ;
|
||||
|
||||
Point3d pt3, pt4 ;
|
||||
cLine1.GetEndPoint( pt3) ;
|
||||
cLine2.GetStartPoint( pt4) ;
|
||||
|
||||
Point3d ptC = pArc->GetCenter() ;
|
||||
|
||||
CurveArc cvArc ;
|
||||
cvArc.SetC2P( ptC, pt3, pt4) ;
|
||||
|
||||
m_Outline.AddCurve( LineSt) ;
|
||||
m_Outline.AddLine( pt2);
|
||||
m_Outline.AddLine( pt3);
|
||||
m_Outline.AddCurve( cvArc) ;
|
||||
m_Outline.AddLine( ptLast) ;
|
||||
// Se raggio corner nullo, allora utensile conico
|
||||
if ( m_dRCorner < EPS_SMALL) {
|
||||
m_nType = CONEMILL ;
|
||||
m_dRCorner = 0 ;
|
||||
// profilo
|
||||
m_Outline.AddPoint( pt0) ;
|
||||
m_Outline.AddLine( pt1) ;
|
||||
m_Outline.AddLine( pt2) ;
|
||||
m_Outline.AddLine( Point3d( m_dTipRadius, - m_dHeight, 0)) ;
|
||||
m_Outline.AddLine( pt5) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
else {
|
||||
// Altrimenti utensile generico
|
||||
|
||||
// se Tip a punta ( TipRadius è raggio teorico della parte finale dell'utensile senza raccordo)
|
||||
if ( m_dTipRadius < m_dRadius) {
|
||||
// se punta a sfera
|
||||
if ( m_dTipRadius < EPS_SMALL) {
|
||||
// circonferenza del corner
|
||||
Point3d ptC( 0, - m_dHeight + m_dRCorner, 0) ;
|
||||
CurveArc cvCirc ;
|
||||
cvCirc.SetXY( ptC, m_dRCorner) ;
|
||||
// segmento tangente al corner da sopra o intersezione del gambo con il corner
|
||||
Point3d pt3 ;
|
||||
Point3d ptNear( ptC.x + m_dRCorner, ptC.y + m_dRCorner, 0) ;
|
||||
PtrOwner<ICurveLine> pLine( GetLinePointTgCurve( pt2, cvCirc, ptNear)) ;
|
||||
if ( ! IsNull( pLine))
|
||||
pLine->GetEndPoint( pt3) ;
|
||||
else {
|
||||
double dSqDelta = m_dRCorner * m_dRCorner - m_dRadius * m_dRadius ;
|
||||
double dDelta = ( dSqDelta > DBL_EPSILON ? sqrt( dSqDelta) : 0.) ;
|
||||
pt2 = Point3d( m_dRadius, - m_dHeight + m_dRCorner + dDelta, 0) ;
|
||||
pt3 = pt2 ;
|
||||
}
|
||||
// creazione del corner
|
||||
Point3d pt4( 0, - m_dHeight, 0) ;
|
||||
CurveArc cvArc ;
|
||||
cvArc.SetC2P( ptC, pt3, pt4) ;
|
||||
// creazione curva composita
|
||||
m_Outline.AddPoint( pt0) ;
|
||||
m_Outline.AddLine( pt1) ;
|
||||
m_Outline.AddLine( pt2) ;
|
||||
m_Outline.AddLine( pt3) ;
|
||||
m_Outline.AddCurve( cvArc) ;
|
||||
m_Outline.AddLine( pt5) ;
|
||||
}
|
||||
// altrimenti punta a naso di toro
|
||||
else {
|
||||
// punto da smussare con corner
|
||||
Point3d ptInt( m_dTipRadius, - m_dHeight, 0) ;
|
||||
// linea sopra il corner
|
||||
CurveLine cLine1 ;
|
||||
cLine1.Set( pt2, ptInt) ;
|
||||
// linea sotto il corner
|
||||
CurveLine cLine2 ;
|
||||
cLine2.Set( ptInt, pt5) ;
|
||||
// calcolo del corner
|
||||
Point3d ptIn1 = Media( pt2, ptInt, 0.5) ;
|
||||
Point3d ptIn2 = Media( ptInt, pt5, 0.5) ;
|
||||
double dTrim1, dTrim2 ;
|
||||
PtrOwner< ICurveArc> pArc( CreateFillet( cLine1, ptIn1, cLine2, ptIn2, Z_AX, m_dRCorner, dTrim1, dTrim2)) ;
|
||||
if ( IsNull( pArc))
|
||||
return false ;
|
||||
Point3d pt3 ;
|
||||
pArc->GetStartPoint( pt3) ;
|
||||
// creazione curva composita
|
||||
m_Outline.AddPoint( pt0) ;
|
||||
m_Outline.AddLine( pt1) ;
|
||||
m_Outline.AddLine( pt2) ;
|
||||
m_Outline.AddLine( pt3) ;
|
||||
m_Outline.AddCurve( Release( pArc)) ;
|
||||
m_Outline.AddLine( pt5) ;
|
||||
}
|
||||
}
|
||||
|
||||
// altrimenti Tip a coda di rondine ( TipRadius è raggio misurabile della parte finale dell'utensile)
|
||||
else {
|
||||
// il raggio della punta non può essere inferiore al raggio corner
|
||||
if ( m_dTipRadius < m_dRCorner)
|
||||
return false ;
|
||||
|
||||
CurveLine LineSt ;
|
||||
LineSt.Set( pt0, pt1) ;
|
||||
|
||||
Point3d ptC( dTipR - dCornR, - dH + dCornR, 0) ;
|
||||
|
||||
// circonferenza del corner
|
||||
Point3d ptC( m_dTipRadius - m_dRCorner, - m_dHeight + m_dRCorner, 0) ;
|
||||
CurveArc cvCirc ;
|
||||
cvCirc.SetXY( ptC, dCornR) ;
|
||||
|
||||
Point3d ptNear( ptC.x + dCornR, ptC.y + dCornR, 0) ;
|
||||
cvCirc.SetXY( ptC, m_dRCorner) ;
|
||||
// segmento tangente al corner da sopra
|
||||
Point3d ptNear( ptC.x + m_dRCorner, ptC.y + m_dRCorner, 0) ;
|
||||
PtrOwner<ICurveLine> pLine( GetLinePointTgCurve( pt2, cvCirc, ptNear)) ;
|
||||
if ( IsNull( pLine))
|
||||
return false ;
|
||||
|
||||
// creazione del corner
|
||||
Point3d pt3 ;
|
||||
pLine->GetEndPoint( pt3) ;
|
||||
|
||||
Point3d pt4( ptC.x, - dH, 0) ;
|
||||
|
||||
Point3d pt4( ptC.x, - m_dHeight, 0) ;
|
||||
CurveArc cvArc ;
|
||||
cvArc.SetC2P( ptC, pt3, pt4) ;
|
||||
|
||||
Point3d pt5( 0, - dH, 0) ;
|
||||
|
||||
m_Outline.AddCurve( LineSt) ;
|
||||
m_Outline.AddLine( pt2);
|
||||
m_Outline.AddLine( pt3);
|
||||
if ( cvArc.GetAngCenter() > 0)
|
||||
cvArc.ToExplementary() ;
|
||||
// creazione curva composita
|
||||
m_Outline.AddPoint( pt0) ;
|
||||
m_Outline.AddLine( pt1) ;
|
||||
m_Outline.AddLine( pt2) ;
|
||||
m_Outline.AddLine( pt3) ;
|
||||
m_Outline.AddCurve( cvArc) ;
|
||||
m_Outline.AddLine( pt5) ;
|
||||
}
|
||||
|
||||
|
||||
return SetGenTool( sToolName, &m_Outline, nToolNum) ;
|
||||
}
|
||||
|
||||
@@ -227,10 +276,12 @@ Tool::SetAdvTool( const string& sToolName, double dH, double dR,
|
||||
bool
|
||||
Tool::SetGenTool( const string& sToolName, const ICurveComposite* pToolOutline, int nToolNum)
|
||||
{
|
||||
// Assegno nome, tipo e id dell'utensile
|
||||
// Impostazioni generali
|
||||
m_sName = sToolName ;
|
||||
m_nType = UNDEF ;
|
||||
m_nCurrentNum = nToolNum ;
|
||||
if ( pToolOutline != &m_Outline)
|
||||
m_Outline.Clear() ;
|
||||
|
||||
// Copio il profilo e garantisco sia di soli archi e rette (converto eventuali curve di Bezier)
|
||||
if ( ! m_Outline.CopyFrom( pToolOutline) ||
|
||||
@@ -244,8 +295,9 @@ Tool::SetGenTool( const string& sToolName, const ICurveComposite* pToolOutline,
|
||||
const ICurve* pCurve = m_Outline.GetFirstCurve() ;
|
||||
while ( pCurve != nullptr) {
|
||||
|
||||
// Se la curva è un arco verifico se approssimarlo
|
||||
if ( pCurve->GetType() == CRV_ARC) {
|
||||
// Se la curva è un arco ed è richiesto la verifica per l'approssimazione,
|
||||
// verifico se approssimarlo
|
||||
if ( m_bApproxWithLines && pCurve->GetType() == CRV_ARC) {
|
||||
|
||||
// Centro e raggio dell'arco
|
||||
Point3d ptO = GetBasicCurveArc( pCurve)->GetCenter() ;
|
||||
@@ -269,7 +321,7 @@ Tool::SetGenTool( const string& sToolName, const ICurveComposite* pToolOutline,
|
||||
if ( bCurrApprox) {
|
||||
// Creo la polyline approssimante
|
||||
PolyLine plyApprox ;
|
||||
if ( ! pCurve->ApproxWithLines( m_dLinTol, m_dAngTolDeg, ICurve::APL_SPECIAL, plyApprox))
|
||||
if ( ! pCurve->ApproxWithLines( m_dLinTol, m_dAngTolDeg, ICurve::APL_SPECIAL, plyApprox))
|
||||
return false ;
|
||||
// Aggiungo i segmenti di retta alla approssimazione
|
||||
Point3d ptEnd ;
|
||||
@@ -284,7 +336,7 @@ Tool::SetGenTool( const string& sToolName, const ICurveComposite* pToolOutline,
|
||||
m_ArcLineApprox.AddCurve( *pCurve, true) ;
|
||||
}
|
||||
// altrimenti è segmento e lo aggiungo semplicemente
|
||||
else
|
||||
else
|
||||
m_ArcLineApprox.AddCurve( *pCurve, true) ;
|
||||
|
||||
pCurve = m_Outline.GetNextCurve() ;
|
||||
@@ -297,27 +349,28 @@ Tool::SetGenTool( const string& sToolName, const ICurveComposite* pToolOutline,
|
||||
m_nType = GEN ;
|
||||
|
||||
// Il profilo dell'utensile deve stare nel 4° quadrante del piano XY
|
||||
BBox3d Bounding ;
|
||||
m_Outline.GetLocalBBox( Bounding) ;
|
||||
BBox3d Bounding ;
|
||||
m_Outline.GetLocalBBox( Bounding) ;
|
||||
if ( Bounding.GetMin().x < - 10 * EPS_SMALL || Bounding.GetMax().y > 10 * EPS_SMALL)
|
||||
return false ;
|
||||
// Assegno le dimensioni dell'utensile
|
||||
m_dHeight = - Bounding.GetMin().y ;
|
||||
m_dRadius = Bounding.GetMax().x ;
|
||||
m_dHeight = - Bounding.GetMin().y ;
|
||||
m_dRadius = Bounding.GetMax().x ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Tool::SetMortiserTool( const std::string& sToolName, double dH, double dW, double dTh, double dRc, int nToolNum)
|
||||
Tool::SetMortiserTool( const string& sToolName, double dH, double dW, double dTh, double dRc, int nToolNum)
|
||||
{
|
||||
// Setto il nome e il numero dell'utensile
|
||||
// Impostazioni generali
|
||||
m_sName = sToolName ;
|
||||
m_nCurrentNum = nToolNum ;
|
||||
// Imposto a indefinito il tipo
|
||||
m_nType = UNDEF ;
|
||||
m_Outline.Clear() ;
|
||||
|
||||
// Verifica dimensioni globali
|
||||
if ( dH < EPS_SMALL || dW < EPS_SMALL ||
|
||||
dTh < EPS_SMALL || dRc < 0 || dW - 2 * dRc < 0)
|
||||
return false ;
|
||||
@@ -337,13 +390,13 @@ Tool::SetMortiserTool( const std::string& sToolName, double dH, double dW, doubl
|
||||
bool
|
||||
Tool::SetChiselTool( const string& sToolName, double dH, double dW, double dTh, int nToolNum)
|
||||
{
|
||||
|
||||
// Setto il nome e il numero dell'utensile
|
||||
// Impostazioni generali
|
||||
m_sName = sToolName ;
|
||||
m_nCurrentNum = nToolNum ;
|
||||
// Imposto a indefinito il tipo
|
||||
m_nType = UNDEF ;
|
||||
m_Outline.Clear() ;
|
||||
|
||||
// Verifica dimensioni globali
|
||||
if ( dH < EPS_SMALL || dW < EPS_SMALL || dTh < 0)
|
||||
return false ;
|
||||
|
||||
@@ -353,6 +406,6 @@ Tool::SetChiselTool( const string& sToolName, double dH, double dW, double dTh,
|
||||
|
||||
// Imposto il tipo
|
||||
m_nType = CHISEL ;
|
||||
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
#include "CurveComposite.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class Tool
|
||||
class Tool
|
||||
{
|
||||
public :
|
||||
Tool( void) ;
|
||||
Tool( bool bApproxWithLines = false) ;
|
||||
~Tool( void) ;
|
||||
|
||||
public :
|
||||
@@ -48,14 +48,14 @@ class Tool
|
||||
{ return m_dMrtChsWidth ; }
|
||||
double GetMrtChsThickness() const
|
||||
{ return m_dMrtChsThickness ; }
|
||||
const CurveComposite * GetOutline()
|
||||
const CurveComposite* GetOutline() const
|
||||
{
|
||||
// Se l'utensile non è stato approssimato uso l'originale
|
||||
if ( m_ArcLineApprox.GetCurveCount() == 0)
|
||||
return ( & m_Outline) ;
|
||||
return ( &m_Outline) ;
|
||||
// altrimenti uso l'approssimazione
|
||||
else
|
||||
return ( & m_ArcLineApprox) ;
|
||||
return ( &m_ArcLineApprox) ;
|
||||
}
|
||||
|
||||
public :
|
||||
@@ -69,10 +69,11 @@ class Tool
|
||||
CHISEL = 7} ; // Scalpello
|
||||
|
||||
private :
|
||||
double m_dLinTol ; // Dati per utensile
|
||||
bool m_bApproxWithLines ;
|
||||
double m_dLinTol ;
|
||||
double m_dAngTolDeg ;
|
||||
std::string m_sName ;
|
||||
int m_nType ;
|
||||
int m_nType ;
|
||||
int m_nCurrentNum ;
|
||||
CurveComposite m_Outline ;
|
||||
CurveComposite m_ArcLineApprox ;
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ GEOOBJ_REGISTER( VOL_ZMAP, NGE_V_ZMP, VolZmap) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
VolZmap::VolZmap(void)
|
||||
: m_nStatus( TO_VERIFY), m_dStep( EPS_SMALL), m_nTempProp( 0), m_nVoxNumPerBlock( N_VOXBLOCK)
|
||||
: m_nStatus( TO_VERIFY), m_dStep( EPS_SMALL), m_nTempProp( 0), m_nVoxNumPerBlock( N_VOXBLOCK), m_Tool( true)
|
||||
{
|
||||
m_nMapNum = 0 ;
|
||||
m_nNumBlock = 0 ;
|
||||
|
||||
Reference in New Issue
Block a user