scifir-units 2.0.0
scifir-units is a library of units of measurement, angles, coordinates, fields, and related data, all lightweight, that help in the development of scientific software and scientific machines
|
Class that allows to store and calculate size in 3D, with width, height and depth. The template parameter T allows to select any scalar_unit or numeric type to be the type of the width, the height and the depth (they always have the same type in the same instance). The width, height and depth can be any scalar_unit, usually length, but imaginary spaces with custom dimensions are also allowed. Initialization string example: "1 m * 2 m * 4 m". More...
#include <size_3d.hpp>
Public Member Functions | |
size_3d () | |
Default constructor. Both width, height and depth are initialized to 0, with the dimensions to the default of their base unit. | |
size_3d (const size_3d< T > &x) | |
Copy constructor. The width, height and depth are copied from the size_3d<T> x. | |
size_3d (size_3d< T > &&x) | |
Move constructor. The width, height and depth are moved from the size_3d<T> x. | |
size_3d (const scalar_unit &new_width, const scalar_unit &new_height, const scalar_unit &new_depth) | |
size_3d (const string &new_width, const string &new_height, const string &new_depth) | |
Constructor. width is new_width, height is new_height and depth is new_depth, they are initialized by string. | |
size_3d (const string &init_size_3d) | |
Constructor. The member-variables are initialized by the initialization string init_size_3d. | |
size_3d< T > & | operator= (const size_3d< T > &x) |
Copy assignment. The width, height and depth are copied from the size_3d<T> x. | |
size_3d< T > & | operator= (size_3d< T > &&x) |
Move assignment. The width, height and depth are moved from the size_3d<T> x. | |
size_3d< T > & | operator= (const string &init_size_3d) |
Assignment. The member-variables are initialized by the initialization string init_size_3d. | |
template<typename U > | |
size_3d< T > | operator+ (const size_3d< U > &x) const |
Creates a new size_3d<T> by the addition of two size_3d<T> classes. The width, height and depth are the result of the addition of the two width, height or depth of the size_3d<T> classes. | |
template<typename U > | |
size_3d< T > | operator- (const size_3d< U > &x) const |
Creates a new size_3d<T> by the difference of two size_3d<T> classes. The width, height and depth are the result of the difference of the two width, height or depth of the size_3d<T> classes. | |
template<typename U > | |
void | operator+= (const size_3d< U > &x) |
Sums the width of size_3d<T> x to the width, sums the height of size_3d<T> x to the height and sums the depth of size_3d<T> x to the depth. | |
template<typename U > | |
void | operator-= (const size_3d< U > &x) |
Substracts the width of size_3d<T> x to the width, substracts the height of size_3d<T> x to the height and substracts the depth of size_3d<T> x to the depth. | |
scalar_unit | get_volume () const |
Calculates the volume as the multiplication of the width, height and depth. | |
string | display () const |
Returns a string representation of size_3d<T>, with his width, height and depth. | |
Public Attributes | |
T | width |
Width, usually stored as length. | |
T | height |
Height, usually stored as length. | |
T | depth |
Depth, usually stored as length. | |
Private Member Functions | |
void | initialize_from_string (const string &init_size_3d) |
Internal function. Initializes the member-variables with an initialization string of size_3d<T>. | |
Class that allows to store and calculate size in 3D, with width, height and depth. The template parameter T allows to select any scalar_unit or numeric type to be the type of the width, the height and the depth (they always have the same type in the same instance). The width, height and depth can be any scalar_unit, usually length, but imaginary spaces with custom dimensions are also allowed. Initialization string example: "1 m * 2 m * 4 m".
Definition at line 16 of file size_3d.hpp.
Default constructor. Both width, height and depth are initialized to 0, with the dimensions to the default of their base unit.
Definition at line 19 of file size_3d.hpp.
Copy constructor. The width, height and depth are copied from the size_3d<T> x.
Definition at line 22 of file size_3d.hpp.
Move constructor. The width, height and depth are moved from the size_3d<T> x.
Definition at line 25 of file size_3d.hpp.
|
inlineexplicit |
Definition at line 28 of file size_3d.hpp.
|
inlineexplicit |
Constructor. width is new_width, height is new_height and depth is new_depth, they are initialized by string.
Definition at line 31 of file size_3d.hpp.
Constructor. The member-variables are initialized by the initialization string init_size_3d.
Definition at line 34 of file size_3d.hpp.
Returns a string representation of size_3d<T>, with his width, height and depth.
Definition at line 94 of file size_3d.hpp.
|
inline |
Calculates the volume as the multiplication of the width, height and depth.
Definition at line 89 of file size_3d.hpp.
Internal function. Initializes the member-variables with an initialization string of size_3d<T>.
Definition at line 106 of file size_3d.hpp.
Creates a new size_3d<T> by the addition of two size_3d<T> classes. The width, height and depth are the result of the addition of the two width, height or depth of the size_3d<T> classes.
Definition at line 62 of file size_3d.hpp.
Sums the width of size_3d<T> x to the width, sums the height of size_3d<T> x to the height and sums the depth of size_3d<T> x to the depth.
Definition at line 74 of file size_3d.hpp.
Creates a new size_3d<T> by the difference of two size_3d<T> classes. The width, height and depth are the result of the difference of the two width, height or depth of the size_3d<T> classes.
Definition at line 68 of file size_3d.hpp.
Substracts the width of size_3d<T> x to the width, substracts the height of size_3d<T> x to the height and substracts the depth of size_3d<T> x to the depth.
Definition at line 82 of file size_3d.hpp.
Copy assignment. The width, height and depth are copied from the size_3d<T> x.
Definition at line 39 of file size_3d.hpp.
Assignment. The member-variables are initialized by the initialization string init_size_3d.
Definition at line 55 of file size_3d.hpp.
Move assignment. The width, height and depth are moved from the size_3d<T> x.
Definition at line 47 of file size_3d.hpp.
Depth, usually stored as length.
Definition at line 103 of file size_3d.hpp.
Height, usually stored as length.
Definition at line 102 of file size_3d.hpp.
Width, usually stored as length.
Definition at line 101 of file size_3d.hpp.