Draw borders using vectors

Hi Everyone,
I am new at using FreeFem and could really use you help to understand the functionalities better
i am working on the sample problem of electrostatics

https://doc.freefem.org/models/static-problems.html#electrostatics

I wanted to created the borders using the vector ex
border b(t=0, vectorX.n-1){P.x=vectorX[t]; P.y=vectorY[t];}

Thanks

So border is to make continuous object, so you have to make linear interpolation like this (no tested)

 border bb(tt=0,xx.n-1) 
  {
   int i = min(int(tt),xx.n-2);
  real t = tt-i;   
  // i is the the index variable of the multi border loop 
    int ii = (i+1); real t1 = 1-t;
    cout <<  tt << " " << i << " " <<t << " /  " << ii << endl;
    x =  xx[i]*t1 + xx[ii]*t;
    y =  yy[i]*t1 + yy[ii]*t;
    label = 0; 
  }

@frederichecht thanks for the reply
Another quick question
How are you defining xx and yy ?

Thanks

here I am lasy xx, and yy are yours vectors vectorX and vectorY

No i understood that , what i was trying to ask was how you are defining the vectors ??

Because for border C0 which in example is defined as
border C0(t=0, 2pi){x=5cos(t); y=5*sin(t);}
i am trying to generate the same structure by doing this -:
real[int] vectorX0(7),vectorY0(7);

for(int t = 0;t<2*pi;t++){

cout<< “Value of t”<<t<<endl;

vectorX0[t] = 5cos(t);
vectorY0[t] = 5
sin(t);
}

border C0(tt=0,vectorX0.n-1)
{
int i = (int(tt)%(vectorX0.n-1));
real t = tt-i;
// i is the the index variable of the multi border loop
int ii = (i+1);
real t1 = 1-t;
x = vectorX0[i]*t1 + vectorX0[ii]*t;
y = vectorY0[i]*t1 + vectorY0[ii]*t;
label = 0;
}

but it’s not forming the same circle shape as it was doing with the non-vector definition of border

is this correct way to generate the vector ??

A full exemple to understand the small code

 real[int] xx(7),yy(7); 
 for(int t = 0;t<2*pi;t++){

 cout<< "Value of t "<<t<<endl;

 xx[t] = 5*cos(t);
 yy[t] = 5*sin(t);
 }

 
 border bb(tt=0,xx.n-1) 
  {
   int i = min(int(tt),xx.n-2);
  real t = tt-i;   
  // i is the the index variable of the multi border loop 
    int ii = (i+1); real t1 = 1-t;
    cout <<  tt << " " << i << " " <<t << " /  " << ii << endl;
    x =  xx[i]*t1 + xx[ii]*t;
    y =  yy[i]*t1 + yy[ii]*t;
    label = 0; 
  }

  plot(bb(100));