Beispiel #1
0
DBL Evaluate_Function_UV(FUNCTION funct, UV_VECT fnvec)
{
	POVFPU_SetLocal(U, fnvec[U]);
	POVFPU_SetLocal(V, fnvec[V]);

   	return POVFPU_Run(funct);
}
Beispiel #2
0
DBL Parametric::Evaluate_Function_UV(FPUContext *ctx, FUNCTION funct, const UV_VECT fnvec)
{
	ctx->SetLocal(U, fnvec[U]);
	ctx->SetLocal(V, fnvec[V]);

	return POVFPU_Run(ctx, funct);
}
Beispiel #3
0
DBL Evaluate_Function(FUNCTION funct, VECTOR fnvec)
{
	POVFPU_SetLocal(X, fnvec[X]);
	POVFPU_SetLocal(Y, fnvec[Y]);
	POVFPU_SetLocal(Z, fnvec[Z]);

   	return POVFPU_Run(funct);
}
Beispiel #4
0
void Parametric::Evaluate_Function_Interval_UV(FPUContext *ctx, FUNCTION funct, DBL threshold, const UV_VECT fnvec_low, const UV_VECT fnvec_hi, DBL max_gradient, DBL& low, DBL& hi)
{
	DBL f_0_0, f_0_1, f_1_0, f_1_1;
	DBL f_0_min, f_0_max;
	DBL f_1_min, f_1_max;
	DBL junk;

	/* Calculate the values at each corner */
	ctx->SetLocal(U, fnvec_low[U]);
	ctx->SetLocal(V, fnvec_low[V]);

	f_0_0 = POVFPU_Run(ctx, funct) - threshold;

	ctx->SetLocal(U, fnvec_low[U]);
	ctx->SetLocal(V, fnvec_hi[V]);

	f_0_1 = POVFPU_Run(ctx, funct) - threshold;

	ctx->SetLocal(U, fnvec_hi[U]);
	ctx->SetLocal(V, fnvec_low[V]);

	f_1_0 = POVFPU_Run(ctx, funct) - threshold;

	ctx->SetLocal(U, fnvec_hi[U]);
	ctx->SetLocal(V, fnvec_hi[V]);

	f_1_1 = POVFPU_Run(ctx, funct) - threshold;

	/* Determine a min and a max along the left edge of the patch */
	Interval( fnvec_hi[V]-fnvec_low[V], f_0_0, f_0_1, max_gradient, &f_0_min, &f_0_max);

	/* Determine a min and a max along the right edge of the patch */
	Interval( fnvec_hi[V]-fnvec_low[V], f_1_0, f_1_1, max_gradient, &f_1_min, &f_1_max);

	/* Assume that the upper bounds of both edges are attained at the same
	 u coordinate and determine what an upper bound along that line would
	 be if it existed.  That's the worst-case maximum value we can reach. */
	Interval( fnvec_hi[U]-fnvec_low[U], f_0_max, f_1_max, max_gradient, &junk, &hi);

	/* same as above to get a lower bound from the two edge lower bounds */
	Interval( fnvec_hi[U]-fnvec_low[U], f_0_min, f_1_min, max_gradient, &low, &junk);

	/*
	char str[200];
	int its=0;
	its++;
	if (its>20) Error("Boom!");
	sprintf( str, "%lf     %lf %lf %lf %lf   %lf %lf\n%lf %lf %lf %lf    %lf %lf    %lf %lf    %lf %lf\n",
		max_gradient,
		fnvec_low[U], fnvec_low[V],
		fnvec_hi[U], fnvec_hi[V],
		fnvec_hi[U]-fnvec_low[U],
		fnvec_hi[V]-fnvec_low[V],

		f_0_0,f_0_1,f_1_0,f_1_1,
		f_0_min,f_0_max,
		f_1_min,f_1_max,
		low,hi);
	Warning( 0, str );
	*/
	/* f_min and f_max now contain the maximum interval. */
}