src/cdtGen.cpp
/*! \fn void CDTGenerator::computeReferencePoint(CGALPoint *refPoint, DartHandle missingSegmentHandle)
    \brief Computes the reference point for segment splitting

    Computes reference point which will be used for determing the location of _steiner point_ for the input missing constraint segment.

    \param [out] refPoint Pointer to the computed reference point.
    \param [in] missingSegmentHandle Dart handle of missing constraint segment.
*/


Computes reference point which will be used for determing the location of _steiner point_ for the input missing constraint segment.

\param [out] refPoint Pointer to the computed reference point.
\param [in] missingSegmentHandle Dart handle of missing constraint segment.
Computes reference point which will be used for determing the location of _steiner point_ for the input missing constraint segment . \ param [ out ] refPoint Pointer to the computed reference point . \ param [ in ] missingSegmentHandle Dart handle of missing constraint segment .
void CDTGenerator::computeReferencePoint(CGALPoint* refPoint, DartHandle& missingSegmentHandle)
{
	CGALPoint &A = plc.point(missingSegmentHandle);
	CGALPoint &B = plc.point(plc.beta(missingSegmentHandle, 1));
	float missingSegmentLength = sqrt(pow((A.x() - B.x()), 2) + pow((A.y() - B.y()), 2) + pow((A.z() - B.z()), 2));
	float sphereRadius = (missingSegmentLength / 2.0);
	CGALPoint sphereCenter = CGALPoint((A.x() + B.x()) / 2.0,  (A.y() + B.y()) / 2.0, (A.z() + B.z()) / 2.0);
	CGALSphere smallestCircumsphere(sphereCenter, pow(sphereRadius, 2));
	float encroachingCandidateDistance;
	vector<float> circumradiusMap; 
	for (LCC::One_dart_per_cell_range<0>::iterator pIter = plc.one_dart_per_cell<0>().begin(), pIterEnd = plc.one_dart_per_cell<0>().end(); pIter != pIterEnd; pIter++)
	{
		CGALPoint candidatePoint = plc.point(pIter);
		if (candidatePoint != A && candidatePoint != B)
		{
			encroachingCandidateDistance = sqrt(pow(sphereCenter.x() - candidatePoint.x(), 2) + pow(sphereCenter.y() - candidatePoint.y(), 2) + pow(sphereCenter.z() - candidatePoint.z(), 2));
			if (encroachingCandidateDistance <= sqrt(smallestCircumsphere.squared_radius())) 
				circumradiusMap.push_back(computeCircumradius(A, B, candidatePoint));
			else 
				circumradiusMap.push_back(INVALID_VALUE);
		}
		else
			continue; 
	}
	float maxCircumradius = INVALID_VALUE;
	size_t vertexId = 0;
	for (LCC::One_dart_per_cell_range<0>::iterator pointIter = plc.one_dart_per_cell<0>().begin(), pointIterEnd = plc.one_dart_per_cell<0>().end(); pointIter != pointIterEnd; pointIter++, vertexId++)
		if (circumradiusMap[vertexId] != INVALID_VALUE)
			if (maxCircumradius < circumradiusMap[vertexId])
			{
				maxCircumradius = circumradiusMap[vertexId];
				refPoint = &(plc.point(pointIter));
			}	
	return;
}
void CDTGenerator :: computeReferencePoint ( CGALPoint * refPoint , DartHandle & missingSegmentHandle ) { CGALPoint & A = plc . point ( missingSegmentHandle ) ; CGALPoint & B = plc . point ( plc . beta ( missingSegmentHandle , 1 ) ) ; float missingSegmentLength = sqrt ( pow ( ( A . x ( ) - B . x ( ) ) , 2 ) + pow ( ( A . y ( ) - B . y ( ) ) , 2 ) + pow ( ( A . z ( ) - B . z ( ) ) , 2 ) ) ; float sphereRadius = ( missingSegmentLength / 2.0 ) ; CGALPoint sphereCenter = CGALPoint ( ( A . x ( ) + B . x ( ) ) / 2.0 , ( A . y ( ) + B . y ( ) ) / 2.0 , ( A . z ( ) + B . z ( ) ) / 2.0 ) ; CGALSphere smallestCircumsphere ( sphereCenter , pow ( sphereRadius , 2 ) ) ; float encroachingCandidateDistance ; vector < float > circumradiusMap ; for ( LCC :: One_dart_per_cell_range < 0 > :: iterator pIter = plc . one_dart_per_cell < 0 > ( ) . begin ( ) , pIterEnd = plc . one_dart_per_cell < 0 > ( ) . end ( ) ; pIter != pIterEnd ; pIter ++ ) { CGALPoint candidatePoint = plc . point ( pIter ) ; if ( candidatePoint != A && candidatePoint != B ) { encroachingCandidateDistance = sqrt ( pow ( sphereCenter . x ( ) - candidatePoint . x ( ) , 2 ) + pow ( sphereCenter . y ( ) - candidatePoint . y ( ) , 2 ) + pow ( sphereCenter . z ( ) - candidatePoint . z ( ) , 2 ) ) ; if ( encroachingCandidateDistance <= sqrt ( smallestCircumsphere . squared_radius ( ) ) ) circumradiusMap . push_back ( computeCircumradius ( A , B , candidatePoint ) ) ; else circumradiusMap . push_back ( INVALID_VALUE ) ; } else continue ; } float maxCircumradius = INVALID_VALUE ; size_t vertexId = 0 ; for ( LCC :: One_dart_per_cell_range < 0 > :: iterator pointIter = plc . one_dart_per_cell < 0 > ( ) . begin ( ) , pointIterEnd = plc . one_dart_per_cell < 0 > ( ) . end ( ) ; pointIter != pointIterEnd ; pointIter ++ , vertexId ++ ) if ( circumradiusMap [ vertexId ] != INVALID_VALUE ) if ( maxCircumradius < circumradiusMap [ vertexId ] ) { maxCircumradius = circumradiusMap [ vertexId ] ; refPoint = & ( plc . point ( pointIter ) ) ; } return ; }
\fn void CDTGenerator::computeReferencePoint(CGALPoint *refPoint, DartHandle missingSegmentHandle)
\brief Computes the reference point for segment splitting
\ fn void CDTGenerator :: computeReferencePoint ( CGALPoint * refPoint DartHandle missingSegmentHandle ) \ brief Computes the reference point for segment splitting
// value is computed only for those points which are encroaching // encroaching vertex // not encroaching // skip // select the one with maximum circumradius.