5
$\begingroup$

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.

  • 0
    As a reminder, Ailurus: if you've figured it out, please write what you have as an answer, and then maybe accept it.2011-12-18

1 Answers 1

1

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.
  • 0
    well, his math was suitable for both 2d or 3d... Just had to make sure that wasn't the problem.2011-12-17