Documentation ¶
Overview ¶
Package vshell provides functions for reading and writing .vsh files.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NeighborBitMap ¶
type NeighborBitMap uint32
NeighborBitMap represents the neighbors of a voxel and can be used to calculate the normal of the voxel.
const ( X_1Y_1Z_1 NeighborBitMap = 1 << iota X_1Y_1Z0 X_1Y_1Z1 X_1Y0Z_1 X_1Y0Z0 X_1Y0Z1 X_1Y1Z_1 X_1Y1Z0 X_1Y1Z1 X0Y_1Z_1 X0Y_1Z0 X0Y_1Z1 X0Y0Z_1 X0Y0Z1 X0Y1Z_1 X0Y1Z0 X0Y1Z1 X1Y_1Z_1 X1Y_1Z0 X1Y_1Z1 X1Y0Z_1 X1Y0Z0 X1Y0Z1 X1Y1Z_1 X1Y1Z0 X1Y1Z1 )
func (NeighborBitMap) String ¶
func (n NeighborBitMap) String() string
String returns an easy-to-read (bit possibly long) representation of NeighborBitMap.
type VShVoxel ¶
type VShVoxel struct {
X, Y, Z int
N NeighborBitMap
}
VShVoxel represents a VShell Voxel.
type VShell ¶
type VShell struct {
NX, NY, NZ int // number of voxels in each dimension
TX, TY, TZ float64 // translation (location of origin in world space)
Scale float64 // uniform scale in millimeters
Voxels []VShVoxel
}
VShell represents a voxel model (or subregion) in vshell format. Voxels have uniform dimensions in X, Y, and Z and can be thought of as 3D "pixels".
NX, NY, and NZ are the number of voxels in each dimension and must be positive (non-zero).
Scale represents the uniform scale of this subregion's largest dimension (in millimeters). So if "dim = max(NX,NY,NZ)", then there are dim/Scale voxels per millimeter in each direction.
Translating the subregion to (TX,TY,TZ) will correctly place this region in world space (in millimeters).
VShells differ from BinVOX as follows:
- BinVOX lists the presence of each voxel as a sparse matrix
- VShell lists only the voxels exposed on the outer shell of the model. That is, all "internal" voxels are elided. Along with each outer "shell" voxel, its NeighborBitMap is also retained.
func Read ¶
Read reads a vshell file and returns a VShell. sx, sy, sz are the starting indices for reading a model. nx, ny, nz are the number of voxels to read in each direction (0=all).
func (*VShell) VoxelsPerMM ¶
VoxelsPerMM returns the number of voxels per millimeter.