Mirorring a set of Points

278 Views Asked by At

Let's say I have a cloud of points, and I know the equation of the symmetry plane. I'd like to mirror every single point with respect to this plane. It might be much simpler than I think, but I have some difficulties on finding a way to do that in Java.

I have the $x,y,z$ position of each point, its distance from the symmetry plane, the equation of the plane. How can I find the $x,y,z$ of the mirrored point ? I was trying to find the point of intersection between the symmetry plane and the line that passes through the point I have to mirror and with its normal being the symmetry plane.

I think it's more an Algebra problem than a Java one. But I still don't know how to do it without Java. I was trying to calculate a linear system :

Line: $ax+by+cz+d=0$

Plane $a'x+b'y+c'z+d' =0$

But it looks like some informations are missing and I can't solve it (only two equations). I hope I explained myself properly.

1

There are 1 best solutions below

0
On

Your can solve this problem using vector algebra.

Now suppose we have a point $P$ and a plane with normal vector $\vec{n}(|\vec{n}|=1)$ passing through point $P_0$. To find the symmetric point $P'$, we find the projection $K$ of $P$ on the plane first: $$ \vec{KP} = |\vec{KP}|\cdot \vec{n} = (\vec{P_0 P} \cdot \vec{n})\vec{n}$$

fig1

Note that $\vec{P_0 P} \cdot \vec{n}$ is actually equals to $$\frac{ax + by + cz + d}{\sqrt{a^2+b^2+c^2}} $$ You can use this form or just use the $P_0$ method in your program. Finally, we get $P'$ easily: $$ \vec{OP'} = \vec{OP} - 2\vec{KP}$$ where $O$ is the origin point $(0, 0, 0)$.

Here I suppose you use a vector library in your Java program, so your functions can handle vectors. The following pseudocode shows how to find $P'$, tough it's not Java.

function findSymmetricPoint(p:vector3D, n:vector3D, p0:vector3D) -> p1:vector3D
    n = n.normalized()
    return p - n.dot(2 * (p - p0).dot(n))
end