Jump to content

Finding the Min/Max values in a field?


Adam Ferestad

Recommended Posts

I am trying to figure out how to get the converse of a field, mathematically.  I am attempting to blur a Cd field in using a Gas Blur microsolver.  I have some mixed results, but I want to get some finer control over the radius, namely that I want it to blur more as it slows down.  I have used the gas analysis microsolver to get the speed field by taking the length of the velocity, but I can't figure out how to get larger values to be in the lower speed areas.  Obviously I would love to use a fit to invert the values, but I am struggling with an elegant way to get the minimum and maximum values for a given field.  I could easily just do a loop in a wrangle and get the min/max values that way, but that is going to be extremely slow as this is a very large, dense simulation.  Is there a simple way I can get the min/max values in a field so I can use fit(@speed, min, max, max, min) in a Gas Field Wrangle node to get the converse of my field?

Link to comment
Share on other sites

13 minutes ago, bunker said:

hscript volumemin() and volumemax()
if you open the Textport, type: exhelp volumemax

 

Are you suggesting that I need to use hscript to do this?  There is no way directly in VEX?  Or is hscript a command in VEX that I was unaware of?  I can't figure out how to use HScript within my DOPs context.  I have done it in SOPSolver nodes in the past, but never in DOPs.  Also, how to pass the value downstream to other wrangle nodes?

Edited by Adam Ferestad
Link to comment
Share on other sites

2 hours ago, bunker said:

there isn't anything in vex to do that directly but you can reference the hscript output value in vex, eg:
 

float maxvalue = chf("maxvalue");

create a spare parameter, then you can enter your hscript expression there:
volumemax("/obj/geo/myvolume", 0)

I actually ended up trying something similar to this, but within DOPs I couldn't seem to get the function to target the field.  It always returned 0.

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...