|
Core 1.0
|
A base three-dimensional voxel. More...
#include <array.h>
Public Member Functions | |
| Voxel (const Array &) | |
| Create the voxel structure. | |
| Voxel (const Box &, int) | |
| Create the voxel structure. | |
| Voxel (const Box &, int, int, int) | |
| Create the voxel structure. | |
| Voxel (const Box &, int, int, int, const QVector< int > &) | |
| Create and initialize the voxel structure. | |
| int | At (int, int, int) const |
| Return the data in the cell of the voxel. | |
| int | At (int) const |
| Return the data in the cell of the voxel. | |
| int | AtExtended (int, int, int) const |
| Return the data in the cell of the voxel. | |
| int & | operator() (int, int, int) |
| Return the data in the cell of the voxel. | |
| int & | operator() (int) |
| Return the data in the cell of the voxel. | |
| int & | operator[] (int) |
| Return the data in the cell of the voxel. | |
| bool | Inside (const Vector &) const |
| Check if a point is inside a non-empty cell. | |
| bool | Inside (int, int, int) const |
| Test if a cell is inside or outside of the voxel. | |
| bool | IsVertex (int, int, int) const |
| Check if a vertex is a corner of the surface of voxel. | |
| double | Signed (const Vector &) const |
| Compute the approximate signed distance to the voxel. | |
| int | OctantCells (const Vector &, int[24], int &, Vector &) const |
| Compute the integer coordinates of the (at most) eight octant cells closest to p. | |
| QVector< Vector > | GetCubes (Box &, bool=false) const |
| Create a set of cubes representing a voxel. | |
| int | Accessibility (int, int, int) const |
| Compute the integer accessibility of a voxel. | |
| unsigned int | Memory () const |
| Compute the amount of memory used by the voxel structure. | |
| void | FillCube (int, int, int, int, int) |
| Fill the voxel with a cube. | |
| Public Member Functions inherited from Array | |
| Array () | |
| Empty. | |
| Array (const Box &, int, int, int) | |
| Create the array structure. | |
| Array (const Box &, int) | |
| Create the array structure. | |
| ~Array () | |
| Empty. | |
| Array | Extract (int, int, int, int, int, int) const |
| Extract an sub-array. | |
| int | VertexSize () const |
| Return the size of the array. | |
| int | VertexSize (int) const |
| Get the size of the array for every axis. | |
| Box | Cell (int) const |
| Return the geometry of the cell. | |
| Box | Cell (int, int, int) const |
| Return the geometry of the cell. | |
| Vector | CellCenter (int, int, int) const |
| Return the center of the cell. | |
| void | Scale (const Vector &) |
| Scales the array structure. | |
| void | Scale (const double &) |
| Scales the array structure. | |
| Box | GetBox () const |
| Get the box of the array. | |
| Vector | CellDiagonal () const |
| Return the cell diagonal. | |
| double | CellVolume () const |
| Return the volume of a cell. | |
| Vector | Vertex (int, int, int) const |
| Compute the coordinates of a point on the lattice. | |
| int | GetSizeX () const |
| Get the size of the array for x axis. | |
| int | GetSizeY () const |
| Get the size of the array for y axis. | |
| int | GetSizeZ () const |
| Get the size of the array for z axis. | |
| int | CellSize () const |
| Return the size of the voxel. | |
| int | CellSizeX () const |
| Get the size of the voxel for x axis. | |
| int | CellSizeY () const |
| Get the size of the voxel for y axis. | |
| int | CellSizeZ () const |
| Get the size of the voxel for z axis. | |
| bool | IsEmpty () const |
| Detect if the array is empty. | |
| Box | UnitCell () const |
| Return the geometry of a generic cell. | |
| void | Resize (const Box &, int, int, int) |
| Resize the voxel with the given parameters. | |
| void | VertexInteger (const Vector &, int &, int &, int &) const |
| Compute the coordinates of a vertex inside a cell. | |
| void | VertexIntegerVolume (const Box &, int &, int &, int &, int &, int &, int &) const |
| Compute the integer coordinates of the vertices of a box embedding an input box. | |
| void | CellInteger (const Vector &, int &, int &, int &) const |
| Compute the coordinates of a vertex inside a cell. | |
| void | CellInteger (const Vector &, int &, int &, int &, double &, double &, double &) const |
| Compute the point on the lattice given an input point. | |
| void | CellIntegerVolume (const Box &, int &, int &, int &, int &, int &, int &) const |
| Compute the integer coordinates of the cells of the array embedding an input box. | |
| void | OutStream (QDataStream &) const |
| Write data to a data stream. | |
| void | InStream (QDataStream &) |
| Read data to a data stream. | |
| int | Memory () const |
| Compute the size of the array. | |
| constexpr int | VertexIndex (int, int, int) const |
| Compute the index of a given vertex. | |
| constexpr bool | InsideVertexIndex (int, int, int) const |
| Check if the indexes are within range. | |
| constexpr bool | InsideCellIndex (int, int, int) const |
| Check if the indexes are within range. | |
| void | InverseVertexIndex (int, int &, int &, int &) const |
| Compute the coordinates of a given vertex. | |
| constexpr int | CellIndex (int, int, int) const |
| Compute the index of a given cell. | |
| void | InverseCellIndex (int, int &, int &, int &) const |
| Compute the coordinates of a given cell. | |
Static Public Member Functions | |
| static double | OctantSigned (const Vector &, const Vector &, int) |
| Computes the distance between a point a eight octant volumes. | |
| Static Public Member Functions inherited from Array | |
| static Array | CubicCells (Box, int) |
| Create an array with enforced cubic cells. | |
Protected Attributes | |
| QVector< int > | voxel |
| Array of integer storing the data. | |
| Protected Attributes inherited from Array | |
| int | nz |
| Sizes. | |
| Vector | celldiagonal |
| Cell diagonal. | |
| Vector | inversecelldiagonal |
| Inverse cell diagonal. | |
| Protected Attributes inherited from Box | |
| Vector | b = Vector(1.0) |
| Lower and upper vertexex. | |
Static Protected Attributes | |
| static const int | octantcellindex [8][24] |
| Static Protected Attributes inherited from Box | |
| static constexpr const double | epsilon = 1.0e-5 |
| Epsilon value used to check intersections and some round off errors and for ray intersection tests. | |
| static const Box | Infinity |
| Largest box. | |
| static const Box | Null |
| Null box, equivalent to: | |
| static const Box | Unit |
| Unit box. | |
| static const int | edge [24] |
| Edge vertex indexes. | |
| static const Vector | normal [6] |
| Face normals. | |
Friends | |
| std::ostream & | operator<< (std::ostream &s, const Voxel &voxel) |
| Overloaded. | |
Additional Inherited Members | |
| Protected Member Functions inherited from Box | |
| Box () | |
| Empty. | |
| Box (const double &) | |
| Create a cube centered at the origin and of given half side length. | |
| Box (const Vector &) | |
| Create an empty box given one vertex. | |
| Box (const Vector &, const Vector &) | |
| Create a box given two opposite corners. | |
| Box (const Vector &, const double &) | |
| Create a box given a center point and the half side length. | |
| Box (const Vector &, const double &, const double &, const double &) | |
| Create a box given a center point and its width, length, and height. | |
| Box (const double &, const double &, const double &) | |
| Create a box given its sizes. | |
| Box (const Vector *, int) | |
| Creates the bounding box of a set of points. | |
| Box (const QVector< Vector > &) | |
| Creates the bounding box of a set of points. | |
| Box (const Box &, const Box &) | |
| Create a box embedding two boxes. | |
| Box (const Box &, const Frame &) | |
| Creates an axis aligned bounding box from a box and a frame. | |
| Box (const Box &, const FrameScaled &) | |
| Creates an axis aligned bounding box from a box and a frame. | |
| Box (const Box &, const Matrix &) | |
| Creates an axis aligned bounding box from a box and a transformation matrix. | |
| ~Box () | |
| Empty. | |
| Vector & | operator[] (int) |
| Returns either end vertex of the box. | |
| Vector | operator[] (int) const |
| Overloaded. | |
| Vector | Center () const |
| Returns the center of the box. | |
| Vector | Vertex (int) const |
| Returns the k-th vertex of the box. | |
| Segment | Edge (int) const |
| Compute the k-th edge segment of the box. | |
| Plane | Face (int) const |
| Compute the k-th plane of the box. | |
| Vector | Size () const |
| Compute the size (width, length and height) of a box. | |
| Vector | Diagonal () const |
| Returns the diagonal of the box. | |
| double | Radius () const |
| Returns the radius of the box, i.e. the length of the half diagonal of the box. | |
| double | R (const Vector &) const |
| Computes the squared Euclidean distance between the box and a point. | |
| double | Signed (const Vector &) const |
| Computes the signed distance between the box and a point. | |
| Vector | Normal (const Vector &) const |
| Computes the normal vector between a point and a box. | |
| double | R (const Box &) const |
| Compute the squared Euclidean distance between two boxes. | |
| double | RInfinity (const Box &) const |
| Compute the maximum distance between two boxes. | |
| int | Intersect (const Ray &) const |
| Check the intersection between a box and a ray. | |
| int | Intersect (const Ray &, double &, double &) const |
| Computes the intersection between a box and a ray. | |
| int | Intersect (const Ray &, double &) const |
| Compute the first positive intersection between the box and a ray. | |
| int | Intersect (const Ray &, double &, double &, Vector &, Vector &) const |
| Compute the intersection between an axis aligned box and a ray. | |
| int | Intersect (const Ray &, double &, Vector &) const |
| Compute the first positive intersection between the box and a ray. | |
| bool | Intersect (const Vector &, const Vector &) const |
| Check if a segment intersects an axis aligned box. | |
| bool | Intersect (const Box &) const |
| Check if the box intersects another box. | |
| bool | Inside (const Box &) const |
| Check if an argument box is inside the box. | |
| bool | Inside (const Vector &) const |
| Check if a point is inside the box. | |
| Box | Intersection (const Box &) const |
| Computes the intersection between two boxes. | |
| int | Difference (const Box &, Box *) const |
| Computes the difference between two boxes. | |
| bool | Empty () const |
| Check if a box is empty. | |
| double | Volume () const |
| Compute the volume of a box. | |
| double | Area () const |
| Compute the surface area of a box. | |
| Box | InscribedCube () const |
| Creates the biggest cube iscribed in the box. | |
| Box | Cube () const |
| Return the tightest embedding cube from an arbitrarilly shaped box. | |
| void | Extend (const double &) |
| Extend the limits of the box by a given distance. | |
| Box | Extended (const double &) const |
| Extend the limits of the box by a given distance. | |
| void | Extend (const Vector &) |
| Extend the limits of the box given a point. | |
| Box | Extended (const Vector &) const |
| Extend the limits of the box by a given vector range. | |
| void | SetParallelepipedic (const double &, int &, int &, int &) |
| Creates a parallelepipedic box whose dimensions are integer multiples of a given input reference size. | |
| void | SetParallelepipedic (int, int &, int &, int &) |
| Inflates a box so that its dimensions should be a fraction of its maximum side length. | |
| Box | Sub (int) const |
| Computes the sub-box in the n-th octant. | |
| int | Octant (const Vector &) const |
| Compute the octant index of a vertex with respect to the box center. | |
| void | Translate (const Vector &) |
| Translates a box. | |
| Box | Translated (const Vector &) const |
| Translated box. | |
| void | Scale (const double &) |
| Scales a box. | |
| void | Scale (const Vector &) |
| Scales a box. | |
| Box | Scaled (const Vector &) const |
| Scales a box and return the scaled box. | |
| Box | Offsetted (const Vector &) const |
| Offets a box. | |
| Box | Centered () const |
| Compute the box translated to origin. | |
| Box | Cut (const Vector &, const Vector &) const |
| Compute the minimal box embedding the box cut by half space. | |
| int | IntegerAxis () const |
| Compute the axis which has the greater length. | |
| Vector | RandomInside (Random &=Random::R239) const |
| Generate a random vector inside the box. | |
| Vector | RandomSurface (Random &=Random::R239) const |
| Generate a random vector on the surface of the box. | |
| QVector< Vector > | Poisson (const double &, int, Random &=Random::R239) const |
| Compute a Poisson sphere distribution inside a box. | |
A base three-dimensional voxel.
|
explicit |
Create the voxel structure.
| a | The array. |
|
explicit |
Create the voxel structure.
| box | The cubic box. |
| n | Discretization. |
|
explicit |
Create the voxel structure.
| box | The box. |
| x,y,z | Discretization, i.e. number of cells. |
|
explicit |
Create and initialize the voxel structure.
| box | The box. |
| x,y,z | Size of the array, i.e. number of cells. |
| v | Voxel data. |
| int Voxel::Accessibility | ( | int | x, |
| int | y, | ||
| int | z ) const |
Compute the integer accessibility of a voxel.
Uses a 1-neighborhood, thus checking \( 3^3 -1=26 \) cells.
| x,y,z | Integer coordinates of the cell. |
|
inline |
Return the data in the cell of the voxel.
| c | Cell index. |
|
inline |
Return the data in the cell of the voxel.
| i,j,k | Integer coordinates of the cell. |
|
inline |
Return the data in the cell of the voxel.
This function handles queries outside of the voxel. If the coordinates are outside, function returns 0.
| i,j,k | Integer coordinates of the cell. |
| void Voxel::FillCube | ( | int | x, |
| int | y, | ||
| int | z, | ||
| int | s, | ||
| int | c ) |
Fill the voxel with a cube.
| x,y,z | Lower coordinates. |
| s | Size. |
| c | Cell values. |
Create a set of cubes representing a voxel.
| u | Unit reference box of the voxel. |
| surface | Only produce cubes that participate to the visible surface. |
| bool Voxel::Inside | ( | const Vector & | p | ) | const |
Check if a point is inside a non-empty cell.
Note that if the point is not inside the box, then it is defined as outside.
| p | Point. |
| bool Voxel::Inside | ( | int | x, |
| int | y, | ||
| int | z ) const |
Test if a cell is inside or outside of the voxel.
This function handles queries outside of the voxel. If the coordinates are outside, function returns false.
| x,y,z | Integer coordinates of the cell. |
| bool Voxel::IsVertex | ( | int | x, |
| int | y, | ||
| int | z ) const |
Check if a vertex is a corner of the surface of voxel.
This function handles queries outside of the voxel. If the coordinates are outside, function returns false.
| x,y,z | Integer coordinates of the cell. |
Compute the integer coordinates of the (at most) eight octant cells closest to p.
| p | Point. |
| cells | Returned array of integer coordinates. |
| configuration | Returned configuration, as expected by OctantSigned(): the bit 7 is set if the cell of p is not empty, the bit 0 is the cell opposite to the cell of p with respect to q, see OctantSigned(). |
| q | Returned center of the octant that can be used for computing the distance. |
Computes the distance between a point a eight octant volumes.
The octant configuration is provided as an integer whose bits are set to 0 if octants are empty, 1 otherwise.
The bits refer to the octants in the frame obtained by symmetries of the axes so that p is located in the positive octant of q. The bit k of the configuration is the octant whose position with respect to q is positive along the x, y and z axes if the bits 0, 1 and 2 of k are set, respectively. Therefore the bit 7 is the octant that contains p, and the bit 0 is the opposite octant, which has only the vertex q in common with it. Seen from p, the distance to the octant of the bit 0 is the distance to q, the distance to the octants with one positive axis (bits 1, 2, 4) is the distance to an edge (an axis through q), and the distance to the octants with two positive axes (bits 3, 5, 6) is the distance to a plane through q. This is the configuration returned by OctantCells().
The distance is negative if the octant of p (bit 7) is not empty, and its absolute value is the distance to the closest empty octant. Otherwise, it is the distance to the closest non empty octant.
| p | Point. |
| q | Origin of the eight octant volumes. |
| c | Octant configuration. |
|
inline |
Return the data in the cell of the voxel.
| c | Cell index. |
|
inline |
Return the data in the cell of the voxel.
| i,j,k | Integer coordinates of the cell. |
|
inline |
Return the data in the cell of the voxel.
| c | Integer cell index. |
| double Voxel::Signed | ( | const Vector & | p | ) | const |
Compute the approximate signed distance to the voxel.
| p | Point. |
|
friend |
Overloaded.
| s | Stream. |
| voxel | The voxel. |
|
staticprotected |
< Set of eight cells, sorted.