MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Kinesis Namespace Reference

Namespaces

namespace  detail
 
namespace  Discrete
 
namespace  ForceFields
 
namespace  Stochastic
 

Classes

struct  AABB2D
 Axis-aligned bounding rectangle in a 2D coordinate space. More...
 
struct  AABB3D
 Axis-aligned bounding box in 3D world space. More...
 
struct  BasisMatrices
 
struct  BoundingSphere
 Spherical fast-reject hint in world space. More...
 
struct  FlyKeyMap
 Key assignments for the Fly navigation preset. More...
 
struct  HitResult
 Entity id and perpendicular distance from the ray axis. More...
 
struct  InterpolatedEdge
 
struct  NavigationConfig
 Tuning parameters for a first-person fly-navigation controller. More...
 
struct  NavigationState
 Mutable first-person navigation state. More...
 
struct  OrbitConfig
 Construction parameters for an orbit navigation controller. More...
 
struct  OrbitKeyMap
 Key assignments for the Orbit navigation preset. More...
 
struct  OrbitState
 Mutable orbit navigation state. More...
 
struct  PanZoom2DConfig
 Construction parameters for a 2D pan/zoom orthographic controller. More...
 
struct  PanZoom2DKeyMap
 Input assignments for the PanZoom2D navigation preset. More...
 
struct  PanZoom2DState
 Mutable 2D pan/zoom navigation state. More...
 
struct  ProximityConfig
 
struct  QuadGeometry
 Textured quad vertex data together with its semantic layout descriptor. More...
 
struct  QueryResult
 Result entry from a spatial query, carrying entity id and squared distance. More...
 
struct  Ray
 Origin and normalized direction in world space. More...
 
struct  SamplerBounds
 Spatial domain for vertex generation. More...
 
struct  ScreenspaceKeyMap
 Input assignments for the Screenspace navigation preset. More...
 
class  SpatialIndex
 Lock-free spatial acceleration structure with atomic snapshot publication. More...
 
struct  SpatialSnapshot
 Immutable spatial snapshot published atomically for lock-free reads. More...
 
struct  Tendency
 Typed, composable, stateless callable from domain D to range R. More...
 
struct  ViewTransform
 View and projection matrices as a named push constant slot. More...
 

Concepts

concept  PositionCarrying
 Satisfied by any type exposing a position field convertible to glm::vec3.
 

Typedefs

using EdgeList = std::vector< std::pair< size_t, size_t > >
 
using ScalarField = Tendency< float, float >
 
using SpatialField = Tendency< glm::vec3, float >
 
using SpatialIndex3D = SpatialIndex< glm::vec3 >
 
using SpatialIndexND = SpatialIndex< Eigen::VectorXd >
 
using TemporalField = Tendency< float, float >
 
using UVField = Tendency< glm::vec3, glm::vec2 >
 
using VectorField = Tendency< glm::vec3, glm::vec3 >
 
using Vertex = Kakshya::Vertex
 

Enumerations

enum class  DistanceMetric : uint8_t { EUCLIDEAN , EUCLIDEAN_SQUARED , MANHATTAN , CHEBYSHEV }
 Distance computation strategy for spatial queries. More...
 
enum class  InterpolationMode : uint8_t {
  LINEAR , CATMULL_ROM , CUBIC_HERMITE , CUBIC_BEZIER ,
  QUADRATIC_BEZIER , BSPLINE , COSINE , CUSTOM
}
 Mathematical interpolation methods. More...
 
enum class  ProximityMode : uint8_t {
  K_NEAREST , RADIUS_THRESHOLD , MINIMUM_SPANNING_TREE , GABRIEL_GRAPH ,
  RELATIVE_NEIGHBORHOOD_GRAPH , SEQUENTIAL , NEAREST_NEIGHBOR , CUSTOM
}
 
enum class  SpatialDistribution : uint8_t {
  RANDOM_VOLUME , RANDOM_SURFACE , GRID , SPHERE_VOLUME ,
  SPHERE_SURFACE , UNIFORM_GRID , RANDOM_SPHERE , RANDOM_CUBE ,
  PERLIN_FIELD , BROWNIAN_PATH , STRATIFIED_CUBE , SPLINE_PATH ,
  LISSAJOUS , FIBONACCI_SPHERE , FIBONACCI_SPIRAL , TORUS ,
  EMPTY
}
 Spatial distribution mode for point cloud and particle generation. More...
 

Functions

template<PositionCarrying T>
AABB3D aabb (std::span< T > pts) noexcept
 Axis-aligned bounding box of a PositionCarrying span.
 
void advance_navigation (NavigationState &state)
 Advance eye position by held movement flags against elapsed time.
 
std::vector< Kakshya::Vertexapply_color_gradient (const std::vector< glm::vec3 > &positions, const std::vector< glm::vec3 > &colors, const std::vector< float > &color_positions={}, float scalar=1.0F)
 Apply color interpolation to position vertices.
 
void apply_mouse_delta (NavigationState &state, float dx, float dy)
 Apply a mouse delta to yaw and pitch.
 
void apply_orbit_pan (OrbitState &state, float dx, float dy)
 Pan the focal point in the camera's local right/up plane.
 
void apply_orbit_rotate (OrbitState &state, float dx, float dy)
 Apply a mouse delta to azimuth and elevation.
 
void apply_orbit_scroll (OrbitState &state, float ticks)
 Dolly the camera toward or away from the focal point.
 
void apply_pan_zoom_pan (PanZoom2DState &state, float dx, float dy, float viewport_width, float viewport_height)
 Pan by a pixel delta, scaled to world units by the current zoom level.
 
void apply_pan_zoom_scroll (PanZoom2DState &state, float ticks)
 Zoom by multiplying the half-height, clamped to [min_zoom, max_zoom].
 
void apply_rotation (std::vector< glm::vec3 > &vertices, const glm::vec3 &axis, float angle, const glm::vec3 &origin=glm::vec3(0))
 Apply rotation to vertex set around arbitrary axis.
 
void apply_scale (std::vector< glm::vec3 > &vertices, const glm::vec3 &scale, const glm::vec3 &origin=glm::vec3(0))
 Apply non-uniform scaling to vertex set.
 
void apply_scroll (NavigationState &state, float ticks)
 Dolly eye along the current forward vector.
 
void apply_transform (std::vector< glm::vec3 > &vertices, const glm::mat4 &transform)
 Apply rigid transformation to vertex set.
 
void apply_translation (std::vector< glm::vec3 > &vertices, const glm::vec3 &displacement)
 Apply translation to vertex set.
 
std::vector< Kakshya::Vertexapply_uniform_color (const std::vector< glm::vec3 > &positions, const glm::vec3 &color, float scalar=1.0F)
 Apply uniform color to position vertices.
 
void apply_uniform_scale (std::vector< glm::vec3 > &vertices, float scale, const glm::vec3 &origin=glm::vec3(0))
 Apply uniform scaling to vertex set.
 
std::vector< Kakshya::Vertexapply_vertex_colors (const std::vector< glm::vec3 > &positions, const std::vector< glm::vec3 > &colors, float scalar=1.0F)
 Convert positions to LineVertex with per-vertex colors.
 
std::vector< Kakshya::LineVertexarc_outline (glm::vec2 center, float radius, float angle_start, float angle_end, uint32_t segments, glm::vec3 color=glm::vec3(1.F), float thickness=1.F)
 Arc outline as a LINE_LIST (open curve, 2 * segments vertices).
 
std::vector< glm::vec2 > arc_path (glm::vec2 center, float radius_x, float radius_y, float angle_start, float angle_end, uint32_t segments)
 Sample a circular arc as ordered NDC positions.
 
float aspect_ratio (uint32_t width, uint32_t height)
 Aspect ratio from pixel dimensions.
 
UVField axial_blend (const glm::vec3 &origin=glm::vec3(0.0F), float scale=1.0F, float blend=4.0F)
 axial_blend projection: blend of three axis-aligned planar projections
 
Eigen::VectorXd bspline_cubic (const Eigen::MatrixXd &control_points, double t)
 Uniform B-spline interpolation using Eigen matrices.
 
ViewTransform build_view_transform (const NavigationState &state, float aspect)
 Build a ViewTransform from the current NavigationState without mutating it.
 
UVField 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)
 cartesian projection along a chosen axis
 
Eigen::VectorXd catmull_rom_spline (const Eigen::MatrixXd &control_points, double t, double tension=0.5)
 Catmull-Rom spline interpolation using Eigen matrices.
 
template<PositionCarrying T>
glm::vec3 centroid (std::span< T > pts) noexcept
 Arithmetic centroid (uniform weight) of a PositionCarrying span.
 
template<typename T , std::invocable< const T & > PosFn, std::invocable< const T & > WeightFn>
requires std::convertible_to<std::invoke_result_t<PosFn, const T&>, glm::vec3> && std::convertible_to<std::invoke_result_t<WeightFn, const T&>, float>
glm::vec3 centroid (std::span< T > pts, PosFn pos, WeightFn weight) noexcept
 Fully explicit weighted centroid for arbitrary point types.
 
template<PositionCarrying T, std::invocable< const T & > WeightFn>
requires std::convertible_to<std::invoke_result_t<WeightFn, const T&>, float>
glm::vec3 centroid (std::span< T > pts, WeightFn weight) noexcept
 Scalar-weighted centroid of a PositionCarrying span.
 
template<typename A , typename B , typename C >
Tendency< A, C > chain (const Tendency< A, B > &first, const Tendency< B, C > &second)
 Sequential composition: evaluate first, feed result into second.
 
std::vector< Kakshya::LineVertexcircle_outline (glm::vec2 center, float radius, uint32_t segments, glm::vec3 color=glm::vec3(1.F), float thickness=1.F)
 Circle outline as a LINE_LIST (closed loop, 2 * segments vertices).
 
std::function< bool(glm::vec2)> circular_bounds (glm::vec2 center, float radius) noexcept
 Containment test for a circle.
 
std::function< bool(glm::vec3)> circular_bounds (glm::vec3 center, float radius) noexcept
 Containment test for a sphere.
 
template<typename D >
Tendency< D, float > clamp (const Tendency< D, float > &t, float lo, float hi)
 Clamp scalar output to [lo, hi].
 
template<typename D , typename R , typename BinaryOp >
Tendency< D, R > combine (const Tendency< D, R > &a, const Tendency< D, R > &b, BinaryOp op)
 Combine two tendencies with a binary operation on their outputs.
 
double compute_arc_length (const Eigen::MatrixXd &points)
 Compute arc length of curve using trapezoidal rule.
 
Eigen::VectorXd compute_arc_length_table (const Eigen::MatrixXd &points)
 Compute arc length parameterization table.
 
std::vector< glm::vec3 > compute_convex_hull_2d (const std::vector< glm::vec3 > &vertices, const glm::vec3 &projection_normal=glm::vec3(0, 0, 1))
 Compute convex hull of vertex set (2D projection)
 
uint32_t compute_cube_index (const float *v, float iso) noexcept
 
ViewTransform compute_orbit_view_transform (const OrbitState &state, float aspect)
 Build a ViewTransform from the current OrbitState.
 
ViewTransform compute_pan_zoom_view_transform (const PanZoom2DState &state, float aspect)
 Build a ViewTransform from the current PanZoom2DState.
 
std::vector< Kakshya::LineVertexcompute_path_curvature (const std::vector< Kakshya::LineVertex > &path_vertices, float curvature_scale, size_t stride=1)
 Compute curvature vectors along a path (2nd derivative approximation)
 
std::vector< Kakshya::LineVertexcompute_path_normals (const std::vector< Kakshya::LineVertex > &path_vertices, float normal_length, size_t stride=1)
 Compute normal vectors along a piecewise-linear path.
 
std::vector< Kakshya::LineVertexcompute_path_tangents (const std::vector< Kakshya::LineVertex > &path_vertices, float tangent_length, size_t stride=1)
 Compute tangent vectors along a piecewise-linear path.
 
ViewTransform compute_view_transform (NavigationState &state, float aspect)
 Compute a ViewTransform from the current NavigationState.
 
template<typename D , typename R >
Tendency< D, R > constant (R value)
 Tendency returning a fixed value regardless of input.
 
std::function< bool(glm::vec3)> convex_region (std::span< const std::pair< glm::vec3, float > > planes)
 Containment test for a convex volume defined by inward-facing half-planes.
 
Eigen::MatrixXd create_rotation_matrix (double angle, uint32_t axis=2, uint32_t dimensions=2)
 Create N-dimensional rotation matrix.
 
Eigen::MatrixXd create_rotation_scaling_matrix (double angle, const std::vector< double > &scale_factors, uint32_t axis=2, uint32_t dimensions=2)
 Compose rotation then scaling: S * R.
 
Eigen::MatrixXd create_scaling_matrix (const std::vector< double > &scale_factors)
 Create diagonal scaling matrix from per-axis factors.
 
Eigen::VectorXd create_translation_vector (const std::vector< double > &offsets)
 Create translation vector (not a matrix; affine embedding is caller's concern)
 
Eigen::MatrixXd create_uniform_scaling_matrix (double scale, uint32_t dimensions)
 Create uniform scaling matrix.
 
Eigen::VectorXd cubic_bezier (const Eigen::MatrixXd &control_points, double t)
 Cubic Bezier interpolation using Eigen matrices.
 
Eigen::VectorXd cubic_hermite (const Eigen::MatrixXd &endpoints, const Eigen::MatrixXd &tangents, double t)
 Cubic Hermite interpolation using Eigen matrices.
 
std::vector< Kakshya::Vertexcuboid_wireframe (const glm::vec3 &center, const glm::vec3 &half, const glm::vec3 &color=glm::vec3(1.F))
 Generate a cuboid wireframe as LINE_LIST pairs.
 
EdgeList custom_proximity_graph (const Eigen::MatrixXd &points, const std::function< EdgeList(const Eigen::MatrixXd &)> &connection_function)
 Custom proximity graph via user function.
 
UVField cylindrical (const glm::vec3 &axis=glm::vec3(0.0F, 1.0F, 0.0F), const glm::vec3 &origin=glm::vec3(0.0F), float radius=1.0F, float height=1.0F)
 Cylindrical projection around a world axis.
 
template<typename T >
damp (T current, T target, T smoothing, T dt) noexcept
 Exponential smoothing: move current toward target at rate smoothing over time step dt.
 
template<typename T >
constexpr T deadzone (T x, T threshold) noexcept
 Zero values within [-threshold, threshold] and rescale the remainder to fill [0, 1] (or [-1, 1] for negative inputs).
 
template<typename T >
constexpr T denormalize (T t, T lo, T hi) noexcept
 Denormalize t from [0, 1] to [lo, hi].
 
SpatialField distance (const glm::vec3 &anchor, float radius, DistanceMetric metric=DistanceMetric::EUCLIDEAN)
 Normalized distance from an anchor point using the specified metric.
 
template<typename T >
constexpr T ease_in (T t) noexcept
 Cubic ease-in: slow start, fast end.
 
template<typename T >
constexpr T ease_in_out (T t) noexcept
 Cubic ease-in-out: slow start, fast middle, slow end.
 
template<typename T >
constexpr T ease_out (T t) noexcept
 Cubic ease-out: fast start, slow end.
 
std::function< bool(glm::vec3)> extruded_polygon_region (std::span< const glm::vec2 > footprint, float y_min, float y_max)
 Containment test for a vertically extruded 2D polygon.
 
std::vector< Kakshya::Vertexfilled_arc (glm::vec2 center, float radius, float angle_start, float angle_end, uint32_t segments, glm::vec3 color=glm::vec3(1.F))
 Filled circular arc sector (pie slice) as a TRIANGLE_LIST fan.
 
std::vector< Kakshya::Vertexfilled_circle (glm::vec2 center, float radius, uint32_t segments, glm::vec3 color=glm::vec3(1.F))
 Filled circle as a TRIANGLE_LIST triangle fan.
 
std::vector< Kakshya::Vertexfilled_polygon (glm::vec2 center, float radius, uint32_t sides, float rotation_rad=0.F, glm::vec3 color=glm::vec3(1.F))
 Filled regular n-gon as a TRIANGLE_LIST triangle fan.
 
std::array< Kakshya::Vertex, 4 > filled_rect (Kinesis::AABB2D region, glm::vec3 color=glm::vec3(1.F))
 Generate a filled TRIANGLE_STRIP quad from an AABB2D.
 
std::array< Kakshya::Vertex, 4 > filled_rect_gradient (AABB2D region, glm::vec3 color_bl, glm::vec3 color_br, glm::vec3 color_tl, glm::vec3 color_tr)
 Filled rect with per-corner colors, TRIANGLE_STRIP (4 vertices).
 
std::vector< Kakshya::Vertexfilled_ring (glm::vec2 center, float inner_r, float outer_r, uint32_t segments, glm::vec3 color=glm::vec3(1.F))
 Filled annulus (ring) as a TRIANGLE_LIST quad strip.
 
std::vector< Kakshya::Vertexfilled_rounded_rect (AABB2D region, float corner_radius, uint32_t corner_segments, glm::vec3 color=glm::vec3(1.F))
 Filled rounded rectangle as a TRIANGLE_LIST mesh.
 
EdgeList gabriel_graph (const Eigen::MatrixXd &points)
 Compute Gabriel graph.
 
Kakshya::MeshData generate_box (const glm::vec3 &center, const glm::vec3 &half_extents, uint32_t subdivisions=1)
 Generate a solid box as an indexed TRIANGLE_LIST mesh.
 
std::vector< glm::vec3 > generate_circle (const glm::vec3 &center, float radius, size_t segments, const glm::vec3 &normal=glm::vec3(0, 0, 1))
 Generate vertices along a circular path.
 
std::vector< glm::vec3 > generate_ellipse (const glm::vec3 &center, float semi_major, float semi_minor, size_t segments, const glm::vec3 &normal=glm::vec3(0, 0, 1))
 Generate vertices along an elliptical path.
 
Kakshya::MeshData generate_grid (const glm::vec3 &center, float extent_x, float extent_z, uint32_t cols, uint32_t rows, const glm::vec3 &normal=glm::vec3(0.0F, 1.0F, 0.0F))
 Generate a subdivided flat grid in the XZ plane.
 
Eigen::MatrixXd generate_interpolated_points (const Eigen::MatrixXd &control_points, Eigen::Index num_samples, InterpolationMode mode, double tension=0.5)
 Generate interpolated points from control points.
 
MAYAFLUX_API Kakshya::MeshData generate_parametric_surface (const std::function< glm::vec3(float u, float v)> &fn, uint32_t u_segs, uint32_t v_segs)
 Generate a mesh from an arbitrary parametric surface function.
 
Kakshya::MeshData generate_parametric_surface (const std::function< glm::vec3(float, float)> &fn, uint32_t u_segs, uint32_t v_segs)
 
EdgeList generate_proximity_graph (const Eigen::MatrixXd &points, const ProximityConfig &config)
 Generate proximity graph using specified mode.
 
QuadGeometry generate_quad (glm::vec2 position=glm::vec2(0.0F), glm::vec2 scale=glm::vec2(1.0F), float rotation=0.0F)
 Generate a textured quad centred on the origin.
 
std::vector< glm::vec3 > generate_rectangle (const glm::vec3 &center, float width, float height, const glm::vec3 &normal=glm::vec3(0, 0, 1))
 Generate vertices of an axis-aligned rectangular path.
 
std::vector< glm::vec3 > generate_regular_polygon (const glm::vec3 &center, float radius, size_t sides, const glm::vec3 &normal=glm::vec3(0, 0, 1), float phase_offset=0.0F)
 Generate vertices of a regular n-gon.
 
MAYAFLUX_API Kakshya::MeshData generate_revolution (const std::function< glm::vec2(float t)> &profile_fn, uint32_t profile_segs, uint32_t radial_segs, float sweep_radians=glm::two_pi< float >())
 Revolve a 2D profile curve around the Y axis.
 
Kakshya::MeshData generate_revolution (const std::function< glm::vec2(float)> &profile_fn, uint32_t profile_segs, uint32_t radial_segs, float sweep_radians)
 
Vertex generate_sample_at (SpatialDistribution distribution, size_t index, size_t total, const SamplerBounds &bounds, Kinesis::Stochastic::Stochastic &rng)
 Generate a single sample at a specific index (for indexed/sequential modes).
 
std::vector< Vertexgenerate_samples (SpatialDistribution distribution, size_t count, const SamplerBounds &bounds, Kinesis::Stochastic::Stochastic &rng)
 Generate a batch of spatially distributed samples.
 
MAYAFLUX_API Kakshya::MeshData generate_sdf_mesh (const Kinesis::SpatialField &field, const glm::vec3 &bounds_min, const glm::vec3 &bounds_max, uint32_t res_x, uint32_t res_y, uint32_t res_z, float iso_level=0.0F)
 Extract an isosurface from a scalar field using marching cubes.
 
MAYAFLUX_API Kakshya::MeshData generate_tube (std::span< const glm::vec3 > path, const std::function< float(float t)> &radius_fn, uint32_t radial_segments=8, bool capped=false)
 Extrude a circle along an arbitrary 3D path.
 
Kakshya::MeshData generate_tube (std::span< const glm::vec3 > path, const std::function< float(float)> &radius_fn, uint32_t radial_segments, bool capped)
 
bool in_bounds (double window_x, double window_y, uint32_t width, uint32_t height)
 Check if a window-space point is within bounds.
 
Eigen::VectorXd interpolate (const Eigen::MatrixXd &control_points, double t, InterpolationMode mode, double tension=0.5)
 Generic interpolation dispatcher.
 
Kakshya::DataVariant interpolate_nddata (const Kakshya::DataVariant &control_points, Eigen::Index num_samples, InterpolationMode mode, double tension=0.5)
 Process DataVariant through interpolation.
 
std::function< bool(glm::vec2)> intersect_bounds (std::function< bool(glm::vec2)> a, std::function< bool(glm::vec2)> b)
 Intersection of two containment tests.
 
std::function< bool(glm::vec3)> intersect_bounds (std::function< bool(glm::vec3)> a, std::function< bool(glm::vec3)> b)
 Intersection of two 3D containment tests.
 
template<typename D >
Tendency< D, float > invert (const Tendency< D, float > &t)
 Negate a scalar-output tendency.
 
VectorField invert (const VectorField &t)
 Negate all components of a vector field.
 
EdgeList k_nearest_neighbors (const Eigen::MatrixXd &points, size_t k)
 Compute K-nearest neighbors graph.
 
template<typename D >
Tendency< D, float > lerp (const Tendency< D, float > &a, const Tendency< D, float > &b, const Tendency< D, float > &weight)
 Interpolate between two tendencies controlled by a weight tendency.
 
ViewTransform look_at (const glm::vec3 &eye, const glm::vec3 &target, const glm::vec3 &up=glm::vec3(0.0F, 1.0F, 0.0F))
 Construct view matrix from eye position, target, and up vector.
 
ViewTransform look_at_perspective (const glm::vec3 &eye, const glm::vec3 &target, float fov_radians, float aspect, float near, float far, const glm::vec3 &up=glm::vec3(0.0F, 1.0F, 0.0F))
 Construct complete ViewTransform from look-at and perspective parameters.
 
NavigationState make_navigation_state (const NavigationConfig &config)
 Construct a NavigationState from a NavigationConfig.
 
OrbitState make_orbit_state (const OrbitConfig &config)
 Construct an OrbitState from an OrbitConfig.
 
PanZoom2DState make_pan_zoom_state (const PanZoom2DConfig &config)
 Construct a PanZoom2DState from a PanZoom2DConfig.
 
std::unique_ptr< SpatialIndex3Dmake_spatial_index_3d (float cell_size)
 Create a 3D spatial index with Euclidean squared distance.
 
std::unique_ptr< SpatialIndexNDmake_spatial_index_nd (float cell_size, uint32_t dimensions)
 Create an N-dimensional spatial index with Euclidean squared distance.
 
template<typename T >
constexpr T map (T x, T in_lo, T in_hi, T out_lo, T out_hi) noexcept
 Map x from [in_lo, in_hi] to [out_lo, out_hi], unclamped.
 
template<typename T >
constexpr T map_clamped (T x, T in_lo, T in_hi, T out_lo, T out_hi) noexcept
 Map x from [in_lo, in_hi] to [out_lo, out_hi], clamped to [out_lo, out_hi].
 
EdgeList minimum_spanning_tree (const Eigen::MatrixXd &points)
 Compute minimum spanning tree (Prim's algorithm)
 
glm::uvec2 ndc_size_to_pixels (const AABB2D &region, uint32_t width, uint32_t height)
 Convert an NDC AABB's extent to integer pixel dimensions.
 
glm::uvec2 ndc_size_to_pixels (const glm::vec2 &ndc_size, uint32_t width, uint32_t height)
 Convert an NDC-space size (extent) to integer pixel dimensions.
 
EdgeList nearest_neighbor_graph (const Eigen::MatrixXd &points)
 Compute nearest neighbor graph.
 
template<typename T >
constexpr T normalize (T x, T lo, T hi) noexcept
 Normalize x in [lo, hi] to [0, 1], unclamped.
 
glm::vec3 orbit_eye (const OrbitState &state)
 Derive eye position from the current orbit state.
 
ViewTransform ortho (float left, float right, float bottom, float top, float near=-1.0F, float far=1.0F)
 Construct orthographic projection matrix.
 
ViewTransform perspective (float fov_radians, float aspect, float near, float far)
 Construct perspective projection matrix.
 
template<typename T >
ping_pong (T x, T lo, T hi) noexcept
 Ping-pong (triangle wave): fold x back and forth in [lo, hi].
 
float point_ray_distance_sq (const Ray &ray, const glm::vec3 &point, float *out_t=nullptr)
 Squared perpendicular distance from a point to an infinite ray.
 
std::function< bool(glm::vec2)> polygon_bounds (std::span< const glm::vec2 > vertices)
 Containment test for a convex or concave polygon.
 
std::vector< Kakshya::LineVertexpolygon_outline (glm::vec2 center, float radius, uint32_t sides, float rotation_rad=0.F, glm::vec3 color=glm::vec3(1.F), float thickness=1.F)
 Regular n-gon outline as a LINE_LIST (closed loop, 2 * sides vertices).
 
std::vector< Kakshya::LineVertexpolyline (std::span< const glm::vec2 > pts, glm::vec3 color=glm::vec3(1.F), float thickness=1.F)
 Polyline as a LINE_LIST (open path, 2 * (pts.size() - 1) vertices).
 
std::vector< Kakshya::LineVertexpolyline_colored (std::span< const glm::vec2 > pts, std::span< const glm::vec3 > colors, float thickness=1.F)
 Polyline with per-vertex colors as a LINE_LIST.
 
void project_onto_plane (std::vector< glm::vec3 > &vertices, const glm::vec3 &plane_point, const glm::vec3 &plane_normal)
 Project vertices onto plane defined by normal.
 
Eigen::VectorXd quadratic_bezier (const Eigen::MatrixXd &control_points, double t)
 Quadratic Bezier interpolation using Eigen matrices.
 
EdgeList radius_threshold_graph (const Eigen::MatrixXd &points, double radius)
 Compute radius threshold graph.
 
glm::vec3 ray_at_depth (double window_x, double window_y, uint32_t width, uint32_t height, float ndc_depth, const ViewTransform &vt)
 Recover the world-space position at a known depth for a given pixel.
 
std::optional< HitResultray_cast (const SpatialIndex3D &index, const Ray &ray, float tolerance)
 Find the closest entity to a ray within a tolerance radius.
 
std::vector< HitResultray_cast_all (const SpatialIndex3D &index, const Ray &ray, float tolerance)
 Find all entities within tolerance of a ray, sorted by distance.
 
std::array< Kakshya::LineVertex, 8 > rect_outline (AABB2D region, glm::vec3 color=glm::vec3(1.F), float thickness=1.F)
 Rectangle outline as a LINE_LIST (4 edges, 8 vertices).
 
EdgeList relative_neighborhood_graph (const Eigen::MatrixXd &points)
 Compute relative neighborhood graph.
 
Eigen::MatrixXd reparameterize_by_arc_length (const Eigen::MatrixXd &points, Eigen::Index num_samples)
 Reparameterize curve by arc length.
 
std::vector< Kakshya::LineVertexreparameterize_by_arc_length (const std::vector< Kakshya::LineVertex > &path_vertices, size_t num_samples)
 Resample path vertices for arc-length parameterization.
 
std::vector< glm::vec3 > sample_parametric_curve (const std::function< glm::vec3(float)> &curve, size_t samples)
 Sample parametric curve uniformly in parameter space.
 
template<typename D >
Tendency< D, float > scale (const Tendency< D, float > &t, float factor)
 Uniform scaling of a scalar-output tendency.
 
VectorField scale (const VectorField &t, float factor)
 Uniform scaling of a vector field.
 
Ray screen_to_ray (double window_x, double window_y, uint32_t width, uint32_t height, const ViewTransform &vt)
 Construct a world-space ray from window pixel coordinates.
 
template<typename D , typename R >
Tendency< D, R > select (const Tendency< D, float > &predicate, const Tendency< D, R > &then_t, const Tendency< D, R > &else_t)
 Select between two tendencies based on a predicate tendency.
 
EdgeList sequential_chain (const Eigen::MatrixXd &points)
 Compute sequential chain graph.
 
ScalarField sigmoid (float k, float midpoint=0.0F)
 Sigmoid: 1 / (1 + e^(-k * (x - midpoint)))
 
template<typename T >
constexpr T sign_nonzero (T x) noexcept
 Sign of x, returning -1 or +1, never 0.
 
template<typename T >
constexpr T smootherstep (T lo, T hi, T x) noexcept
 Ken Perlin's quintic smootherstep: C2-continuous in [lo, hi].
 
ScalarField smoothstep (float edge0, float edge1)
 Smoothstep: cubic Hermite interpolation between two edges.
 
template<typename T >
constexpr T smoothstep (T lo, T hi, T x) noexcept
 GLSL smoothstep: Hermite interpolation in [lo, hi].
 
template<typename T >
snap (T x, T lo, T hi, T step) noexcept
 Snap x to the nearest multiple of step within [lo, hi].
 
template<typename T >
snap (T x, T step) noexcept
 Round x to the nearest multiple of step.
 
void snap_orbit_ortho (OrbitState &state, int view)
 Snap to a named ortho view, preserving distance and focal point.
 
void snap_ortho (NavigationState &state, int view)
 Snap to a named ortho view.
 
UVField spherical (const glm::vec3 &centre=glm::vec3(0.0F))
 Spherical projection from a centre point.
 
std::function< bool(glm::vec2)> stroke_bounds (std::span< const glm::vec2 > points, float half_thickness)
 Containment test for a polyline with a uniform half-thickness.
 
std::function< bool(glm::vec2)> subtract_bounds (std::function< bool(glm::vec2)> a, std::function< bool(glm::vec2)> b)
 Difference of two containment tests.
 
std::function< bool(glm::vec3)> subtract_bounds (std::function< bool(glm::vec3)> a, std::function< bool(glm::vec3)> b)
 Difference of two 3D containment tests.
 
std::array< Kakshya::TextureQuadVertex, 4 > textured_rect (Kinesis::AABB2D region)
 Generate a UV-mapped TRIANGLE_STRIP quad from an AABB2D.
 
template<typename D >
Tendency< D, float > threshold (const Tendency< D, float > &t, float thresh)
 Zero output below threshold, pass through above.
 
glm::vec3 to_ndc (double window_x, double window_y, uint32_t width, uint32_t height)
 Convert window pixel coordinates to NDC.
 
glm::vec3 to_ndc_aspect (double window_x, double window_y, uint32_t width, uint32_t height)
 Convert window pixel coordinates to NDC, corrected for aspect ratio.
 
glm::vec2 to_window (const glm::vec3 &ndc, uint32_t width, uint32_t height)
 Convert NDC to window pixel coordinates.
 
ScalarField transfer_curve (const std::vector< float > &coefficients)
 Transfer curve from polynomial coefficients (highest power first)
 
std::function< bool(glm::vec2)> union_bounds (std::function< bool(glm::vec2)> a, std::function< bool(glm::vec2)> b)
 Union of two containment tests.
 
std::function< bool(glm::vec3)> union_bounds (std::function< bool(glm::vec3)> a, std::function< bool(glm::vec3)> b)
 Union of two 3D containment tests.
 
template<typename T >
wrap (T x, T lo, T hi) noexcept
 Wrap x into [lo, hi) with modulo semantics.
 

Variables

constexpr std::array< uint16_t, 256 > k_edge_table
 
constexpr std::array< std::array< int8_t, 16 >, 256 > k_tri_table