MayaFlux 0.2.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Nodes::Network::PointCloudNetwork Class Reference

Spatial relational network operating on unordered point sets. More...

#include <PointCloudNetwork.hpp>

+ Inheritance diagram for MayaFlux::Nodes::Network::PointCloudNetwork:
+ Collaboration diagram for MayaFlux::Nodes::Network::PointCloudNetwork:

Public Member Functions

 PointCloudNetwork ()
 Create empty point cloud network.
 
 PointCloudNetwork (size_t num_points, const glm::vec3 &bounds_min=glm::vec3(-1.0F), const glm::vec3 &bounds_max=glm::vec3(1.0F), Kinesis::SpatialDistribution init_mode=Kinesis::SpatialDistribution::RANDOM_CUBE)
 Create network with initial point count and bounds.
 
void initialize () override
 Called once before first process_batch()
 
void reset () override
 Reset network to initial state.
 
void process_batch (unsigned int num_samples) override
 Process the network for the given number of samples.
 
void set_topology (Topology topology) override
 Set the network's topology.
 
void reinitialize (size_t count, const glm::vec3 &bounds_min, const glm::vec3 &bounds_max, Kinesis::SpatialDistribution mode)
 Reinitialize point cloud with new parameters.
 
size_t get_node_count () const override
 Get the number of nodes in the network.
 
std::optional< double > get_node_output (size_t index) const override
 Get output of specific internal node (for ONE_TO_ONE mapping)
 
std::unordered_map< std::string, std::string > get_metadata () const override
 Get network metadata for debugging/visualization.
 
void set_vertices (const std::vector< LineVertex > &vertices)
 Set all point vertices.
 
void apply_color_gradient (const glm::vec3 &start_color, const glm::vec3 &end_color)
 Set colors for all points.
 
void apply_radial_gradient (const glm::vec3 &center_color, const glm::vec3 &edge_color, const glm::vec3 &center=glm::vec3(0.0F))
 Apply radial color gradient from center.
 
std::vector< LineVertexget_vertices () const
 Get all point vertices.
 
void update_vertex (size_t index, const LineVertex &vertex)
 Update single vertex completely.
 
void set_line_color (const glm::vec3 &color)
 Set global line color for topology/path rendering.
 
void set_connection_radius (float radius)
 Set connection radius for topology generation (TopologyOperator only)
 
void set_k_neighbors (size_t k)
 Set K value for K-nearest neighbors (TopologyOperator only)
 
void set_line_thickness (float thickness)
 Set line thickness for topology/path rendering.
 
void set_samples_per_segment (size_t samples)
 Set samples per segment for path interpolation (PathOperator only)
 
void set_tension (double tension)
 Set tension for Catmull-Rom interpolation (PathOperator only)
 
NetworkOperatorget_operator () override
 
const NetworkOperatorget_operator () const override
 
bool has_operator () const override
 
template<typename OpType , typename... Args>
OpType * create_operator (Args &&... args)
 Create and set operator in one call.
 
void set_operator (std::unique_ptr< NetworkOperator > op)
 
- Public Member Functions inherited from MayaFlux::Nodes::Network::NodeNetwork
virtual ~NodeNetwork ()=default
 
virtual std::optional< std::vector< double > > get_audio_buffer () const
 Get cached audio buffer from last process_batch()
 
virtual std::optional< std::span< const double > > get_node_audio_buffer (size_t) const
 Get output of specific internal node as audio buffer (for ONE_TO_ONE mapping)
 
void set_output_mode (OutputMode mode)
 Set the network's output routing mode.
 
OutputMode get_output_mode () const
 Get the current output routing mode.
 
Topology get_topology () const
 Get the current topology.
 
void set_enabled (bool enabled)
 Enable/disable the network.
 
bool is_enabled () const
 Check if network is enabled.
 
virtual void map_parameter (const std::string &param_name, const std::shared_ptr< Node > &source, MappingMode mode=MappingMode::BROADCAST)
 Map external node output to network parameter.
 
virtual void map_parameter (const std::string &param_name, const std::shared_ptr< NodeNetwork > &source_network)
 Map external node network to network parameters (ONE_TO_ONE)
 
virtual void unmap_parameter (const std::string &param_name)
 Remove parameter mapping.
 
void set_output_scale (double scale)
 Set the scalar multiplier applied to the network's output buffer after processing.
 
double get_output_scale () const
 Get the current output scale factor.
 
void add_channel_usage (uint32_t channel_id)
 Register network usage on a specific channel.
 
void remove_channel_usage (uint32_t channel_id)
 Unregister network from a specific channel.
 
bool is_registered_on_channel (uint32_t channel_id) const
 Check if network is registered on a channel.
 
std::vector< uint32_t > get_registered_channels () const
 Get all channels this network is registered on.
 
uint32_t get_channel_mask () const
 Get channel mask (bitfield of registered channels)
 
void set_channel_mask (uint32_t mask)
 Set channel mask directly.
 
bool is_processed_this_cycle () const
 Check if network has been processed this cycle (lock-free)
 
void mark_processing (bool processing)
 Mark network as processing or not (lock-free)
 
void mark_processed (bool processed)
 Mark network as processed this cycle (lock-free)
 
bool is_processing () const
 Check if network is currently processing (lock-free)
 
void request_reset_from_channel (uint32_t channel_id)
 Request a reset from a specific channel.
 
const RoutingStateget_routing_state () const
 Retrieves the current routing state of the network.
 
RoutingStateget_routing_state ()
 Retrieves the current routing state of the network (non-const)
 
bool needs_channel_routing () const
 Checks if the network is currently in a routing transition phase.
 
void set_sample_rate (uint32_t sample_rate)
 
uint32_t get_sample_rate () const
 
void set_block_size (uint32_t block_size)
 
uint32_t get_block_size () const
 

Private Member Functions

std::vector< LineVertexgenerate_initial_positions ()
 
void update_mapped_parameters ()
 Update mapped parameters before path/topology processing.
 

Private Attributes

size_t m_num_points {}
 
Kinesis::SamplerBounds m_bounds
 
Kinesis::SpatialDistribution m_init_mode { Kinesis::SpatialDistribution::RANDOM_CUBE }
 
Kinesis::Stochastic::Stochastic m_random_gen
 
std::unique_ptr< NetworkOperatorm_operator
 
std::vector< LineVertexm_cached_vertices
 

Additional Inherited Members

- Protected Member Functions inherited from MayaFlux::Nodes::Network::NodeNetwork
void ensure_initialized ()
 Ensure initialize() is called exactly once.
 
void apply_output_scale ()
 Apply m_output_scale to m_last_audio_buffer.
 
- Static Protected Member Functions inherited from MayaFlux::Nodes::Network::NodeNetwork
static std::unordered_map< size_t, std::vector< size_t > > build_grid_2d_neighbors (size_t width, size_t height)
 Build neighbor map for GRID_2D topology.
 
static std::unordered_map< size_t, std::vector< size_t > > build_grid_3d_neighbors (size_t width, size_t height, size_t depth)
 Build neighbor map for GRID_3D topology.
 
static std::unordered_map< size_t, std::vector< size_t > > build_ring_neighbors (size_t count)
 Build neighbor map for RING topology.
 
static std::unordered_map< size_t, std::vector< size_t > > build_chain_neighbors (size_t count)
 Build neighbor map for CHAIN topology.
 
- Protected Attributes inherited from MayaFlux::Nodes::Network::NodeNetwork
Topology m_topology = Topology::INDEPENDENT
 
OutputMode m_output_mode = OutputMode::NONE
 
bool m_enabled = true
 
bool m_initialized = false
 
uint32_t m_sample_rate { 48000 }
 
uint32_t m_block_size { 512 }
 
std::vector< ParameterMappingm_parameter_mappings
 
std::atomic< uint32_t > m_channel_mask { 0 }
 Bitfield of channels this network is registered on.
 
std::atomic< uint32_t > m_pending_reset_mask { 0 }
 
std::atomic< bool > m_processing_state { false }
 Per-channel processing state (lock-free atomic flags)
 
std::atomic< bool > m_processed_this_cycle { false }
 
std::vector< double > m_last_audio_buffer
 
double m_output_scale { 1.0 }
 Post-processing scalar applied to m_last_audio_buffer each batch.
 

Detailed Description

Spatial relational network operating on unordered point sets.

PointCloudNetwork represents a literal point cloud: a collection of spatial samples (positions + optional attributes) with no inherent identity, persistence, or physics semantics.

The network itself performs no computation. All structural, topological, or interpolative behavior is delegated to attached NetworkOperator instances.


Conceptual Model

Designed for computational graphics and data visualization. While it can ingest point cloud data from external sources (lidar, scanning, etc.), its purpose is generating and visualizing structure through algorithmic relationships — not surface reconstruction or scene analysis.

  • ParticleNetwork models entities that evolve over time.
  • PointCloudNetwork models spatial samples whose meaning emerges through algorithmically defined relationships.

Points in this network:

  • Have no identity beyond index.
  • Do not simulate motion or forces.
  • Do not own connectivity.
  • Exist purely as a spatial substrate.

Operators define interpretation:

Rendering and processing backends remain completely agnostic to network type — they consume vertex data produced by operators.


Modality-Agnostic Design

Points may originate from any source:

  • Procedural generation
  • Texture sampling
  • Image analysis
  • Audio feature extraction
  • External datasets

Once spatialized, the network treats them uniformly as relational samples.


Important Distinction

If you need per-entity state, temporal evolution, or physics simulation, use ParticleNetwork.

If you need structural relationships between spatial samples, use PointCloudNetwork.

PointCloudNetwork is for STRUCTURE. ParticleNetwork is for MOTION.

Common use cases:

  • Network graphs (social, neural, data visualization)
  • Procedural topology generation (Delaunay, MST, proximity)
  • Path visualization (trajectories, routes, flow lines)
  • Data-driven connectivity inference
  • Gradient-based color visualization

Usage Example

// Single topology network
auto cloud = std::make_shared<PointCloudNetwork>(500);
cloud->initialize();
// Multiple independent topologies
auto cloud = std::make_shared<PointCloudNetwork>();
auto topo = cloud->create_operator<TopologyOperator>(Kinesis::ProximityMode::RADIUS);
topo->initialize_topologies({group1_points, group2_points}, mode);
cloud->set_operator(std::move(topo));
// Path-based visualization
auto cloud = std::make_shared<PointCloudNetwork>();
auto paths = cloud->create_operator<PathOperator>();
paths->initialize_paths({path1, path2, path3}, InterpolationMode::CATMULL_ROM);
cloud->set_operator(std::move(paths));
// Per-point color gradient
cloud->apply_color_gradient(start_color, end_color);
cloud->set_point_colors(custom_colors);
void initialize_paths(const std::vector< std::vector< LineVertex > > &paths, Kinesis::InterpolationMode mode)
Initialize multiple paths with given control points and properties.
void initialize(const std::vector< LineVertex > &vertices)
Initialize a single topology with single set of vertices.
void initialize_topologies(const std::vector< std::vector< LineVertex > > &topologies, Kinesis::ProximityMode mode)
Initialize multiple topologies with given positions and properties.

Definition at line 112 of file PointCloudNetwork.hpp.


The documentation for this class was generated from the following files: