Beispiel #1
0
// Set the voxel dimension (single value)
void Vol2mesh :: set_voxel(int i, double vox){
	
	// Update the storage vector
	voxels_.at(i) = vox;
	
    // Update the image
    set_voxel(voxels_);
}
Beispiel #2
0
// Set the voxel dimension using overall image dimension (single value)
void Vol2mesh :: set_dimension(int i, double dim){
	
	// Extract the number of pixels in the image
	vector<int> pix = pixels();
	
	// Update the image with computed voxel size
	set_voxel(i, dim / pix[i]);
}
Beispiel #3
0
void BrainsComponent::plan_step_create_ramp(const Vec3i& dst) {
    auto ent = get_parent()->as_entity();
    auto my_pos = ent->get_pos();

    // Mining rules: Can reach on same depth, or can reach 1 block down
    if (close_enough(my_pos, dst, MovePrecision::AdjacentDepth)) {
        auto w = AnimateObject::get_world();
        auto vox = w->get_voxel(dst);
        vox.set_ramp(true);
        w->set_voxel(dst, vox);
        w->force_update_terrain_mesh_ = true;
    }
    // Finish step even if mining failed
    finish_plan_step();
}
Beispiel #4
0
// Set the voxel dimensions using a vector of the overall image dimensions
void Vol2mesh :: set_dimension(vector<double> dim){
	
	// Define storage location for calculated voxel size
	vector<double> vox;	
	
	// Extract the number of pixels in the image
	vector<int> pix = pixels();
	
	// Computed voxel size
	for (int i = 0; i < 3; i++){
		vox.push_back(dim[i] / pix[i]);
	}
	
	// Update the image
	set_voxel(vox);
}