MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ cartesian()

UVField MayaFlux::Kinesis::cartesian ( const glm::vec3 &  axis = glm::vec3(0.0F, 0.0F, 1.0F),
const glm::vec3 &  origin = glm::vec3(0.0F),
float  scale = 1.0F 
)
inline

cartesian projection along a chosen axis

Parameters
axisNormal of the projection plane (normalised by caller)
originWorld-space origin of the UV tile
scaleUV scale: larger values tile more tightly
Returns
UVField: glm::vec3 -> glm::vec2

Projects each position onto the plane perpendicular to axis and returns the two remaining components as (u, v). The active axes are chosen to avoid the dominant axis so the result is never degenerate.

Axis selection: |axis.y| <= |axis.x| and |axis.y| <= |axis.z| -> tangent = world Y otherwise -> tangent = world X The bitangent is cross(axis, tangent), giving an orthonormal frame.

Definition at line 23 of file UVProjection.hpp.

27{
28 const glm::vec3 n = glm::normalize(axis);
29
30 const glm::vec3 tangent = (std::abs(n.y) <= std::abs(n.x) && std::abs(n.y) <= std::abs(n.z))
31 ? glm::normalize(glm::cross(n, glm::vec3(0.0F, 1.0F, 0.0F)))
32 : glm::normalize(glm::cross(n, glm::vec3(1.0F, 0.0F, 0.0F)));
33
34 const glm::vec3 bitangent = glm::cross(n, tangent);
35
36 return { .fn = [tangent, bitangent, origin, scale](const glm::vec3& p) -> glm::vec2 {
37 const glm::vec3 d = p - origin;
38 return glm::vec2(glm::dot(d, tangent), glm::dot(d, bitangent)) * scale;
39 } };
40}
uint32_t tangent
Tendency< D, float > scale(const Tendency< D, float > &t, float factor)
Uniform scaling of a scalar-output tendency.
Definition Tendency.hpp:98

References scale(), and tangent.

+ Here is the call graph for this function: