载入中...
搜索中...
未找到

Uniform signed-distance voxel field over a box. 更多...

#include <FluidSdf.h>

Public 成员函数

int voxelCount () const
 Voxel count.
 
int index (int x, int y, int z) const
 Index.
 
bool inBounds (const glm::ivec3 &c) const
 In bounds.
 
float sample (const glm::vec3 &p) const
 Trilinearly interpolated signed distance at p.
 
MeshSdfSample sampleWithGradient (const glm::vec3 &p) const
 Samples distance and analytic trilinear gradient from the same eight voxels.
 
glm::vec3 gradient (const glm::vec3 &p) const
 Analytic trilinear gradient (outward normal) at p.
 

静态 Public 成员函数

static MeshSdf makeSphere (const glm::vec3 &center, float radius, const glm::ivec3 &dims)
 Bake an analytic sphere into the field.
 
static MeshSdf makePlane (float planeY, const glm::ivec3 &dims, float halfExtent)
 Bake a horizontal plane y = planeY into the field.
 
static MeshSdf makeFromTriangles (const std::vector< glm::vec3 > &positions, const std::vector< uint32_t > &indices, const glm::ivec3 &dims)
 Voxelize a closed triangle mesh.
 

Public 属性

glm::vec3 origin {0.f}
 World-space position of voxel (0,0,0).
 
float cellSize = 1.f
 World-space size of one voxel.
 
glm::ivec3 dims {0}
 Voxel resolution along each axis.
 
std::vector< float > distances
 Signed distances, dims.x * dims.y * dims.z floats.
 

详细描述

Uniform signed-distance voxel field over a box.

在文件 FluidSdf.h 第 28 行定义.

成员函数说明

◆ gradient()

glm::vec3 eve::fluids::MeshSdf::gradient ( const glm::vec3 &  p) const

Analytic trilinear gradient (outward normal) at p.

参数
pworld position.
返回
gradient vector (not normalized).

在文件 FluidSdf.cpp 第 128 行定义.

引用了 eve::fluids::MeshSdfSample::gradient, p , 以及 sampleWithGradient().

被这些函数引用 eve::fluids::FluidSimulation::spawnDrop().

◆ inBounds()

bool eve::fluids::MeshSdf::inBounds ( const glm::ivec3 &  c) const

In bounds.

返回
true when voxel coordinate is inside the field.

在文件 FluidSdf.cpp 第 91 行定义.

引用了 c , 以及 dims.

◆ index()

int eve::fluids::MeshSdf::index ( int  x,
int  y,
int  z 
) const

Index.

返回
flat index for voxel (x,y,z); asserts bounds.

在文件 FluidSdf.cpp 第 89 行定义.

引用了 dims, x, y , 以及 z.

被这些函数引用 makePlane() , 以及 makeSphere().

◆ makeFromTriangles()

MeshSdf eve::fluids::MeshSdf::makeFromTriangles ( const std::vector< glm::vec3 > &  positions,
const std::vector< uint32_t > &  indices,
const glm::ivec3 &  dims 
)
static

Voxelize a closed triangle mesh.

Unsigned distance is swept triangle-by-triangle over each triangle's expanded AABB, with exact evaluation for untouched cells; the sign comes from a deterministic skew-direction even-odd raycast.

参数
positionstriangle vertices, 3 floats each.
indicestriangle indices, 3 ints per triangle.
dimsvoxel resolution.
返回
signed field over the mesh's bounding box (padded one voxel).

在文件 FluidSdf.cpp 第 166 行定义.

引用了 a, b, c, cell, d, dims, distance, indices, p, pad, positions, t, v, x, y , 以及 z.

被这些函数引用 eve::fluids::exposeVolumeFluidFactory().

◆ makePlane()

MeshSdf eve::fluids::MeshSdf::makePlane ( float  planeY,
const glm::ivec3 &  dims,
float  halfExtent 
)
static

Bake a horizontal plane y = planeY into the field.

参数
planeYplane height.
dimsvoxel resolution.
halfExtenthalf side length of the square field.
返回
field with signed distance = p.y - planeY.

在文件 FluidSdf.cpp 第 149 行定义.

引用了 cellSize, dims, distances, halfExtent, index(), origin, p, voxelCount(), x, y , 以及 z.

◆ makeSphere()

MeshSdf eve::fluids::MeshSdf::makeSphere ( const glm::vec3 &  center,
float  radius,
const glm::ivec3 &  dims 
)
static

Bake an analytic sphere into the field.

参数
centersphere center.
radiussphere radius.
dimsvoxel resolution.
返回
field spanning dims * cellSize = 2*(radius + margin) cube.

在文件 FluidSdf.cpp 第 130 行定义.

引用了 cellSize, center, dims, distances, index(), margin, origin, p, radius, voxelCount(), x, y , 以及 z.

被这些函数引用 eve::fluids::exposeVolumeFluidFactory() , 以及 eve::fluids::FluidSimulator::setSdfSphere().

◆ sample()

float eve::fluids::MeshSdf::sample ( const glm::vec3 &  p) const

Trilinearly interpolated signed distance at p.

参数
pworld position.
返回
distance, extended by Euclidean distance beyond the field boundary.

在文件 FluidSdf.cpp 第 95 行定义.

引用了 eve::fluids::MeshSdfSample::distance, p , 以及 sampleWithGradient().

被这些函数引用 eve::fluids::FluidSimulation::spawnDrop().

◆ sampleWithGradient()

MeshSdfSample eve::fluids::MeshSdf::sampleWithGradient ( const glm::vec3 &  p) const

Samples distance and analytic trilinear gradient from the same eight voxels.

参数
pworld position.
返回
distance and outward gradient at p.

在文件 FluidSdf.cpp 第 97 行定义.

引用了 a, b, cellSize, dims, distance, distances, dx, dy, dz, f, i0, i1, index, maximum, origin, p, t, u , 以及 voxelCount().

被这些函数引用 gradient() , 以及 sample().

◆ voxelCount()

int eve::fluids::MeshSdf::voxelCount ( ) const

Voxel count.

返回
dims.x * dims.y * dims.z.

在文件 FluidSdf.cpp 第 87 行定义.

引用了 dims.

被这些函数引用 makePlane(), makeSphere(), sampleWithGradient(), eve::fluids::FluidSimulation::spawnDrop() , 以及 eve::fluids::FluidSimulation::step().

类成员变量说明

◆ cellSize

float eve::fluids::MeshSdf::cellSize = 1.f

World-space size of one voxel.

在文件 FluidSdf.h 第 33 行定义.

被这些函数引用 eve::fluids::SimGrid::make(), makePlane(), makeSphere() , 以及 sampleWithGradient().

◆ dims

glm::ivec3 eve::fluids::MeshSdf::dims {0}

Voxel resolution along each axis.

在文件 FluidSdf.h 第 35 行定义.

被这些函数引用 inBounds(), index(), eve::fluids::SimGrid::make(), makeFromTriangles(), makePlane(), makeSphere(), sampleWithGradient() , 以及 voxelCount().

◆ distances

std::vector<float> eve::fluids::MeshSdf::distances

Signed distances, dims.x * dims.y * dims.z floats.

在文件 FluidSdf.h 第 37 行定义.

被这些函数引用 makePlane(), makeSphere() , 以及 sampleWithGradient().

◆ origin

glm::vec3 eve::fluids::MeshSdf::origin {0.f}

World-space position of voxel (0,0,0).

在文件 FluidSdf.h 第 31 行定义.

被这些函数引用 eve::fluids::SimGrid::make(), makePlane(), makeSphere() , 以及 sampleWithGradient().


该类的文档由以下文件生成: