|
|
auto | size () const -> std::size_t |
| Return the number of UV elements.
|
|
auto | empty () const -> bool |
| Return whether the UVMap is empty.
|
|
|
void | setOrigin (const Origin &o) |
| Set the origin of the UVMap. More...
|
|
auto | origin () const -> Origin |
| Get the current origin of the UVMap.
|
|
|
void | set (std::size_t id, const cv::Vec2d &uv, const Origin &o) |
| Set the UV value for a point by ID. More...
|
|
void | set (std::size_t id, const cv::Vec2d &uv) |
| Set the UV value for a point by ID. More...
|
|
auto | get (std::size_t id, const Origin &o) const -> cv::Vec2d |
| Get the UV value for a point by ID. More...
|
|
auto | get (std::size_t id) const -> cv::Vec2d |
| Get the UV value for a point by ID. More...
|
|
auto | contains (std::size_t id) const -> bool |
| Check if the vertex index has a UV mapping.
|
|
auto | as_map () const -> std::map< std::size_t, cv::Vec2d > |
|
|
auto | ratio () const -> Ratio |
| Get the size information (aspect ratio, width, height)
|
|
void | ratio (double a) |
| Set the aspect ratio.
|
|
void | ratio (double w, double h) |
| Set the aspect ration by width and height parameters.
|
|
|
std::map< std::size_t, cv::Vec2d > | map_ |
|
Origin | origin_ {Origin::TopLeft} |
|
Ratio | ratio_ |
|
enum class | Rotation { CW90 = 0
, CW180
, CCW90
} |
|
enum class | FlipAxis { Vertical = 0
, Horizontal
, Both
} |
|
enum class | AlignmentAxis {
None = 0
, ZPos
, ZNeg
, YPos
,
YNeg
, XPos
, XNeg
} |
|
static auto | Plot (const UVMap &uv, const Color &color=color::GREEN) -> cv::Mat |
| Plot the UV points on an image. More...
|
|
static auto | Plot (const UVMap &uv, const ITKMesh::Pointer &mesh2D, int width=-1, int height=-1, const Color &color=color::LIGHT_GRAY) -> cv::Mat |
| Plot the UV mesh on an image. More...
|
|
static void | AlignToAxis (UVMap &uv, const ITKMesh::Pointer &mesh, AlignmentAxis axis) |
| Rotate a UVMap to align a specified volume axis to the -V direction of UV space. More...
|
|
static void | Rotate (UVMap &uv, Rotation rotation) |
| Rotate a UVMap by a multiple of 90 degrees.
|
|
static void | Rotate (UVMap &uv, Rotation rotation, cv::Mat &texture) |
| Rotate a UVMap by a multiple of 90 degrees. More...
|
|
static void | Rotate (UVMap &uv, double theta, const cv::Vec2d ¢er={0.5, 0.5}) |
| Rotate a UVMap by a specified angle. More...
|
|
static void | Rotate (UVMap &uv, double theta, cv::Mat &texture, const cv::Vec2d ¢er={0.5, 0.5}) |
| Rotate a UVMap by a specified angle. More...
|
|
static void | Flip (UVMap &uv, FlipAxis axis) |
| Flip a UVMap across one or both of its axes.
|
|
| UVMap ()=default |
| Default constructor.
|
|
| UVMap (Origin o) |
| Construct and set origin.
|
|
template<typename... Args> |
static auto | New (Args... args) -> Pointer |
|
Stores per-vertex UV mappings.
- Author
- Seth Parker
- Date
- 10/20/15
A UV map stores the position of a vertex in 2D parameter space (often texture space). UV values are typically stored as floating point values in the range [0,1]
.
UV positions are assumed to be relative to an origin at one of the corners of parameter space: the top-left (0,0)
, top-right (1,0)
, bottom-left (0,1)
, or bottom-right (1,1)
. Internally, all mappings are stored relative to a storage origin. The set() functions transform UV values from the provided origin space to the storage origin space. Similarly, the get() functions transform UV values from the storage origin space to the provided origin space. This allows the class to provide on-the-fly conversion between different origin positions. By setting the origin prior to insertion and again prior to retrieval, mappings can be inserted relative to one origin but retrieved relative to another. When using the overloaded set(std::size_t, const cv::Vec2d&) and get(size_t) functions, the source and target origins are set using the constructor or setOrigin().
Since UV maps store relative position information, they are agnostic to size of the texture space to which they apply. The ratio functions provide a way to store the dimensions and aspect ratio of the texture space for later PerPixelMap and Texture generation.
Definition at line 51 of file UVMap.hpp.
static void volcart::UVMap::AlignToAxis |
( |
UVMap & |
uv, |
|
|
const ITKMesh::Pointer & |
mesh, |
|
|
AlignmentAxis |
axis |
|
) |
| |
|
static |
Rotate a UVMap to align a specified volume axis to the -V direction of UV space.
We want to rotate the virtually unwrapped image so that the bottom of the content page is at the bottom of the virtually unwrapped image (
) and the top of the page is at the top of the image (
). As a consequence, this function aligns the given 3D axis to the -V direction of UV space rather than the +V direction.
Usually, we want the alignment axis to be the volume's +Z axis. It is a convention in CT data for the +Z axis to travel the length of the sample, from the bottom to the top. Without a priori knowledge, we assume that the bottom of the sample corresponds to the bottom of the content page, thus the +Z axis should align to the -V direction of UV space.
- Parameters
-
uv | The UVMap to be rotated. |
mesh | Original 3D mesh for the given UVMap. Used as reference for the vertices' 3D positions. |
axis | Volume axis to align to the -V axis. |