532 double x1, fy1, gy1, hy1, x2, fy2, gy2, hy2, fy2p, gy2p, hy2p, xg1, xg2, sum;
533 ptwXYPoints *f = NULL, *ff, *fff = NULL, *
g = NULL, *gg = NULL, *h = NULL, *hh = NULL;
539 if( ( *status = groupBoundaries->
status ) !=
nfu_Okay )
return( NULL );
547 if( ptwX_norm == NULL ) {
561 if( ( ff->length == 0 ) || ( gg->length == 0 ) || ( hh->length == 0 ) )
return(
ptwX_createLine( ngs, ngs, 0, 0, status ) );
571 if( ( groupedData =
ptwX_new( ngs, status ) ) == NULL )
goto err;
572 xg1 = groupBoundaries->
points[0];
575 gy1 = g->points[0].y;
576 hy1 = h->points[0].y;
577 for( igs = 0, i = 1; igs < ngs; igs++ ) {
578 xg2 = groupBoundaries->
points[igs+1];
581 for( ; i < f->
length; i++, x1 = x2, fy1 = fy2, gy1 = gy2, hy1 = hy2 ) {
583 if( x2 > xg2 )
break;
586 gy2p = gy2 = g->points[i].y;
588 hy2p = hy2 = h->points[i].y;
590 sum += ( ( fy1 + fy2p ) * ( gy1 + gy2p ) * ( hy1 + hy2p ) + 2 * fy1 * gy1 * hy1 + 2 * fy2p * gy2p * hy2p ) * ( x2 - x1 );
595 sum /= ( xg2 - xg1 ); }
597 if( ptwX_norm->
points[igs] == 0. ) {
601 sum /= ptwX_norm->
points[igs];
604 groupedData->
points[igs] = sum / 12.;
616 return( groupedData );
626 if( groupedData != NULL )
ptwX_free( groupedData );
ptwXYPoints * ptwXY_intersectionWith_ptwX(ptwXYPoints *ptwXY, ptwXPoints *ptwX, nfu_status *status)
ptwXY_interpolation interpolation
ptwXPoints * ptwX_createLine(int64_t size, int64_t length, double slope, double offset, nfu_status *status)
ptwXYPoints * ptwXY_free(ptwXYPoints *ptwXY)
ptwXPoints * ptwX_new(int64_t size, nfu_status *status)
ptwXYPoints * ptwXY_union(ptwXYPoints *ptwXY1, ptwXYPoints *ptwXY2, nfu_status *status, int unionOptions)
ptwXPoints * ptwX_free(ptwXPoints *ptwX)
int64_t ptwX_length(ptwXPoints *ptwX)
nfu_status ptwXY_simpleCoalescePoints(ptwXYPoints *ptwXY)
nfu_status ptwXY_tweakDomainsToMutualify(ptwXYPoints *ptwXY1, ptwXYPoints *ptwXY2, int epsilonFactor, double epsilon)