How to add constraints to vectors

433 Views Asked by At

Is it possible to add constraints to vectors, more specifically, planes? For instance:

enter image description here

In this example, is it possible to constrain the red plane with Cartesian equation $z=0$ to only occupy within the area within the area of the yellow lines, such that only the green line intersects the plane and not the purple one?

2

There are 2 best solutions below

0
On BEST ANSWER

So you want to parametrize the plane such that a point on the plane is defined by two parameters $$ \vec{r} = \mathbf{ S}(u,v) $$

and then set limits to $u$ and $v$ to define your bounds. In case of a plane, you need a local coordinate system with two mutually orthogonal directions $\mathbf{e}_1$ and $\mathbf{e}_2$ that are also orthogonal to the plane normal $ \mathbf{n} \cdot \mathbf{e}_i = 0$. The origin center is at $\vec{r}_0$.

$$ \vec{r} = \vec{r}_0+ \mathbf{e}_1 u + \mathbf{e}_2 v $$

Now the question becomes: how to set a local coordinate system on a plane defined by the equation $ax +by + cz+d =0 $

The plane normal is $$\mathbf{n} = \frac{1}{\sqrt{a^2+b^2+c^2}} \pmatrix{a\\b\\c}$$ and the point on the plane closest to the origin is

$$ \vec{r}_0 = \pmatrix{ \frac{-a d}{a^2+b^2+c^2} \\ \frac{-b d}{a^2+b^2+c^2} \\ \frac{-c d}{a^2+b^2+c^2} } $$

The choice of local unit vector directions is somewhat arbitrary, but it makes sense to use something related to the bounds you want to define. The only requirement for $\mathbf{e}_1 = \pmatrix{e_x & e_y & e_z}$ is that it has $e_x a + e_y b + e_z c = 0$

One way to achieve this is by finding the direction closest to the x-axis

$$\mathbf{e}_1 = \pmatrix{ \frac{b^2+c^2}{a^2+b^2+c^2} \\ \frac{-a b}{a^2+b^2+c^2} \\ \frac{-a c}{a^2+b^2+c^2} }$$

or the y-axis

$$\mathbf{e}_1 = \pmatrix{ \frac{-a b}{a^2+b^2+c^2} \\ \frac{a^2+c^2}{a^2+b^2+c^2} \\ \frac{-b c}{a^2+b^2+c^2} }$$

or the z-axis

$$\mathbf{e}_1 = \pmatrix{ \frac{-a c}{a^2+b^2+c^2} \\ \frac{-b c}{a^2+b^2+c^2} \\ \frac{a^2+b^2}{a^2+b^2+c^2} }$$

and finally, define the second direction from the cross product of $\mathbf{n}$ and the first direction

$$ \mathbf{e}_2 = \text{unitvector}( \mathbf{n} \times \mathbf{e}_1 ) $$

Summary

With the above scheme you can go from $u$ and $v$ to a point on the plane $\vec{r}=\mathbf{S}(u,v)$. Your limits are set in terms of $(u,v)$ as planar coordinates. For example $u=1$ will produce a line on the plane which is offset from the plane origin by one unit along the local v direction.

0
On

Suppose that you have the equation of a line as $$\vec r=\vec r_0+t\vec d$$Here $\vec r=(x,y,z)$, $\vec r_0=(x_0,y_0,z_0)$, $\vec d=(d_x,d_y,d_z)$, and $t\in\mathbb R$. Here $\vec r_0$ and the direction $\vec d$ are some constants that you provide to describe the line (they can be calculated for example from two points on the line). The intersection of the above line with the plane $P$ will provide a constraint on the parameter $t$. For example, in the case that the plane is given by $z=0$, the intersection means that $$z=z_0+td_z=0$$ or $$t=-\frac{z_0}{d_z}$$The other components of the intersection are then $$x=x_0+td_x=x_0-z_0\frac{d_x}{d_z}\\y=y_0+td_y=y_0-z_0\frac{d_y}{d_z}$$ All you need to do now is to check if these values are inside the yellow area.