# Ellipse with FF+

**URL:** <https://community.freefem.org/t/ellipse-with-ff/506>\
**Category:** General Discussion\
**Created:** [July 13, 2020, 10:23pm UTC](https://community.freefem.org/t/ellipse-with-ff/506 "2020-07-13T22:23:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aicha](https://avatars.discourse-cdn.com/v4/letter/a/ec9cab/32.png) [@Aicha](https://community.freefem.org/u/Aicha)\
**Post date:** [July 13, 2020, 10:23pm UTC](https://community.freefem.org/t/ellipse-with-ff/506/1 "2020-07-13T22:23:06Z")

</div>

Hi,  
how we can define an ellipse with FF++ and plot it?

Regards

---

<div class="post-metadata">

**Author:** ![cmd](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/cmd/32/67_2.png) [@cmd](https://community.freefem.org/u/cmd)\
**Post date:** [July 13, 2020, 10:34pm UTC](https://community.freefem.org/t/ellipse-with-ff/506/2 "2020-07-13T22:34:10Z")

</div>

```
int nn = 40;
real a = 1, b = 3;
border ellipse(t=0, 2.*pi){x=a*cos(t); y=b*sin(t); label=1;};
plot(ellipse(nn));
```

---

<div class="post-metadata">

**Author:** ![Aicha](https://avatars.discourse-cdn.com/v4/letter/a/ec9cab/32.png) [@Aicha](https://community.freefem.org/u/Aicha)\
**Post date:** [July 13, 2020, 10:44pm UTC](https://community.freefem.org/t/ellipse-with-ff/506/3 "2020-07-13T22:44:21Z")

</div>

Thak tou so much.  
Anothe question please. The following code plot many balls in the domaine [0,1]x[0,1].  
How we can modify this function to obtain ellipse in place of the balls?

real eps=0.2;  
real w1=3.0;  
func real q1 (real t, real s, real w1) {

real t1 = t - rint(t);

real s1 = s - rint(s);

real delta1=1.0/sqrt(w1\*pi);

if ( square(s1)+square(t1) \<= square(delta1))

return w1;  
else

return 0.0;  
};  
int N=200.;  
mesh Th=square(N,N,[x,y]);  
fespace Wh(Th,P2,periodic=[[2,y],[4,y],[1,x],[3,x]]);  
Wh uplot;  
uplot=q1(x/eps,y/eps,w1);  
plot(uplot,fill=true,value=true,ps=“q1.eps”);

---

<div class="post-metadata">

**Author:** ![cmd](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/cmd/32/67_2.png) [@cmd](https://community.freefem.org/u/cmd)\
**Post date:** [July 13, 2020, 10:54pm UTC](https://community.freefem.org/t/ellipse-with-ff/506/4 "2020-07-13T22:54:14Z")

</div>

define

```
real a=1,b=3;

```

and replace the inequality with

```
if ( a*square(s1)+b*square(t1) <= square(delta1))
```

---

<div class="post-metadata">

**Author:** ![Aicha](https://avatars.discourse-cdn.com/v4/letter/a/ec9cab/32.png) [@Aicha](https://community.freefem.org/u/Aicha)\
**Post date:** [July 14, 2020, 9:56am UTC](https://community.freefem.org/t/ellipse-with-ff/506/5 "2020-07-14T09:56:02Z")

</div>

Thank you so much  
Best regards
