Exemple #1
0
//===========================================================================
//
// Parameter:               -
// Returns:                 -
// Changes Globals:     -
//===========================================================================
void ScaleFuzzySeperatorBalanceRange_r( fuzzyseperator_t *fs, float scale )
{
	if ( fs->child )
	{
		ScaleFuzzySeperatorBalanceRange_r( fs->child, scale );
	} //end if
	else if ( fs->type == WT_BALANCE )
	{
		float mid = ( fs->minweight + fs->maxweight ) * 0.5;

		//get the weight between bounds
		fs->maxweight = mid + ( fs->maxweight - mid ) * scale;
		fs->minweight = mid + ( fs->minweight - mid ) * scale;

		if ( fs->maxweight < fs->minweight )
		{
			fs->maxweight = fs->minweight;
		} //end if
	} //end else if

	if ( fs->next )
	{
		ScaleFuzzySeperatorBalanceRange_r( fs->next, scale );
	}
} //end of the function ScaleFuzzySeperatorBalanceRange_r
Exemple #2
0
void ScaleFuzzyBalanceRange(weightconfig_t *config, float scale) {
    int i;

    if (scale < 0) scale = 0;
    else if (scale > 100) scale = 100;
    for (i = 0; i < config->numweights; i++) {
        ScaleFuzzySeperatorBalanceRange_r(config->weights[i].firstseperator, scale);
    } //end for
} //end of the function ScaleFuzzyBalanceRange
/*
=======================================================================================================================================
ScaleFuzzyBalanceRange
=======================================================================================================================================
*/
void ScaleFuzzyBalanceRange(weightconfig_t *config, float scale) {
	int i;

	if (scale < 0) {
		scale = 0;
	} else if (scale > 100) {
		scale = 100;
	}

	for (i = 0; i < config->numweights; i++) {
		ScaleFuzzySeperatorBalanceRange_r(config->weights[i].firstseperator, scale);
	}
}