karamazovbros
karamazovbros

Reputation: 979

Is there any use for the determinant of a 4x4 matrix in computer graphics?

In most graphics libraries I've seen, there's some function that returns the determinant from 3x3 and 4x4 matrices, but I have no idea when you'd actually need to use the determinant in 3D computer graphics.

What are some examples of using a determinant in 3D graphics programming?

Upvotes: 2

Views: 1376

Answers (3)

lhf
lhf

Reputation: 72312

The incircle test is a key primitive for computing Voronoi diagrams and Delaunay triangulations. It is given by the sign of a 4x4 determinant.

enter image description here

(picture from https://www.cs.cmu.edu/~quake/robust.html)

Upvotes: 2

Spektre
Spektre

Reputation: 51845

In 3D vector graphics

there are used 4x4 homogenuous transform matrices and we need booth direct and inverse matrices which can be computed by (sub)determinants. But for orthogonal matrices there are faster and more accurate methods like

Many intersection tests use determinants (or can be converted to use them) especially for quadratic equations (ellipsoids,...) for example:

as Matt Timmermans suggested you can decide if your matrix is invertible or left/right handed which is useful to detect errors in matrices (accuracy degradation) or porting skeletons in between formats or engines etc.

And I am sure there area lot of other uses for it in vector math (IIRC IGES use them for rotational surfaces, cross product is determinant,...)

Upvotes: 2

Matt Timmermans
Matt Timmermans

Reputation: 59184

Off the top of my head...

If the determinant is 0 then the matrix cannot be inverted, which can be useful to know.

If the determinant is negative, then objects transformed by the matrix will reversed as if in a mirror (left handedness becomes right handedness and vice-versa)

For 3x3 matrices, the volume of an object will be multiplied by the determinant when it is transformed by the matrix. Knowing this could be useful for determining, for example, the level of detail / number of polygons to use when rendering an object.

Upvotes: 5

Related Questions