hanwenzhao / DensityMap

A class representing a 3D array of densities

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DensityMap

DensityMap is a class that stores a 3D array of floats between 0 and 1 and allows them to be displayed using OpenGL.

Functions

DensityMap(int dim)
Initializes the DensityMap with a cubic array of side length dim.

void addLine(glm::vec3 p1, glm::vec3 p2, std::vector<float> vals)
Adds a line of data to the array along the line segment defined by p1 and p2. The more values there are in vals, the smoother the line will be.

void addLineSmoothed(glm::vec3 p1, glm::vec3 p2, std::vector<float> vals, int radius = 5)
Adds a line of data to the array along the line segment defined by p1 and p2. The more values there are in vals, the smoother the line will be. The area around the line is blurred. This area will be larger when radius is increased.

This function is not recommended when using a lot of data, because it blurs the area around the line. (like with ultrasound data !!!)

void clear()
Fills the whole array with zeroes.

std::vector<float> getVertices()
Returns a vector of vertices used to render the density map using OpenGL.

The image is in the images folder

About

A class representing a 3D array of densities


Languages

Language:C++ 98.7%Language:GLSL 1.3%