#include <math.h>
/* Test, ob ein Punkt innerhalb eines bewegten Randes liegt */
int Test_MovBC(Daten_Typ K[DIM])
{
  const Daten_Typ drad=0.25;
  const Daten_Typ deps=0.05;
  const Daten_Typ dvel=M_PI;
  Daten_Typ phi1,phi2,phi3,phi4,phi5,phi6=0.0,phi7=0.0;
  Daten_Typ phi1d,phi2d,dist1,dist2,drad2;
  
  phi1=Global_Time*dvel;
  phi2=phi1+M_PI*0.5;
  phi3=phi2+M_PI*0.5;
  phi4=phi3+M_PI*0.5;
  drad2=sqrt(K[0]*K[0]+K[1]*K[1]);
  if (drad2<=drad)
    {
      phi5=acos(K[0]/drad2);
      if (K[1]<0.0) phi5=2.0*M_PI-phi5;
      while(phi5<phi1) phi5+=2.0*M_PI;
      if ((phi5>=phi1)&&(phi5<=phi2))
	{
	  phi6=phi1;
	  phi7=phi2;
	}
      if ((phi5>=phi2)&&(phi5<=phi3))
	{
	  phi6=phi2;
	  phi7=phi3;
	}
      if ((phi5>=phi3)&&(phi5<=phi4))
	{
	  phi6=phi3;
	  phi7=phi4;
	}
      if (phi5>=phi4)
	{
	  phi6=phi4;
	  phi7=phi1;
	}
      phi1d=phi5-phi6;
      phi2d=phi7-phi5;
      dist1=drad2*sin(phi1d);
      dist2=drad2*sin(phi2d);
      if ((fabs(dist1)<=deps)||(fabs(dist2)<=deps)) return 1;
    }
  return 0;
}