I have a set of $m$ points $(p_1,p_2,\ldots,p_m)$, that are to be taken two at a time as one of the edges of a triangle. It is given that consecutive edges are formed by $p_1 - p_2$ and $p_2-p_3$, etc - the points can be visualized to be on a line, one after the other. Also, I have another set of $n$ points $(q_1,\ldots,q_n)$, that I want to use as the third vertex of the triangle. These points can be assumed to be on a line as well. Essentially, I want to find out the number of triangles that I can draw, without any intersections - so I could have $p_1p_2q_1, p_2p_3q_1, p_3p_4q_2, p_4p_5q_3$ and so on, as the triangles if you get the drift.
I think my formulation of this as a question of assigning a label to $m$ ordered items, from $n$ labels, so that any later item doesn't get a lower label should give the correct answer, but I'm having a hard time solving it using my elementary knowledge of combinatorics.
Aside from an answer , any pointer to the relevant maths that I'd need to pick up to solve such questions would also be much appreciated.