- modifiche nell'identificazione del tipo di bisettore per riconoscere casi degeneri
- aggiunta funzione per ricavare i parametri del bisettore approssimato.
This commit is contained in:
SaraP
2024-04-12 14:48:02 +02:00
parent 5e60352839
commit 0067a28e63
+40 -4
View File
@@ -171,8 +171,10 @@ vroniObject::GetBisectorType( int i)
if ( t_lft == UNKNOWN || t_rgt == UNKNOWN || lft == NIL || rgt == NIL)
return NONE ;
// Questo caso nel calcolo dei bisettori viene identificato come HYPERBOLA che degenera come linea. Visto che
// nel calcolo delle approssimazioni viene identificato come linea indico il tipo direttamente come LINE
if (( t_lft == PNT) && ( t_rgt == PNT))
return HYPERBOLA ;
return LINE ;
else if (( t_lft == PNT) || ( t_lft == ARC)) {
if (( t_rgt == PNT) || ( t_rgt == ARC)) {
@@ -202,10 +204,14 @@ vroniObject::GetBisectorType( int i)
double dist = dx * dx + dy * dy ;
if ( eq( dist, ZERO_MAX)) {
dist = r1 - r2;
if (! eq( dist, ZERO_MAX))
if ( eq( dist, ZERO_MAX))
return LINE ;
else
// degenerate elliptic edge
return DEGENERATE_HYPERELL ;
}
else
return LINE ;
}
return HYPERELL ;
@@ -216,8 +222,14 @@ vroniObject::GetBisectorType( int i)
if (( t_lft == PNT) &&
( IsSegStartPnt( rgt, lft) || IsSegEndPnt( rgt, lft)))
return LINE ;
else
else {
// verifico se degenere
e_formula coeff ;
if ( ! ComputeParabolaData( i, &coeff))
return LINE ;
return PARABOLA ;
}
}
}
else {
@@ -227,8 +239,14 @@ vroniObject::GetBisectorType( int i)
if (( t_rgt == PNT) &&
( IsSegStartPnt( lft, rgt) || IsSegEndPnt( lft, rgt)))
return LINE ;
else
else {
// verifico se degenere
e_formula coeff ;
if ( ! ComputeParabolaData( i, &coeff))
return LINE ;
return PARABOLA ;
}
}
else {
return LINE ;
@@ -238,6 +256,24 @@ vroniObject::GetBisectorType( int i)
return conic ;
}
//----------------------------------------------------------------------------
vr_bool
vroniObject::GetApproxedBisectorParams( int nEdge, double& dParS, double& dParE)
{
// se il bisettore non è quello approssimato nel buffer devo calcolarlo
if ( nEdge != m_nBufferedVDEdge) {
ResetVDBuffer() ;
AddVDEdgeToBuffer( nEdge) ;
m_nBufferedVDEdge = nEdge ;
}
// recupero i parametri dagli estremi
dParS = UnscaleV( vde_buf[0].dPar1) ;
dParE = UnscaleV( vde_buf[num_vde_buf-1].dPar2) ;
return true ;
}
//----------------------------------------------------------------------------
int
vroniObject::GetApproxedBisectorPointsNbr( int nEdge)