[size=150]Frost Functions[/size]
mesh_union_of_spheres(…)
mesh_union_of_spheres( (ParticleArray)particles [, (object)voxelLength=None [, (int)vertexRefinement=10 [, (object)vertexChannels=None [, (object)radius=None [, (bool)regularize=False]]]]]) -> Trimesh3 :
Create a Union of Spheres mesh.
Arguments:
[list]* particles – ParticleArray of particles to place spheres around.
[*]voxelLength – The mesh is created on a 3D grid. voxelLength controls the size of the 3D grid cells. Smaller values produce a mesh with more faces and potentially more detail. If set to None (the default), then the voxelLength is set to half the maximum particle radius.
- vertexRefinement – Number of iterations to bring the mesh closer to the true surface.
- vertexChannels – A list of channel names to propagate from the particles to the output mesh.
- radius – Set the particles’ ‘Radius’ channel value. If None (the default), then the existing value of the ‘Radius’ channel is used instead.
- regularize – (Experimental) When True, attempt to improve the shape of mesh triangles. vertexRefinement controls the number of iterations.
[/*:m][/list:u]
mesh_metaballs(…)
mesh_metaballs( (ParticleArray)particles [, (object)voxelLength=None [, (float)effectRadiusScale=1.5 [, (float)implicitThreshold=0.29999999999999999 [, (int)vertexRefinement=10 [, (object)vertexChannels=None [, (object)radius=None [, (bool)regularize=False]]]]]]]) -> Trimesh3 :
Create a Metaball mesh.
Arguments:
[list]* particles – ParticleArray of particles to create metaballs from.
[*]voxelLength – The mesh is created on a 3D grid. voxelLength controls the size of the 3D grid cells. Smaller values produce a mesh with more faces and potentially more detail. If set to None (the default), then the voxelLength is set to half the maximum particle radius.
- effectRadiusScale – The particle radius is scaled by this factor.
- implicitThreshold – The implicit surface level to create the mesh at. Smaller values create a larger mesh that is farther from the particles, while larger values create a smaller mesh that is closer to the particles.
- vertexRefinement – Number of iterations to bring the mesh closer to the true surface.
- radius – Set the particles’ ‘Radius’ channel value. If None (the default), then the existing value of the ‘Radius’ channel is used instead.
- regularize – (Experimental) When True, attempt to improve the shape of mesh triangles. vertexRefinement controls the number of iterations.
[/*:m][/list:u]
mesh_zhu_bridson(…)
mesh_zhu_bridson( (ParticleArray)particles [, (object)voxelLength=None [, (float)effectRadiusScale=1.7 [, (float)trimThreshold=1.0 [, (float)trimStrength=15.0 [, (int)vertexRefinement=10 [, (object)vertexChannels=None [, (object)radius=None [, (bool)regularize=False]]]]]]]]) -> Trimesh3 :
Create a Zhu/Bridson mesh.
Arguments:
[list]* particles – ParticleArray of particles to create a mesh from.
[*]voxelLength – The mesh is created on a 3D grid. voxelLength controls the size of the 3D grid cells. Smaller values produce a mesh with more faces and potentially more detail. If set to None (the default), then the voxelLength is set to half the maximum particle radius.
- effectRadiusScale – The particles are blended up to a distance of their radius * effectRadiusScale.
- trimThreshold – Regions under this density will be affected by low density trimming.
- trimStrength – The strength of the low density trimming effect.
- vertexRefinement – Number of iterations to bring the mesh closer to the true surface.
- vertexChannels – A list of channel names to propagate from the particles to the output mesh.
- radius – Set the particles’ ‘Radius’ channel value. If None (the default), then the existing value of the ‘Radius’ channel is used instead.
- regularize – (Experimental) When True, attempt to improve the shape of
mesh triangles. vertexRefinement controls the number of iterations.
This is based on the method described in:
Yongning Zhu and Robert Bridson. “Animating Sand as a Fluid”. ACM Transactions on Graphics, vol 24, number 3, pp 965-972, July 2005.[/*:m][/list:u]
mesh_anisotropic(…)
mesh_anisotropic( (ParticleArray)particles [, (object)voxelLength=None [, (float)effectRadiusScale=4 [, (float)implicitThreshold=0.5 [, (float)maxStretch=4.0 [, (long)minNeighborsStretch=25 [, (float)positionSmoothing=0.90000000000000002 [, (int)vertexRefinement=10 [, (object)vertexChannels=None [, (object)radius=None [, (bool)regularize=False]]]]]]]]]]) -> Trimesh3 :
Create an Anisotropic mesh.
Anisotropic meshing stretches the particles to fit the shape of the nearby surface.
Arguments:
[list]* particles – ParticleArray of particles to create a mesh from.
[*]voxelLength – The mesh is created on a 3D grid. voxelLength controls the size of the 3D grid cells. Smaller values produce a mesh with more faces and potentially more detail. If set to None (the default), then the voxelLength is set to half the maximum particle radius.
- effectRadiusScale – The particle radius is scaled by this factor.
- implicitThreshold – The implicit surface level to create the mesh at. Smaller values create a larger mesh that is farther from the particles, while larger values create a smaller mesh that is closer to the particles.
- maxStretch – The greatest allowed ratio between the stretch in different directions.
- minNeighborsStretch – The minimum number of particles required near a particle to activate stretching. With fewer than this number of neighboring particles, the particle will be shaped as a sphere.
- positionSmoothing – Particles are moved toward their neighbors to smooth out lumps in the mesh surface. positionSmoothing controls the strength of this effect. 0 produces no smoothing, while 1 applies the full effect.
- vertexRefinement – Number of iterations to bring the mesh closer to the true surface.
- vertexChannels – A list of channel names to propagate from the particles to the output mesh.
- radius – Set the particles’ ‘Radius’ channel value. If None (the default), then the existing value of the ‘Radius’ channel is used instead.
- regularize – (Experimental) When True, attempt to improve the shape of mesh triangles. vertexRefinement controls the number of iterations.
This meshing method is based on:
Jihun Yu and Greg Turk. “Reconstructing Surfaces of Particle-Based Fluids Using Anisotropic Kernels”. ACM SIGGRAPH Symposium on ComputerAnimation (2010).[/*:m][/list:u]
get_logging_level(…)
get_logging_level() -> int :
Get the logging level.
set_logging_level(…)
set_logging_level( (int)loggingLevel) -> None :
Set the logging level.
[list]0 is no logging,
1 is errors only,
2 is warnings,
3 is progress,
4 is statistics, and
5 is debugging.[/list:u]
[size=150]Frost Classes[/size]
ParticleArray
An array of particle data.
You can create a ParticleArray by reading a particle file from disk:
>>> pa = Frost.ParticleArray.ReadFromFile( 'two_particles.prt' )
Methods:
[list]GetChannelDict(…)
[list]GetChannelDict( (ParticleArray)self) -> dict :
[list]Return the channel map as a dictionary.[/list:u]
WriteToFile(…)
WriteToFile( (ParticleArray)self, (str)fileName) -> None :
[list]Write the particle array to the specified .prt file.
WriteToFile( (ParticleArray)self, (str)fileName, (dict)channelDict) -> None :
Write the particles to the specified .prt file, using the specified channel map.[/list:u][/list:u]
Static methods:
ReadFromFile(…)
[list]ReadFromFile( (str)fileName) -> ParticleArray :
[list]Load the particles from the specified file.
Thinkbox PRT (.prt), Comma-Separated Value (.csv), and Next Limit RealFlow (.bin) files are supported.
ReadFromFile( (str)fileName, (dict)channelDict) -> ParticleArray :
Load the particles from the specified file, using the specified channel map.
Thinkbox PRT (.prt), Comma-Separated Value (.csv), and Next Limit RealFlow (.bin) files are supported.[/list:u][/list:u][/list:u]
Trimesh3
A triangle mesh.
A mesh can be written to a .xmesh file:
>>> m.WriteToFile( 'out.xmesh' )
Or it can be written to a Wavefront .obj file instead by changing the file extension:
>>> m.WriteToFile( 'out.obj' )
Methods:
[list]GetFaceChannelDict(…)
[list]GetFaceChannelDict( (Trimesh3)self) -> dict :
[list]Return a dictionary of the face channel names and types.[/list:u]
GetFaceCount(…)
GetFaceCount( (Trimesh3)self) -> int :
[list]Return the number of faces in the mesh.[/list:u]
GetVertexChannelDict(…)
GetVertexChannelDict( (Trimesh3)self) -> dict :
[list]Return a dictionary of the vertex channel names and types.[/list:u]
GetVertexCount(…)
GetVertexCount( (Trimesh3)self) -> int :
[list]Return the number of vertices in the mesh.[/list:u]
Relax(…)
Relax( (Trimesh3)self, (long)iterations, (float)weight) -> None :
[list]Apply Laplacian relaxation to the mesh.[/list:u]
WriteToFile(…)
WriteToFile( (Trimesh3)self, (str)fileName) -> None :
[list]Save the mesh to a file. Thinkbox .xmesh and Wavefront .obj files are supported.[/list:u][/list:u]
Static methods:
ReadFromFile(…)
[list]ReadFromFile( (str)fileName) -> Trimesh3 :
[list]Read a mesh file. Thinkbox .xmesh and Wavefront .obj files are supported.[/list:u][/list:u][/list:u]