Line segment

Two vector in 2-dimensional space:

$$ \begin{aligned} A &= (a_1, a_2), \text{ in }\mathbb{R}^2\\ B &= (b_1, b_2), \text{ in }\mathbb{R}^2 \end{aligned}$$

Then a line segment going from A to B can be defined as:

$$r = \vec{oa} + \lambda \vec{ab}$$

This is simply the adition of the vector $a$ with a part of the vector going from $a$ to $b$

We know from the section on vector math that the vector going from $a$ to $b$ is equal to $b-a$ and thus we can write:

$$\begin{aligned} r &= \vec{OA} + \lambda \vec{AB}\\ &= \mathbf{a} + {\lambda}(\mathbf{b}-\mathbf{a}) \\ &= \mathbf{a} + {\lambda}\mathbf{b}-{\lambda}\mathbf{a} \\ &= (1-{\lambda})\mathbf{a} + {\lambda}\mathbf{b} \\ &= ((1-{\lambda})a1 + {\lambda}b1, (1-{\lambda})a2 + {\lambda}b2) \\ \end{aligned}$$

A sample:

$${}$$

You can drag the two red dots to change the endpoints $A$ and $B$ of the lnesegment.

Change the value of $\lambda$ by dragging the slider:

Convex

In a Euclidean space, a convex region is a region where, for every pair of points within the region, every point on the straight line segment that joins the pair of points is also within the region

You can drag the red dots to change the shape of the region. The black dots can be dragged to change the line segemnt. The slider can be dragged to change the point on the line segment. If the point on the linesegment is green, it is inside the region, else if it is red it is outside the region: then the region is not concave

Concave (not Convex)

If the region is not convext (see above for the definition) then it is concave.

You can drag the red dots to change the shape of the region. The black dots can be dragged to change the line segemnt. The slider can be dragged to change the point on the line segment. If the point on the linesegment is green, it is inside the region, else if it is red it is outside the region: then the region is not concave