Closed Schizo closed 6 years ago
It has both 2D and 3D.
Sorry I actually wanted to refer to the 88 LOC version.
That one is 2D :-)
Just out of curiosity, would it need a lot of modification's for 3D or would it be small adjustments? Just trying to figure out if I should give it a try with numpy for a weekend project.
The modification will be very small, but you probably need a good way to visualize the particles
Let me know if you run into any troubles.
Thanks, I would visualize it in Houdini, which ships with numpy.
I'm getting negative values for the sqrt
operation, are we expecting negative values to appearin fx?
Vec w[3]{Vec(0.5) * sqr(Vec(1.5) - fx), Vec(0.75) - sqr(fx - Vec(1.0)),
Vec(0.5) * sqr(fx - Vec(0.5))};
My values for fx
on the first frame in numpy:
[ 0.92728481 -4.5629436 ]
[ 3.35277425 4.02428301]
[-3.37517478 -1.65776099]
[ 1.59791531 1.60818924]
[ 1.02547799 -4.36063837]
produced using:
numOfParticles = 5
arr.pos = [[(np.random.random_sample() * 2.0-1) * 0.08 + x, (np.random.random_sample() * 2.0-1) * 0.08 + y] for i in range(0, numOfParticles)]
Hi, sqr(x)
here means x*x
.
Oh ok, completely missed that it's the square
. Thanks a lot.
How does np.linalg.svd
align with taichis svd
function?
The returned sig
in svd_u, sig, svd_v = np.linalg.svd(p['F'])
is a( 1x1) matrix.
Not sure about numpy. In taichi, svd(M, U, sig, V)
gives
M=U sig V^T
UU^T=I
VV^T=I
sig=diag(sig)
Ok, that should be the same, and sig is as well the diag, could you verify that the following assumptions are correct, especially in terms of shape?
#Input
F = [[0, 1], [2,3]]
svd(F, svd_u, sig, svd_v)
#Output
svd_u = [[-0.22975292 -0.97324899]
[-0.97324899 0.22975292]]
sig = [ 3.70245917 0.54018151]
svd_v = [[-0.52573111 -0.85065081]
[ 0.85065081 -0.52573111]]
Are those the expected shapes of the matrices?
import numpy as np
U = np.array([[-0.22975292, -0.97324899], [-0.97324899 , 0.22975292]])
sig = np.array([[3.70245917, 0], [0, 0.54018151]])
V = [[-0.52573111, -0.85065081], [ 0.85065081, -0.52573111]]
print(np.dot(np.dot(np.transpose(U), sig), V))
[[ -1.54186712e-09 9.99999996e-01]
[ 1.99999999e+00 3.00000001e+00]]
Hi Schizo,
There seem to be a few other people trying to implement mls-mpm88 with numpy. Do you mind sharing your numpy code to help them? You can create a github repo and I will link to it.
Thanks, Yuanming
Just wondering if this implementation is a 2D or 3D implementation?