Jump to content

Accessing a voxel of SIM_ScalarField by index


Recommended Posts

Hello, I'm trying to write a microsolver that changes the scalarfield's voxel value according to the points position of the given geometry. So, I'd like to know how to access the voxel data of SIM_ScalarField by index vector without iterating entire field. For example, changing the voxel value in [2, 10, 6] to 1.

Thank you.

Link to comment
Share on other sites

You probably need to get access to underlying voxel array via raw field. 

//  SIM_ScalarField *source....
SIM_RawField  *raw_field = source->getField(); 
UT_VoxelArray *array = raw_field->fieldNC(); 
array->setValue(vx, vy, vz, 1.0f);

 

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