# Finding coordinate in a quadrilateral

Im trying to do a simulation using Matlab to solve some fluid problem. For this problem I have the following shape:

enter image description here

For each black point I know the (x,y) coordinates.

I need to find the coordinates of the blue points which are located at 75% of the x coordinate between each two black dots and at the middle between the y coordinate of each two black dots.

I have been trying for a while but cant find simple method.

If someone can help with the logic/some code it will be much appreciated.

Thank you.

• I'm guessing your description of where the blue point are is unclear, because you already described it with a formula, and you can directly use that formula (i.e. add up the y-coordiantes and divide by 2). – Todor Markov Nov 30 '18 at 21:03
• I know where the blue point should be, however when thinking about the problem as problem with above 1000 points I cant figure out the iterative formula – Ben Nov 30 '18 at 21:07

In your case for $$(x_{i},y_{i})$$, start with co-ordinate for top left corner for $$(x_{1}, y_{1})$$ and go counter-clockwise for the next three. Use $$s=0.5$$ and $$t=0$$ in the formulas below.
$$x = \sum_{i} N_{i}(s,t) x_{i}$$ $$y = \sum_{i} N_{i}(s,t) y_{i}$$ $$\begin{matrix} N_{1}(s,t) & = & (1-s)(1-t)/4 \\ N_{2}(s,t) & = & (1+s)(1-t)/4 \\ N_{3}(s,t) & = & (1+s)(1+t)/4 \\ N_{4}(s,t) & = & (1-s)(1+t)/4 \end{matrix}$$
• The quadrilateral is mapped into a square with co-ordinates $(-1,-1), (1,-1), (1,1), (-1,1)$. $s$ and $t$ are the co-ordinates in this square. For mid-point in $y$, $t=0$. For $3/4$ point in $x$, $s=0.5$. You can download the power point for more details. This mapping technique is used in finite element analysis. – boidy Nov 30 '18 at 23:17