OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::anonymous_namespace{TextureDisplacement.cpp}::UVTransform Struct Reference

Public Member Functions

 UVTransform (const TextureDisplacementLayer &layer, float aspect_, bool normalized_uv=false)
Vec2f operator() (const Vec2f &planar) const

Public Attributes

float scale
float cs
float sn
float aspect
Vec2f offset

Detailed Description

Constructor & Destructor Documentation

◆ UVTransform()

Slic3r::anonymous_namespace{TextureDisplacement.cpp}::UVTransform::UVTransform ( const TextureDisplacementLayer & layer,
float aspect_,
bool normalized_uv = false )
inline
2176 {
2177 scale = (normalized_uv || layer.tiling_scale <= 1e-6f) ? 1.f : (1.f / layer.tiling_scale);
2178 const float rad = layer.rotation_deg * float(M_PI) / 180.f;
2179 cs = std::cos(rad);
2180 sn = std::sin(rad);
2181 aspect = normalized_uv ? 1.f : aspect_;
2182 offset = layer.offset;
2183 }
#define M_PI
Definition ExtrusionSimulator.cpp:31
double rad(double deg)
Definition DesignSketchTool.cpp:7748
float sn
Definition TextureDisplacement.cpp:2169
Vec2f offset
Definition TextureDisplacement.cpp:2170
float aspect
Definition TextureDisplacement.cpp:2169
float scale
Definition TextureDisplacement.cpp:2169
float cs
Definition TextureDisplacement.cpp:2169

References aspect, cs, M_PI, offset, Slic3r::TextureDisplacementLayer::offset, Slic3r::TextureDisplacementLayer::rotation_deg, scale, sn, and Slic3r::TextureDisplacementLayer::tiling_scale.

Member Function Documentation

◆ operator()()

Vec2f Slic3r::anonymous_namespace{TextureDisplacement.cpp}::UVTransform::operator() ( const Vec2f & planar) const
inline
2185 {
2186 const Vec2f scaled = planar * scale;
2187 Vec2f rotated(scaled.x() * cs - scaled.y() * sn, scaled.x() * sn + scaled.y() * cs);
2188 // See apply_uv_transform() for why the aspect correction follows the rotation.
2189 if (aspect > 0.f && aspect != 1.f)
2190 rotated.y() *= aspect;
2191 return rotated + offset;
2192 }
BoundingBox scaled(const BoundingBoxf &bb)
Definition BoundingBox.hpp:284
Eigen::Matrix< float, 2, 1, Eigen::DontAlign > Vec2f
Definition Point.hpp:64

References aspect, cs, offset, scale, Slic3r::scaled(), and sn.

Here is the call graph for this function:

Member Data Documentation

◆ aspect

float Slic3r::anonymous_namespace{TextureDisplacement.cpp}::UVTransform::aspect

Referenced by UVTransform(), and operator()().

◆ cs

float Slic3r::anonymous_namespace{TextureDisplacement.cpp}::UVTransform::cs

Referenced by UVTransform(), and operator()().

◆ offset

Vec2f Slic3r::anonymous_namespace{TextureDisplacement.cpp}::UVTransform::offset

Referenced by UVTransform(), and operator()().

◆ scale

float Slic3r::anonymous_namespace{TextureDisplacement.cpp}::UVTransform::scale

Referenced by UVTransform(), and operator()().

◆ sn

float Slic3r::anonymous_namespace{TextureDisplacement.cpp}::UVTransform::sn

Referenced by UVTransform(), and operator()().


The documentation for this struct was generated from the following file: