Is it possible to do $3D$ computer graphics by signed plane products?

113 Views Asked by At

The planes equation is a friend to anyone who has taken babys first linear algebra course:

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

Furthermore let us assume we have a whole bunch of these:

$$a_ix+b_iy+c_iz+d_i=0, \forall i \in \{0,\cdots,n\}$$

Multiplication has the property that $0$ is the only number that logically short-circuits a product. So if we create the product:

$$\prod_{\forall i}(a_ix+b_iy+c_iz+d_i) = 0$$

It will be fulfilled whenever at least one of the planes are active.

Now imagine puzzling together pieces of planes to approximate some complex 3D shape. Can it be done? Has it already been done? What drawbacks or benefits would such a representation have as compared to for example the very popular polygons made out of triangles.

2

There are 2 best solutions below

1
On BEST ANSWER

The closest I can think of is the representation of convex shapes such as polytopes in convex analysis/optimization and linear programming as the intersection of half spaces. A half space is basically given by an inequality

$$a x+by+cz+d\ge 0.$$

The corresponding set is $H=\{(x,y,z)\mid ax-by-cz+d\ge 0\}$. When you intersect a finite amount $H_i$ of such halfspaces you will obtain either a polytope, or a singular case like an empty set or a line.

Example. We can associate a half space $H_i$ with its coefficients $(a_i,b_i,c_i,d_i)$. So we can give, e.g. a cube, by listing the following six half spaces:

$$ (\pm 1,0,0,1), \qquad(0,\pm 1,0,1), \qquad(0,0,\pm 1,1).$$

You can represent more complex convex shapes by using infinitely many such half spaces.

Example. The sphere can be represented by the following infinite set of halfspaces:

$$(n_x,n_y,n_z,1),\qquad \text{for } n_x^2+n_y^2+n_z^2=1.$$

In this representation it is comparatively easy to decide whether a point $(x,y,z)$ is inside or outside the shape, or on its boundary. For this you compute the values $\lambda_i=a_ix+b_iy+c_iz+d$.

  • If all $\lambda_i$ are positive, we are inside the shape.
  • If at least one $\lambda_i$ is negative, we are outside the shape.
  • If at least one $\lambda_i$ is zero, and all the other values are non-negative, we are on the boundary.

Unfortunately, we cannot decide this by looking at the product

$$\prod_i \lambda_i = \prod_i (a_ix+b_iy+c_iz+d).$$

This product only makes sense in the case of finitely many half-spaces. And even in the finite case the products sign does not carry as much information. However, we can read something from it:

  • If the product turns out to be positive, this can either mean that all the factors are positive and we are inside, or that an even number of factors is negative and we are outside.
  • If the product turns out to be zero, this can either mean that we are on the boundary, or we are outside (we cannot decide if there is another negative factor).
  • If the product is negative, we know that we are outside.

Last but not least, we can also describe non-convex shapes using this method by using multiple families of half spaces $H_i^n$. We then define the final shape to be the union of the convex shapes described by each familie:

$$H=\bigcup_n\bigcap_i H_i^n.$$

There is still a way to decide if we are inside/outside/on the boundary of the final shape by looking at any family of half spaces seperately:

  • If we are inside of at least one of the convex shapes, we are inside the final shape.
  • If we are outside all of the convex shapes, then we are outside of the final shape.
  • If we are on the boundary of at least one convex shape and not on the inside of any other convex shape, then we are on the boundary of the final shape.
0
On

With the help of Winters answer if we add one restriction to our representation, that each surface only needs be active on one unique subset which is expressed relative to all other planes subspace.


This answer will rest on the idea of splitting our $\mathbb R^3$ volume into binary partitions, depending on the sign of each of the planes equations. Therefore we can encode each partition of a plane (where equality is met for one and only one plane equation) by the unique string of signs of the other planes. Then by having a binary matrix storing this sign structure for the active area of each part of the surface. For $n=9$ planes we would therefore need $(n-1)(n-1) = 8^2 = 64$ bits to store this activation matrix. Not particularly much considering we will probably need at least $32$ bit floating precision values for each coefficient in the planes equations. $4$ coefficients per plane, gives us $4\times 32 = 128$ bits per plane. $128n = (n-1)(n-1)$ first at around $n\approx 130$, so only then the number of bits for this activation table will reach up to the number of bits required by the planes' coefficients.


I expect this representation to benefit hugely from various transform and entropy coding techniques. Well, most probably the coefficients of the planes will too!


I can verify that this works programmatically for some simple examples of a cube, hexa and octa prism without roof and ceiling :

enter image description here enter image description here enter image description here

Here is a small animation showing some mapped textures of famous test-images from image processing community. Inside the octagonal shape there is a box, to show that we can (with some minor adjustments) represent many objects :

enter image description here