Jump to content

Calculate Curl on a grid sop using attrwrangle sop


nosferatu_037

Recommended Posts

Hey guys

Ive been trying this for a while now, but i still am not able to solve it.

Other than converting a grid to a volume and running a volume analyse sop, how would one calculate curl of velocity on a grid sop using an attribute wrangle.

Ive setup a simple grid and ran it thru a pointvop in which ive just plugged in the output of a curl noise vop into v. Now i just want to calculate the curl of v using just the attribute wrangle using neighbours() vex function.
So far ive managed to calculate the gradient of each v component, but the rest of math i cannot translate to proper code. 

Any ideas?

p.s. does anyone have resources how to move from math notations to code

Thanks

Link to comment
Share on other sites

In that case, I would probably use edge connectivity or point clouds and get the point with the maximum v.x, v.y, v.z separately from the current point, and then calculate a vector that goes from the current point to the point with the max value.

Then you can replace the gradient vectors with these vector values.

Link to comment
Share on other sites

Yeah i actually did exactly the same, the problem is i would get completely different results compared to a vdb analysis sops curl operator.

Thats why i thought i was doing something wrong math wise, or i just didnt understand the notation really well.

I just used the neighbours() vex command to extract the points sharing the same edge, and went to build a gradient for each v component. I got a 3x3 matrix with the gradient vector components in it, and did the same subtraction like in that example you sent, but it looked so different from volume curl, i couldnt figure out why.

Link to comment
Share on other sites

you get the curl if you take the cross product from your vector and gradient, if you want compute the gradient from a grid in vex,  you have a ode with 2 components x,y and you can compute the gradient for each component, but if you have 3 components and they depending from eachother like a vectorfield,  you can use a gradient descent (jacobian) algorithm it does the exact same thing what sensei pusat described to compute the partial deriative, to get the gradient for a vectorfield with x,y,z, its my understanding i can be wrong 

Edited by deniz
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...