void JamomaExpressionComposition::firstResultCallback(bool first_result)
{
  bool result = do_evaluation(first_result, mSecondExpression->evaluate());
  
  for (auto callback : callbacks())
    callback(result);
}
void JamomaExpressionComposition::secondResultCallback(bool second_result)
{
  bool result = do_evaluation(mFirstExpression->evaluate(), second_result);
  
  for (auto callback : callbacks())
    callback(result);
}
bool JamomaExpressionComposition::evaluate() const
{
  return do_evaluation(mFirstExpression->evaluate(), mSecondExpression->evaluate());
}
Ejemplo n.º 4
0
int omega_stream (struct msscene *ms, FILE *fpt, FILE *fpn, FILE *fph, FILE *fpe, FILE *fpo, char *format, double sphere_radius, double x_radius)
{
	double expansion_radius, extension_radius;
	char message[128];
	struct surface *msphn1, *msphn2, *msphn3;

	if (sphere_radius <= 0.0) {
		sprintf (message, "%8.3f negative sphere radius", sphere_radius);
		set_error1 (message);
		return (0);
	}
	
	expansion_radius = 0.0;
	extension_radius = 0.0;
	if (fpt != NULL) {
		/* first polyhedron */
		msphn1 = read_vet (fpt);
		if (error()) return (0);
		fclose (fpt);
		do_bounds (msphn1);
		if (error()) return (0);
		do_axes(msphn1);
		if (error()) return (0);
	}
	else msphn1 = NULL;
	
	if (fpn != NULL) {
		/* second polyhedron */
		msphn2 = read_vet (fpn);
		if (error()) return (0);
		fclose (fpn);
		do_bounds (msphn2);
		if (error()) return (0);
		do_axes(msphn2);
		if (error()) return (0);
	}
	else msphn2 = NULL;

	if (fph != NULL) {
		/* third polyhedron */
		msphn3 = read_vet (fph);
		if (error()) return (0);
		fclose (fph);
		do_bounds (msphn3);
		if (error()) return (0);
		do_axes(msphn3);
		if (error()) return (0);
	}
	else msphn3 = NULL;

	/* evaluation loci */
	sprintf (message, "%8.3f evaluation radius", sphere_radius);
	inform(message);
	if (msphn1 != NULL && msphn2 == NULL && msphn3 == NULL) {
		expansion_radius = x_radius;
		sprintf (message, "%8.3f expansion radius", expansion_radius);
		inform(message);
	}
	if (msphn1 != NULL && msphn2 != NULL && msphn3 == NULL) {
		extension_radius = x_radius;
		sprintf (message, "%8.3f extension radius", extension_radius);
		inform(message);
	}
	set_omega_radii (msphn1, sphere_radius, expansion_radius, extension_radius);
	do_evaluation (msphn1, msphn2, msphn3, (int) (extension_radius > 0.0));
	if (error()) return (0);
	if (msphn2 == NULL && msphn3 == NULL) {
		identify (msphn1);
		if (error()) return (0);
	}
	msphn1 -> scheme = NULL;
	if (format == NULL || strlen(format) == (unsigned) 0 || strcmp(format,"vet") == 0)
		write_vet (msphn1, fpo);
	if (error()) return (0);

	if (msphn1 != NULL) {
		free_phn (msphn1);
		if (error()) return(0);
		free_object (SURFACE, (short *) msphn1);
		if (error()) return(0);
	}
	if (msphn2 != NULL) {
		free_phn (msphn2);
		if (error()) return(0);
		free_object (SURFACE, (short *) msphn2);
		if (error()) return(0);
	}
	if (msphn3 != NULL) {
		free_phn (msphn3);
		if (error()) return(0);
		free_object (SURFACE, (short *) msphn3);
		if (error()) return(0);
	}
	return (1);
}