I'm trying to create parallel lines of the bold, black lines in this picture:

enter image description here

It is just an arbitrary (convex) quadrilateral, with the blue corner points known. The bold, black lines start at 25% of each blue line and end at 75%. So, say $\lambda_1 = 0.25$ and $\lambda_2 = 0.75$, then

$$\begin{align} Start = \lambda_1 \cdot c_2 + (1-\lambda_1) \cdot c_1 \\ End = \lambda_2 \cdot c_2 + (1-\lambda_2) \cdot c_1 \end{align}$$

Where $c_1$ and $c_2$ are the two points of a blue line.

Now my actual questions. 1.) How to create a parallel line to such a bold black line? It should have the same length, and be guided along the dashed green line towards the centroid. If I'm not mistaken, the centroid is at the intersection of the two bimedians (the dashed green lines). Since it is a quadrilateral, this should be the same as the mean value of the 4 points at the corners. Therefore, the centroid is known as well.

2.) Ok, so say I got the parallel lines. Then I move them all towards the centroid, until their endpoints touch, creating a scaled-down version of this quadrilateral. Is there a way to obtain the coordinates of these 4 new corner points in general?

By the way, I did a search and came up with this topic, but there it is guided along the perpendicular line, and my green dashed lines are not perpendicular to the blue/black ones.

Edit: The equation for a dashed green line from the center of the blue line towards the centroid would be

$$\begin{align} \lambda \cdot C + (1 - \lambda) \cdot \left( \frac{c_1+c_2}{2} \right) \end{align}$$

Where $C$ is the centroid. The equation for a bimedian would be

$$\begin{align} \gamma \cdot \left( \frac{c_3+c_4}{2} \right) + (1 - \gamma) \cdot \left( \frac{c_1+c_2}{2} \right) \end{align}$$

So somehow, the $Start$ and $End$ points must be moved in the direction of one of these lines above, in order to create a $NewStart$ and $NewEnd$ point. Then the equation for the parallel line would simply be

$$\begin{align} \eta \cdot NewEnd + (1-\eta) \cdot NewStart \end{align}$$

Once the 4 expressions for the parallel lines are known, the intersection can be calculated, hopefully resulting in a relatively easy expression for the 4 new corner points.

  • 1
    $\begingroup$ Here's a thought: you know that the black segments are half the scale of the blue segments, no? Why can't you shift things such that the centroid's at the origin, apply a scaling transformation, and then shift back to the original centroid? $\endgroup$ – J. M. is a poor mathematician Dec 17 '11 at 14:22
  • $\begingroup$ That's actually a very good idea, I was so focused on a single line that I didn't think of that! Ok, I'm going to work it out and see what expressions for the 4 corner points I can find. $\endgroup$ – Ailurus Dec 17 '11 at 14:46
  • 1
    $\begingroup$ The vertices of the reduced quadrilateral are the midpoints of the lines $Cc_1,Cc_2,Cc_3,Cc_4$. $\endgroup$ – Américo Tavares Dec 17 '11 at 15:18
  • $\begingroup$ That's right Américo, once you work out J.M.'s idea for a point, you get this result. For instance, take $c_1$ and calculate the new position $\hat{c_1}$. First shift everything such that the centroid is at the origin (so subtract $C$). Then scale with $1 \over 2$. Finally, add $C$ to go back to the original centroid. So, $\hat{c_1} = {1 \over 2} (c_1 - C) + C$ which equals ${1 \over 2} (c_1 + C)$. $\endgroup$ – Ailurus Dec 17 '11 at 16:06
  • $\begingroup$ As a reminder, Ailurus: if you've figured it out, please write what you have as an answer, and then maybe accept it. $\endgroup$ – J. M. is a poor mathematician Dec 18 '11 at 4:06

Ok, easy way to solve this is as follows:

  1. Represent the lines as two points $(x_1,y_1,z_1), (x_2,y_2,z_2)$
  2. Require them to be in same plane, and convert $(x,y,z) : R \times R \times R$ to $(x,y) : R \times R$ to get plane coordinates; a projection from 3d space to a 2d plane is a good choice for this
  3. intersection between lines works only in 2d plane. (check the algorithm from wikipedia under line-line intersection)
  4. then you end up with 4 2d points, and need to convert them back to 3d.
  • 2
    $\begingroup$ Rather circuitous to project when the problem's planar to begin with, no? $\endgroup$ – J. M. is a poor mathematician Dec 17 '11 at 14:05
  • $\begingroup$ well, his math was suitable for both 2d or 3d... Just had to make sure that wasn't the problem. $\endgroup$ – tp1 Dec 17 '11 at 15:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.