Given two points in three (or, any) dimensional space, the distance between these two can easily be plugged into a function to return a value for repulsion or attraction, ideally this function is derivable.

If I have two lines, i.e. one pair of points and another pair of points, is something similar possible without discretizing the line and calculating a lot of pairwise point-repulsions?

If it is not possible for two lines with defined end points, is it possible for two infinite rays?

  • $\begingroup$ I’m not sure I understand the question, but it looks as if you want to do a double integral over the space of pairs of points, one on each line. $\endgroup$ – Lubin Jul 17 '13 at 15:55
  • $\begingroup$ This depends on the function that describes the mentioned repulsion/attraction. It can be stated using integrals, and in some cases you can even calculate the output analytically. Of course, you can do it numerically, but this corresponds to your "discretizing" (not the same, but the outcome is that the result is not precise), usually even with arbitrary precision. $\endgroup$ – dtldarek Jul 17 '13 at 15:56
  • $\begingroup$ @Lubin: If two points in 3d can be turned into a function, then I guess the overlap of those would be one measure of repulsion. f1+f2, and the integral thereof. $\endgroup$ – finite graygreen Jul 17 '13 at 16:07
  • $\begingroup$ @finitegraygreen, that’s not the kind of integral I was talking about. Have you done multivariable calculus? $\endgroup$ – Lubin Jul 17 '13 at 16:09
  • $\begingroup$ @Lubin: For practical purposes no. I just remember partial derivatives. All is lost now? :) $\endgroup$ – finite graygreen Jul 17 '13 at 16:12

For any two subsets $L_1, L_2 \subset \mathbb{R}^{3}$, you can define a distance between them by taking the greatest lower bound of the distances between points in $L_1$ and $L_2$:

$$d( L_1, L_2 ) = \inf \{\;|\vec{x}_1 - \vec{x}_2| : \vec{x}_1 \in L_1, \vec{x}_2 \in L_2\;\}$$

When $L_1, L_2$ are "infinite" lines and if you want to assign a rotational/translation invariant potential energy $U(L_1,L_2)$ between them, the energy will depend only on two parameters:

  • The distance $d(L_1, L_2)$ above and the "angle" $\theta(L_1,L_2)$ between them.

Let's say you have given paramatrization of you lines $L_1$ and $L_2$ as:

$$L_1 = \{\; \vec{x}_1 + \lambda \vec{t}_1 : \lambda \in \mathbb{R} \;\} \quad\text{ and }\quad L_2 = \{\; \vec{x}_2 + \lambda \vec{t}_2 : \lambda \in \mathbb{R} \;\} $$ where $\vec{x}_i$ are a point of $L_i$ and $\vec{t}_i$ is a unit tangent vector for $L_i$. You can compute the angle and distance between $L_1$ and $L_2$ by simple vector arithmetics:

$$\begin{align} \theta(L_1,L_2) &= \cos^{-1}(\vec{t}_1\cdot\vec{t}_2)\\ d(L_1,L_2) &= | \mathscr{P}( \mathscr{P}( \vec{x}_1 - \vec{x}_2, \vec{t}_1 ), \mathscr{P}(\vec{t}_2, \vec{t}_1)) | \end{align}$$ where $\mathscr{P}(\vec{x},\vec{v}) = \vec{x} - \frac{(\vec{x}\cdot\vec{v})\vec{v}}{|\vec{v}|^2}$ stands for taking the component of $\vec{x}$ perpendicular to any non-zero vector $\vec{v}$. Please note that in the special case $\vec{t}_1$ parallel to $\vec{t}_2$, $\mathscr{P}(\vec{t}_1, \vec{t}_2) = \vec{0}$ and there is no need to apply the outermost projection.

If you want to construct $U(L_1, L_2)$ as some sort of integral of radial symmetric/translation invariant interaction energy between points on $L_1$ and $L_2$. i.e. taking integrals of the form:

$$U(L_1,L_2) = \iint_{\vec{x}_1 \in L_1, \vec{x}_2 \in L_2} \phi( |\vec{x}_1 - \vec{x}_2| )$$

The end result always look like this:

$$\frac{F( d(L_1,L_2) )}{|\sin\theta(L_1,L_2)|}$$

The "radial" dependence will be a function of $d(L_1,L_2)$ alone and the "angular" dependence blow up when the lines are parallel.

When $L_1$ and $L_2$ are "infinite" rays instead of "infinite" lines, the integral no longer has such simple form. However, the integral still blows up if your two rays are "parallel" and pointing in the same direction.

What's next depends on what you need to do with the lines. If you just want some way to create a bunch of random lines not clumped together, you can just forget doing any integral and define your $U(L_1,L_2)$ directly.

  • $\begingroup$ I like this contribution a lot. But surely there is a question of whether, in the case of infinite lines or rays, the relevant integrals are convergent. I haven’t done any verifications, but presumably all is well in the case of an inverse-square law. $\endgroup$ – Lubin Jul 17 '13 at 22:25
  • $\begingroup$ @Lubin, an inverse-square law won't work. It will lead to a integral with logarithm type of divergence. Let's say $\vec{x}_i$ are points on $L_i$ closest to each other. If you restrict the integral on $L_i$ to points at a distance at most $R$ from $\vec{x}_i$, your integral will pick up a divergence proportional to $\log \frac{R}{|\vec{x}_1 - \vec{x}_2|}$. An interaction $\propto \frac{1}{r^{2+\epsilon}}$ will work. $\endgroup$ – achille hui Jul 18 '13 at 2:33
  • $\begingroup$ Indeed, the distance - not of the end but of the closest points - and the angle. Much nicer to work with than integrals, thanks! $\endgroup$ – finite graygreen Jul 18 '13 at 14:01

Suppose the function for two points works as follows

$$f:\mathbb{R}^3\times\mathbb{R}^3\to\mathbb{R}: (\vec{x},\vec{y}) \mapsto f(\vec{x},\vec{y})$$

then, you can in principle extend this notion for lines by performing an integral as pointed out in the comments

$$\int_c^d\int_a^b f(\vec{x}(t),\vec{y}(s)) \|\vec{x}'(t)\| \|\vec{y}'(s)\| dtds$$


$$\vec{x}:[a,b]\to\mathbb{R}^3:t\mapsto \vec{x}(t)$$


$$\vec{y}:[c,d]\to\mathbb{R}^3:s\mapsto \vec{y}(s)$$

are parametrizations of the lines.


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.