All problems
Gaussian Splat Projection
Problem
Project a 3D Gaussian to 2D. Build R as a rotation about z and S2 = diag(scale^2), form the 3D covariance M = R S2 R^T, then return the 2x2 covariance W M W^T for the 2x3 view matrix W.
The signature is gaussian_splat_projection(scales, rotation, view_rows). scales is [sx, sy, sz].
Hint
The 2D covariance drives the screen-space ellipse used for alpha compositing.
Test cases
case 1
in: [[1,1,1],0,[[1,0,0],[0,1,0]]]
expected: [[1,0],[0,1]]
case 2
in: [[2,1,1],0,[[1,0,0],[0,1,0]]]
expected: [[4,0],[0,1]]
case 3
in: [[1,1,1],1.5707963268,[[1,0,0],[0,1,0]]]
expected: [[1,0],[0,1]]
case 4
in: [[2,1,1],1.5707963268,[[1,0,0],[0,1,0]]]
expected: [[1,0],[0,4]]
case 5
in: [[2,3,1],0,[[0,1,0],[1,0,0]]]
expected: [[9,0],[0,4]]
Starter codePython
import math
def gaussian_splat_projection(scales, rotation, view_rows):
# Your code here
pass5 test cases · run your code against them in the editor