531 double x1, fy1, gy1, hy1, x2, fy2, gy2, hy2, fy2p, gy2p, hy2p, xg1, xg2, sum;
532 ptwXYPoints *f = NULL, *ff, *fff = NULL, *
g = NULL, *gg = NULL, *h = NULL, *hh = NULL;
538 if( ( *status = groupBoundaries->
status ) !=
nfu_Okay )
return( NULL );
546 if( ptwX_norm == NULL ) {
560 if( ( ff->length == 0 ) || ( gg->length == 0 ) || ( hh->length == 0 ) )
return(
ptwX_createLine( ngs, ngs, 0, 0, status ) );
570 if( ( groupedData =
ptwX_new( ngs, status ) ) == NULL )
goto err;
571 xg1 = groupBoundaries->
points[0];
574 gy1 = g->points[0].y;
575 hy1 = h->points[0].y;
576 for( igs = 0, i = 1; igs < ngs; igs++ ) {
577 xg2 = groupBoundaries->
points[igs+1];
580 for( ; i < f->
length; i++, x1 = x2, fy1 = fy2, gy1 = gy2, hy1 = hy2 ) {
582 if( x2 > xg2 )
break;
585 gy2p = gy2 = g->points[i].y;
587 hy2p = hy2 = h->points[i].y;
589 sum += ( ( fy1 + fy2p ) * ( gy1 + gy2p ) * ( hy1 + hy2p ) + 2 * fy1 * gy1 * hy1 + 2 * fy2p * gy2p * hy2p ) * ( x2 - x1 );
594 sum /= ( xg2 - xg1 ); }
596 if( ptwX_norm->
points[igs] == 0. ) {
600 sum /= ptwX_norm->
points[igs];
603 groupedData->
points[igs] = sum / 12.;
615 return( groupedData );
625 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)
static constexpr double g
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)