Oakfield API Documentation 1.0.0
Numerical core APIs
Loading...
Searching...
No Matches
worley_noise.h File Reference

Worley / cellular noise stimulus with selectable distance metrics. More...

#include "coords.h"
#include "oakfield/operator_split.h"
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
Include dependency graph for worley_noise.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  SimStimulusWorleyNoiseConfig
 Configuration for seeded Worley cellular-noise stimulus fields. More...
 

Typedefs

typedef enum SimStimulusWorleyDistanceMetric SimStimulusWorleyDistanceMetric
 Distance metric used when evaluating Worley feature points.
 
typedef enum SimStimulusWorleyOutputMode SimStimulusWorleyOutputMode
 Feature-distance output selected by Worley noise.
 
typedef struct SimStimulusWorleyNoiseConfig SimStimulusWorleyNoiseConfig
 Configuration for seeded Worley cellular-noise stimulus fields.
 

Enumerations

enum  SimStimulusWorleyDistanceMetric { SIM_STIMULUS_WORLEY_EUCLIDEAN = 0 , SIM_STIMULUS_WORLEY_MANHATTAN = 1 , SIM_STIMULUS_WORLEY_CHEBYSHEV = 2 , SIM_STIMULUS_WORLEY_MINKOWSKI = 3 }
 Distance metric used when evaluating Worley feature points. More...
 
enum  SimStimulusWorleyOutputMode { SIM_STIMULUS_WORLEY_F1 = 0 , SIM_STIMULUS_WORLEY_F2 = 1 , SIM_STIMULUS_WORLEY_F2_MINUS_F1 = 2 }
 Feature-distance output selected by Worley noise. More...
 

Functions

SimResult sim_add_stimulus_worley_noise_operator (struct SimContext *context, const SimStimulusWorleyNoiseConfig *config, size_t *out_index)
 Register a Worley cellular-noise stimulus operator.
 
SimResult sim_stimulus_worley_noise_config (struct SimContext *context, size_t operator_index, SimStimulusWorleyNoiseConfig *out_config)
 Copy the current Worley-noise configuration from a registered operator.
 
SimResult sim_stimulus_worley_noise_update (struct SimContext *context, size_t operator_index, const SimStimulusWorleyNoiseConfig *config)
 Replace or renormalize a registered Worley-noise stimulus configuration.
 

Detailed Description

Worley / cellular noise stimulus with selectable distance metrics.

Synthesizes one deterministic feature point per lattice cell and evaluates the distance to the nearest or second-nearest feature. The lattice is sampled in a local coordinate frame controlled by coord, then scaled by feature_frequency.

For complex fields, the imaginary component is generated from an independent deterministic feature lattice derived from the same seed.

Enumeration Type Documentation

◆ SimStimulusWorleyDistanceMetric

Distance metric used when evaluating Worley feature points.

Enumerator
SIM_STIMULUS_WORLEY_EUCLIDEAN 

Euclidean distance.

SIM_STIMULUS_WORLEY_MANHATTAN 

Manhattan distance.

SIM_STIMULUS_WORLEY_CHEBYSHEV 

Chebyshev distance.

SIM_STIMULUS_WORLEY_MINKOWSKI 

Minkowski distance with configured exponent.

◆ SimStimulusWorleyOutputMode

Feature-distance output selected by Worley noise.

Enumerator
SIM_STIMULUS_WORLEY_F1 

Nearest feature distance.

SIM_STIMULUS_WORLEY_F2 

Second-nearest feature distance.

SIM_STIMULUS_WORLEY_F2_MINUS_F1 

Difference between second and nearest distances.

Function Documentation

◆ sim_add_stimulus_worley_noise_operator()

SimResult sim_add_stimulus_worley_noise_operator ( struct SimContext context,
const SimStimulusWorleyNoiseConfig config,
size_t *  out_index 
)

Register a Worley cellular-noise stimulus operator.

The implementation copies and normalizes config, derives deterministic hash bases from the seed, and registers the noise operator on the target field.

Parameters
contextSimulation context that will own the operator.
configOptional Worley-noise configuration; NULL selects normalized defaults.
[out]out_indexOptional destination for the registered operator index.
Returns
SIM_RESULT_OK on success, or an error code from validation, allocation, cache setup, or split-operator registration.

◆ sim_stimulus_worley_noise_config()

SimResult sim_stimulus_worley_noise_config ( struct SimContext context,
size_t  operator_index,
SimStimulusWorleyNoiseConfig out_config 
)

Copy the current Worley-noise configuration from a registered operator.

Parameters
contextSimulation context containing the operator.
operator_indexIndex returned by sim_add_stimulus_worley_noise_operator().
[out]out_configReceives the operator's normalized configuration.
Returns
SIM_RESULT_OK on success, SIM_RESULT_INVALID_ARGUMENT for NULL pointers, SIM_RESULT_NOT_FOUND for a missing operator, or SIM_RESULT_INVALID_STATE when the operator has no stimulus state.

◆ sim_stimulus_worley_noise_update()

SimResult sim_stimulus_worley_noise_update ( struct SimContext context,
size_t  operator_index,
const SimStimulusWorleyNoiseConfig config 
)

Replace or renormalize a registered Worley-noise stimulus configuration.

Passing NULL for config keeps the existing configuration and reapplies normalization. A successful update refreshes hash bases/caches as needed and invalidates the scheduler plan.

Parameters
contextSimulation context containing the operator.
operator_indexIndex of the Worley-noise operator to update.
configOptional replacement configuration.
Returns
SIM_RESULT_OK on success, or an error code if lookup, cache setup, or state validation fails.