API Reference#
Native API#
Free functions declared in FlowerEvolver.hpp - the entry points
src/bindings/native.cpp exposes to native (non-web) consumers.
Functions
-
fe::Flower makeFlower(int radius, int numLayers, float P, float bias) noexcept#
makes a flower.
- Parameters:
radius – int radius for the flower
numLayers – int how many layers it will have
P – float P parameter it controls how many petals the flower can have.
bias – float bias
- Returns:
fe::Flower – .toJson() for the genome, .petals.image for the render
-
std::string make3DFlower(const fe::DNA &dna, int radius, int numLayers, float P, float bias, const std::string &flowerId, const std::string &flowerParams = "")#
Generates a 3D flower model as a glTF string.
Orchestrates the process of generating a stem, processing 2D layer images (finding contours, simplifying), generating 3D petal geometry for each layer, and assembling the final glTF data.
- Parameters:
dna – The genetic information used to draw the layers.
radius – Initial radius parameter for fe::Petals constructor.
numLayers – Number of layers parameter for fe::Petals constructor and loop control.
P – P parameter for fe::Petals constructor.
bias – Bias parameter for fe::Petals constructor.
flowerId – A unique string identifier for this flower instance (used in group names).
flowerParams – std::string json fe::FlowerParameters for the 3d flower.
- Returns:
A std::string containing the 3D model in GLTF format. Returns empty string on error. (GLTF is a text interchange format either way, so unlike the image functions below there’s no more “native” form to return instead.)
-
fe::Flower makePetals(int radius, int numLayers, float P, float bias) noexcept#
makes just the petals (no stem).
- Parameters:
radius – int radius for the flower
numLayers – int how many layers it will have
P – float P parameter it controls how many petals the flower can have.
bias – float bias
- Returns:
fe::Flower – .toJson() for the genome, .petals.image for the render
-
fe::Flower makePetalLayer(int radius, int numLayers, float P, float bias, int layer) noexcept#
makes just the petal layer (no stem).
- Parameters:
radius – int radius for the flower
numLayers – int how many layers it will have
P – float P parameter it controls how many petals the flower can have.
bias – float bias
layer – int layer layer to paint
- Returns:
fe::Flower – .toJson() for the genome, .petals.image for the render
-
fe::Flower makeStem(int radius, int numLayers, float P, float bias) noexcept#
makes just the stem (no petals).
- Parameters:
radius – int radius for the flower
numLayers – int how many layers it will have
P – float P parameter it controls how many petals the flower can have.
bias – float bias
- Returns:
fe::Flower – .toJson() for the genome, .petals.image for the render
-
fe::Image drawFlower(const fe::DNA &dna, int radius, int numLayers, float P, float bias)#
renders the given genome.
-
fe::Image drawPetals(const fe::DNA &dna, int radius, int numLayers, float P, float bias)#
renders the given genome’s petals (no stem).
-
fe::Image drawPetalLayer(const fe::DNA &dna, int radius, int numLayers, float P, float bias, int layer)#
renders the given genome’s petal layer (no stem).
- Parameters:
dna – const fe::DNA& genome to render (needs at least 2 genomes)
radius – int radius for the flower
numLayers – int how many layers it will have
P – float P parameter it controls how many petals the flower can have.
bias – float bias
layer – int layer to render
- Returns:
fe::Image the rendered image
-
fe::Flower reproduce(const fe::DNA &dna1, const fe::DNA &dna2, int radius, int numLayers, float P, float bias)#
makes a child from two genomes.
- Parameters:
- Returns:
fe::Flower – .toJson() for the genome, .petals.image for the render
-
fe::Flower mutate(fe::DNA original, int radius, int numLayers, float P, float bias, float addNodeRate, float addConnRate, float removeConnRate, float perturbWeightsRate, float enableRate, float disableRate, float actTypeRate)#
mutates the given genome.
originalis taken by value and mutated in place internally - the caller’s own copy, if any, is left untouched.- Parameters:
original – fe::DNA genome to mutate
radius – int radius for the flower
numLayers – int how many layers it will have
P – float P parameter it controls how many petals the flower can have.
bias – float bias
addNodeRate – float rate to determine what it mutates
addConnRate – float rate to determine what it mutates
removeConnRate – float rate to determine what it mutates
perturbWeightsRate – float rate to determine what it mutates
enableRate – float rate to determine what it mutates
disableRate – float rate to determine what it mutates
actTypeRate – float rate to determine what it mutates
- Returns:
fe::Flower – .toJson() for the genome, .petals.image for the render
-
fe::Stats getFlowerStats(const std::string &genome, float humidity, int temperature, int altitude, int terrainType)#
gets the flower stats from the DNA[0].
- Parameters:
genome – const std::string& stringified flower.json – passed straight through to fe::Stats’s own (pre-existing) string-based constructor, so there’s no parse/round-trip to avoid here like there was in the functions above.
humidity – float 0.0 to 1.0
temperature – int temperature
altitude – int meters above sea
terrainType – int terrain type
- Returns:
-
fe::FlowerClassifier trainFlowerClassifier(const std::vector<std::vector<double>> &samples, const fe::Environment &environment, const fe::SOMTrainingConfig &training)#
trains a SOM species classifier over already-extracted feature vectors.
- Parameters:
samples – each of size fe::FlowerClassifier::inputDim, see fe::extractFlowerFeatures(). Wrong-size or non-finite ones are skipped and logged, not an error.
environment – recorded on the classifier as documentation only.
training – grid size + hyperparameters.
- Throws:
std::invalid_argument – if no sample is usable.
- Returns:
-
fe::FlowerClassifier trainFlowerClassifier(const std::string &generationsJson, const fe::Environment &environment, const fe::SOMTrainingConfig &training)#
same as above, over a whole {“Generation”: […]} JSON batch; flowers are extracted one at a time so peak memory stays low.
- Parameters:
generationsJson – std::string json Generation of flowers.
environment – used for every flower’s fe::Stats and recorded on the classifier.
training – grid size + hyperparameters.
- Throws:
std::runtime_error – if generationsJson is not parsable JSON.
std::invalid_argument – if no flower is usable.
- Returns:
-
std::vector<std::optional<fe::SpeciesMatch>> classifyFlowers(const fe::FlowerClassifier &classifier, const std::string &generationsJson, const fe::Environment &environment)#
classifies every flower of a {“Generation”: […]} batch against a classifier, one entry per flower in input order.
- Parameters:
classifier – a trained classifier, see trainFlowerClassifier().
generationsJson – std::string json Generation of flowers.
environment – used for every flower’s fe::Stats.
- Throws:
std::runtime_error – if generationsJson is not parsable JSON.
std::invalid_argument – if environment is invalid.
- Returns:
std::vector<std::optional<fe::SpeciesMatch>> the species of each flower and its distance to it, std::nullopt for a flower that can’t be classified (same meaning as fe::FlowerClassifier::classify()), so the indexes always line up with the input.
fe namespace#
Covers fe::Math, fe::gltf, and fe::resources too.
-
namespace fe#
Typedefs
-
typedef signed char Int8#
-
typedef unsigned char Uint8#
-
typedef signed short Int16#
-
typedef unsigned short Uint16#
-
typedef signed int Int32#
-
typedef unsigned int Uint32#
-
typedef signed long long Int64#
-
typedef unsigned long long Uint64#
-
using SOMEpochCallback = std::function<bool(const SOMEpoch&)>#
called after every epoch of fe::FlowerClassifier::train(); return false to stop after that epoch.
Functions
-
bool findContourMoore(const std::vector<std::uint8_t> &imageData, int width, int height, int alphaThreshold, std::vector<fe::Vec2i> &contourPoints)#
Finds the outer boundary contour of the first encountered opaque component using the Moore-Neighbor tracing algorithm.
Scans the image to find a starting opaque pixel on a boundary (adjacent to a transparent pixel). Then, traces the boundary clockwise until returning to the start. Only finds one contour.
- Parameters:
imageData – Raw RGBA pixel data (row-major).
width – Image width in pixels.
height – Image height in pixels.
alphaThreshold – Alpha value (0-255) above which a pixel is considered opaque.
contourPoints – Output vector where the found contour points (fe::Vec2i) will be stored in clockwise order. The vector is cleared first.
- Returns:
true if a contour with at least 3 points was found, false otherwise.
-
void douglasPeucker(const std::vector<fe::Vec2i> &points, float epsilonSq, std::vector<fe::Vec2i> &result)#
Simplifies a 2D polyline (contour) using the Douglas-Peucker algorithm.
Reduces the number of points in a curve composed of line segments, while keeping the simplified curve within a specified distance (epsilon) of the original.
- Parameters:
points – Input vector of 2D integer points representing the original contour.
epsilonSq – The square of the maximum distance (tolerance) allowed between the original curve and the simplified curve. Using squared distance avoids costly square root operations during comparisons.
result – Output vector where the simplified points will be stored. The vector will typically include the first and last points of the input segment. The vector is NOT cleared by this function; points are appended.
-
void simplifyContour(const std::vector<fe::Vec2i> &points, float epsilon, std::vector<fe::Vec2i> &result)#
Overload for douglasPeucker that handles the initial call and setup.
This version takes the full contour, adds the start and end points, and calls the recursive helper function. Assumes a closed contour, but works on open ones too.
- Parameters:
points – Input vector of 2D integer points representing the original contour.
epsilon – The maximum distance (tolerance) allowed. Will be squared internally.
result – Output vector where the simplified points will be stored. Cleared first.
-
bool generateEllipticalCylinderSegment(fe::gltf::Mesh &meshPart, const fe::Vec3f &bottomCenter, const fe::Vec3f &topCenter, float bottomRadiusX, float bottomRadiusZ, float topRadiusX, float topRadiusZ, int radialSegments, bool addBottomCap = false, bool addTopCap = false, bool generateUVs = true, std::optional<fe::Vec3f> uVecOverride = std::nullopt)#
Generates a single segment of a cylinder with potentially elliptical and tapered cross-sections.
Creates the wall and optionally top/bottom caps. UVs are generated for the wall (V along axis, U wraps). Cap UVs are planar.
- Parameters:
meshPart – fe::gltf::Mesh& The mesh part to add geometry to.
bottomCenter – const fe::Vec3f& Center of the bottom elliptical face.
topCenter – const fe::Vec3f& Center of the top elliptical face.
bottomRadiusX – float Radius of the bottom ellipse along its local X-axis (defined by u_vec).
bottomRadiusZ – float Radius of the bottom ellipse along its local Z-axis (defined by v_vec).
topRadiusX – float Radius of the top ellipse along its local X-axis.
topRadiusZ – float Radius of the top ellipse along its local Z-axis.
radialSegments – int Number of segments around the circumference. Must be >= 3.
addBottomCap – bool If true, a bottom cap will be generated.
addTopCap – bool If true, a top cap will be generated.
generateUVs – bool If true, UV coordinates (TEXCOORD_0) will be generated.
uVecOverride – std::optional<fe::Vec3f> Optional: provide a specific u_vec for orientation. If nullopt, it will be calculated.
- Returns:
bool True if geometry was successfully generated.
-
bool generateSegmentedCylinder(fe::gltf::Mesh &meshPart, const std::vector<CylinderSegment> &profilePoints, int radialSegments = 12, bool addBaseCap = false, bool addTipCap = false, bool generateUVs = false)#
Generates a segmented cylinder.
- Parameters:
meshPart – fe::gltf::Mesh& The mesh part to add a segmented cylinder to.
profilePoints – const std::vector<CylinderSegment>& A series of nodes defining the center, radii, and orientation along the filament’s length. Must have at least 2 points to form a segment.
radialSegments – int Number of segments around the circumference.
addBaseCap – bool If true, the very first segment gets a bottom cap.
addTipCap – bool If true, the very last segment gets a top cap.
generateUVs – bool If true, generate UVs.
- Returns:
bool True if geometry was successfully generated.
-
bool generateStigma(fe::gltf::Mesh &meshPart, const fe::CylinderSegment &filamentTopNode, const fe::FlowerParameters ¶ms, int radialSegments, bool generateUVs = false)#
Generates the stigma (tip of the pistil) based on the filament’s top dimensions.
- Parameters:
meshPart – fe::gltf::Mesh& The mesh part to add stigma geometry to.
filamentTopNode – const fe::CylinderSegment& The last node of the pistil filament, providing the connection point and initial radii for the stigma.
params – const fe::FlowerParameters& General geometry parameters for reference (e.g., for scaling factors).
radialSegments – int Number of segments around the circumference.
generateUVs – bool If true, generate UV coordinates.
- Returns:
bool True if geometry was successfully generated.
-
void generatePistil(fe::gltf::Scene &scene, const fe::Vec3f &position, const fe::FlowerParameters ¶ms, int pistil_filament_mat_idx, int pistil_stigma_max_idx, int pistilID)#
Generates a pistil structure and adds it to a GLTF scene.
- Parameters:
scene – A reference to the fe::gltf::Scene data where the generated pistil will be incorporated.
position – A 3D vector that specifies the position within the scene where the pistil should be generated.
params – Geometry parameters that dictate the design details such as shape, size, and resolution of the pistil.
pistil_filament_mat_idx – Material index for the filament, which defines its color and texture properties.
pistil_stigma_max_idx – Material index for the stigma, which determines its visual style.
pistilID – A unique identifier for the pistil instance, useful for tracking or referencing within the scene.
-
void generateStamen(fe::gltf::Scene &scene, const fe::Vec3f &position, const fe::FlowerParameters ¶ms, int stamen_filament_mat_idx, int stamen_anther_mat_idx, int stamenID)#
Generates a stamen structure and adds it to a GLTF scene.
- Parameters:
scene – Reference to the fe::gltf::Scene data where the generated stamen will be added.
position – A 3D vector specifying the position in the scene where the stamen should be generated.
params – Geometry parameters that dictate the size, shape, and resolution of the stamen parts.
stamen_filament_mat_idx – Material index for the filament (the stalk supporting the anther), determining its color and texture.
stamen_anther_mat_idx – Material index for the anther (the pollen-bearing part of the stamen), determining its color and texture.
stamenID – An identifier for the stamen, useful for tracking or referencing this particular instance.
-
void generateStem(fe::gltf::Scene &scene, const fe::FlowerParameters ¶ms, int stemMaterialIndex)#
Generates vertices, normals, and triangle indices for a cylindrical stem, creating a distinct GltfMeshPart for it.
Creates geometry for a cylinder oriented along the Y-axis, with closed top and bottom caps. Adds the generated GltfMeshPart to the provided GltfSceneData. Stem geometry typically uses a base color material and does not require texture coordinates.
- Parameters:
scene – fe::gltf::Scene& The fe::gltf::Scene object to add the new stem mesh part to.
params – const fe::FlowerParameters& The FlowerParameters struct containing stemHeight, stemRadius, and stemSegments.
stemMaterialIndex – int The index of the pre-defined stem material in scene.materials.
-
void generatePetalLayer(fe::gltf::Scene &scene, const std::vector<fe::Vec2i> &simplifiedContour, const fe::Image &petalLayerTexture, int layerIndex, const fe::Vec3f &position, const fe::FlowerParameters ¶ms)#
Generates vertices, normals, texcoords, and triangle indices for one petal layer, creating a distinct fe::gltf::Mesh for it with its own texture and material.
Creates the geometry based on the simplified contour, fixed inner radii, and other parameters. Adds the generated fe::gltf::Mesh to the provided fe::gltf::Scene.
- Parameters:
scene – fe::gltf::Scene& The GltfSceneData object to add the new petal mesh part to.
simplifiedContour – const std::vector<fe::Vec2i>& The vector of 2D points representing the simplified outer shape.
petalLayerTexture – const fe::Image& The raw image data for this specific petal layer’s texture.
layerIndex – int The index of the current layer (used for naming).
position – const fe::Vec3f& The position for this layer before offsets.
params – const fe::FlowerParameters& The FlowerParameters struct containing all petal shape and scale parameters.
-
float pointLineSegmentDistanceSq(const fe::Vec2i &p, const fe::Vec2i &a, const fe::Vec2i &b)#
Calculate the squared perpendicular distance from a point p to the line segment defined by a and b.
Calculate the projection of ap onto ab Parameter t = dot(ap, ab) / lengthSq(ab) This indicates where the projection falls relative to the segment t < 0: Projection is before point a t > 1: Projection is after point b 0 <= t <= 1: Projection is within the segment [a, b]
-
std::vector<double> extractFlowerFeatures(const std::string &genome, const fe::Environment &environment)#
builds a flower’s SOM feature vector: FlowerClassifier::inputDim values, a silhouetteSize x silhouetteSize silhouette (petals-only render, alpha channel, max-pool downsampled) followed by FlowerClassifier::statNames()’s fe::Stats fields normalized to fixed bounds, in that order.
Takes the genome as a string because fe::Stats is string-based: the string is passed to it unchanged and parsed once here for the render.
Note
weights that overflow the network (e.g. 1e999 in the JSON) give NaN values in the vector instead of an error; train()/classify() skip such a vector, so filter with std::isfinite if the vector is used directly.
- Parameters:
- Throws:
std::runtime_error – if genome is not parsable JSON.
std::invalid_argument – if the DNA has fewer than 2 genomes or doesn’t have enough usable outputs to render the silhouette and compute the stats.
- Returns:
std::vector<double> size FlowerClassifier::inputDim. A missing or malformed “petals” section is not an error: its fields fall back to the defaults, and radius/numLayers are clamped like fe::Petals does.
-
inline bool isBase64(unsigned char c)#
checks if is a base64 char
- Parameters:
c – unsigned char
- Returns:
bool
-
std::string encodeToBase64(const std::vector<std::uint8_t> &data)#
encodes an image to base64
- Parameters:
data – std::vector<std::uint8_t>&
- Returns:
std::string base64 image
-
std::vector<std::uint8_t> encodeImageToPngInMemory(const Image &image)#
Encodes raw image data into a PNG byte stream in memory.
- Parameters:
image – The Image object containing raw pixel data. expected RBGA
- Returns:
A std::vector<std::uint8_t> containing the PNG-encoded data. Returns an empty vector if encoding fails or the input image is invalid.
-
int getTimesDivisibleBy(int val, int divisor) noexcept#
Determines the number of times a number can be divided by a given divisor until it is <= 1.
- Parameters:
val – [in] The number to be divided.
divisor – [in] The divisor applied on each iteration.
- Returns:
The count of divisions performed until the value is ≤ 1.
-
void drawLayer(Petals &petals, EvoAI::Genome &g, int layer, bool applyLayeredRadiusScaling = true) noexcept#
will draw the layer of a petal,
- Parameters:
petals – [in] Petals
g – [in] a cppn EvoAI::Genome with 4 inputs 4 outputs
layer – [in] the layer to draw
applyLayeredRadiusScaling – [in] it will divide the radius / 2.0 from petals.numLayers to layer
-
void draw(Petals::Type t, Petals &petals, EvoAI::Genome &g) noexcept#
will draw what Petals::Type is
- Parameters:
t – [in] Petals::Type
petals – [in] Petals
g – [in] a cppn EvoAI::Genome with 4 inputs 4 outputs
-
SOMEvaluation evaluateSOM(const EvoAI::SelfOrganizingMap<> &som, const std::vector<std::vector<double>> &samples)#
measures how well a trained SOM fits
samples: mean quantization error and how the samples spread over the nodes. Mirrors tools/som_trainer/evaluation.py. Read both when judging convergence: the error can look flat while the load is still being redistributed over the nodes.Only depends on EvoAI::SelfOrganizingMap, not on flowers.
- Parameters:
som – [in] the trained map.
samples – [in] each of size som’s input dimension. Wrong-size or non-finite ones are counted in samplesSkipped, not an error.
- Throws:
std::invalid_argument – if no sample is usable (the mean would be undefined).
- Returns:
-
bool operator==(const Color &left, const Color &right)#
Overload of the == operator.
This operator compares two colors and check if they are equal.
- Parameters:
left – Left operand
right – Right operand
- Returns:
True if colors are equal, false if they are different
-
bool operator!=(const Color &left, const Color &right)#
Overload of the != operator.
This operator compares two colors and check if they are different.
- Parameters:
left – Left operand
right – Right operand
- Returns:
True if colors are different, false if they are equal
-
Color operator+(const Color &left, const Color &right)#
Overload of the binary + operator.
This operator returns the component-wise sum of two colors. Components that exceed 255 are clamped to 255.
- Parameters:
left – Left operand
right – Right operand
- Returns:
Result of left + right
-
Color operator-(const Color &left, const Color &right)#
Overload of the binary - operator.
This operator returns the component-wise subtraction of two colors. Components below 0 are clamped to 0.
- Parameters:
left – Left operand
right – Right operand
- Returns:
Result of left - right
-
Color operator*(const Color &left, const Color &right)#
Overload of the binary * operator.
This operator returns the component-wise multiplication (also called “modulation”) of two colors. Components are then divided by 255 so that the result is still in the range [0, 255].
- Parameters:
left – Left operand
right – Right operand
- Returns:
Result of left * right
-
Color &operator+=(Color &left, const Color &right)#
Overload of the binary += operator.
This operator computes the component-wise sum of two colors, and assigns the result to the left operand. Components that exceed 255 are clamped to 255.
- Parameters:
left – Left operand
right – Right operand
- Returns:
Reference to left
-
Color &operator-=(Color &left, const Color &right)#
Overload of the binary -= operator.
This operator computes the component-wise subtraction of two colors, and assigns the result to the left operand. Components below 0 are clamped to 0.
- Parameters:
left – Left operand
right – Right operand
- Returns:
Reference to left
-
Color &operator*=(Color &left, const Color &right)#
Overload of the binary *= operator.
This operator returns the component-wise multiplication (also called “modulation”) of two colors, and assigns the result to the left operand. Components are then divided by 255 so that the result is still in the range [0, 255].
- Parameters:
left – Left operand
right – Right operand
- Returns:
Reference to left
-
template<typename T>
bool operator==(const Rect<T> &left, const Rect<T> &right)# Overload of binary operator ==.
This operator compares strict equality between two rectangles.
- Parameters:
left – Left operand (a rectangle)
right – Right operand (a rectangle)
- Returns:
True if left is equal to right
-
template<typename T>
bool operator!=(const Rect<T> &left, const Rect<T> &right)# Overload of binary operator !=.
This operator compares strict difference between two rectangles.
- Parameters:
left – Left operand (a rectangle)
right – Right operand (a rectangle)
- Returns:
True if left is not equal to right
-
template<typename T>
Vector2<T> operator-(const Vector2<T> &right)# Overload of unary operator -.
- Parameters:
right – Vector to negate
- Returns:
Memberwise opposite of the vector
-
template<typename T>
Vector2<T> &operator+=(Vector2<T> &left, const Vector2<T> &right)# Overload of binary operator +=.
This operator performs a memberwise addition of both vectors, and assigns the result to left.
- Parameters:
left – Left operand (a vector)
right – Right operand (a vector)
- Returns:
Reference to left
-
template<typename T>
Vector2<T> &operator-=(Vector2<T> &left, const Vector2<T> &right)# Overload of binary operator -=.
This operator performs a memberwise subtraction of both vectors, and assigns the result to left.
- Parameters:
left – Left operand (a vector)
right – Right operand (a vector)
- Returns:
Reference to left
-
template<typename T>
Vector2<T> operator+(const Vector2<T> &left, const Vector2<T> &right)# Overload of binary operator +.
- Parameters:
left – Left operand (a vector)
right – Right operand (a vector)
- Returns:
Memberwise addition of both vectors
-
template<typename T>
Vector2<T> operator-(const Vector2<T> &left, const Vector2<T> &right)# Overload of binary operator -.
- Parameters:
left – Left operand (a vector)
right – Right operand (a vector)
- Returns:
Memberwise subtraction of both vectors
-
template<typename T>
Vector2<T> operator*(const Vector2<T> &left, T right)# Overload of binary operator *.
- Parameters:
left – Left operand (a vector)
right – Right operand (a scalar value)
- Returns:
Memberwise multiplication by right
-
template<typename T>
Vector2<T> operator*(T left, const Vector2<T> &right)# Overload of binary operator *.
- Parameters:
left – Left operand (a scalar value)
right – Right operand (a vector)
- Returns:
Memberwise multiplication by left
-
template<typename T>
Vector2<T> &operator*=(Vector2<T> &left, T right)# Overload of binary operator *=.
This operator performs a memberwise multiplication by right, and assigns the result to left.
- Parameters:
left – Left operand (a vector)
right – Right operand (a scalar value)
- Returns:
Reference to left
-
template<typename T>
Vector2<T> operator/(const Vector2<T> &left, T right)# Overload of binary operator /.
- Parameters:
left – Left operand (a vector)
right – Right operand (a scalar value)
- Returns:
Memberwise division by right
-
template<typename T>
Vector2<T> &operator/=(Vector2<T> &left, T right)# Overload of binary operator /=.
This operator performs a memberwise division by right, and assigns the result to left.
- Parameters:
left – Left operand (a vector)
right – Right operand (a scalar value)
- Returns:
Reference to left
-
struct FlowerParameters#
- #include <FlowerParameters.hpp>
creation parameters for 3d flowers
Public Functions
-
FlowerParameters() noexcept#
default constructor
-
FlowerParameters(JsonBox::Object o)#
deserializable constructor
- Parameters:
o – JsonBox::Object
-
JsonBox::Object toJson() const noexcept#
serializes the parameters
- Returns:
JsonBox::Object
Public Members
-
int sex#
-
bool useNormals#
-
bool useEmissive#
-
float stemHeight#
-
float stemRadius#
-
int stemSegments#
-
float pistilStyleHeight#
-
float pistilStyleRadius#
-
int pistilStigmaRadialSegments#
-
float pistilStigmaHeight#
-
float pistilStigmaMaxWidthFactor#
-
float pistilStigmaTipNarrowFactor#
-
int stamenCount#
-
int stamenFilamentRadialSegments#
-
float stamenFilamentHeight#
-
float stamenFilamentRadius#
-
int stamenAntherRadialSegments#
-
float stamenAntherHeight#
-
float petalScaleFactor#
-
float connectionRadiusPx#
-
float droopStartRadiusPx#
-
float peakHeightOffset#
-
float petalDroopFactor#
-
float layerVerticalSpacing#
-
float connectionVerticalOffset#
-
float contourSimplificationTolerance#
-
int alphaThreshold#
-
FlowerParameters() noexcept#
-
struct CylinderSegment#
- #include <meshGenerator.hpp>
storage for filament info.
Public Functions
-
template<typename T>
struct Vec3# - #include <Vec.hpp>
A templated 3D vector class for mathematical and geometric computations.
Provides basic operations for 3D vector manipulation, such as normalization and calculating vector length and length squared. It is templated to support various numerical types, such as
float,double, orint.- Template Parameters:
T – The type of the vector components (e.g., float, double, int).
Public Functions
-
Vec3()#
Default constructor initializes the vector to (0, 0, 0).
-
Vec3(T x_, T y_, T z_)#
Parameterized constructor initializes the vector with specific values.
- Parameters:
x_ – The x-component of the vector.
y_ – The y-component of the vector.
z_ – The z-component of the vector.
-
void normalize()#
Normalizes the vector to have a magnitude of 1.
If the vector is zero or its magnitude is very small, all components will be set to 0 to avoid division by zero.
-
T lengthSquared() const#
Computes the squared length of the vector.
- Returns:
The squared length of the vector.
-
T length() const#
Computes the actual length (magnitude) of the vector.
The length is calculated as the square root of the sum of the squares of the components:
sqrt(x*x + y*y + z*z).- Returns:
The length of the vector.
-
T dot(const Vec3<T> &other) const#
Computes the dot product of this vector with another vector.
- Parameters:
other – const Vec3<T>& The other vector.
- Returns:
The dot product (a scalar value).
-
struct Vec4f#
- #include <Vec.hpp>
simple vec4 for material colors
Public Functions
-
inline Vec4f(float _r, float _g, float _b, float _a)#
-
inline Vec4f(float _r, float _g, float _b, float _a)#
-
class Color#
- #include <Color.hpp>
Utility class for manipulating RGBA colors.
fe::Color is a simple color class composed of 4 components:
Red
Green
Blue
Alpha (opacity)
fe::Color color(255, 0, 0); // red color.r = 0; // make it black color.b = 128; // make it dark blue
The fourth component of colors, named “alpha”, represents the opacity of the color. A color with an alpha value of 255 will be fully opaque, while an alpha value of 0 will make a color fully transparent, whatever the value of the other components is.
The most common colors are already defined as static variables:
fe::Color black = fe::Color::Black; fe::Color white = fe::Color::White; fe::Color red = fe::Color::Red; fe::Color green = fe::Color::Green; fe::Color blue = fe::Color::Blue; fe::Color yellow = fe::Color::Yellow; fe::Color magenta = fe::Color::Magenta; fe::Color cyan = fe::Color::Cyan; fe::Color transparent = fe::Color::Transparent;
Colors can also be added and modulated (multiplied) using the overloaded operators + and *.
Public Functions
-
Color()#
Default constructor.
Constructs an opaque black color. It is equivalent to fe::Color(0, 0, 0, 255).
-
Color(Uint8 red, Uint8 green, Uint8 blue, Uint8 alpha = 255)#
Construct the color from its 4 RGBA components.
- Parameters:
red – Red component (in the range [0, 255])
green – Green component (in the range [0, 255])
blue – Blue component (in the range [0, 255])
alpha – Alpha (opacity) component (in the range [0, 255])
Public Members
Public Static Attributes
-
bool operator==(const Color &left, const Color &right)#
Overload of the == operator.
This operator compares two colors and check if they are equal.
- Parameters:
left – Left operand
right – Right operand
- Returns:
True if colors are equal, false if they are different
-
bool operator!=(const Color &left, const Color &right)#
Overload of the != operator.
This operator compares two colors and check if they are different.
- Parameters:
left – Left operand
right – Right operand
- Returns:
True if colors are different, false if they are equal
-
Color operator+(const Color &left, const Color &right)#
Overload of the binary + operator.
This operator returns the component-wise sum of two colors. Components that exceed 255 are clamped to 255.
- Parameters:
left – Left operand
right – Right operand
- Returns:
Result of left + right
-
Color operator-(const Color &left, const Color &right)#
Overload of the binary - operator.
This operator returns the component-wise subtraction of two colors. Components below 0 are clamped to 0.
- Parameters:
left – Left operand
right – Right operand
- Returns:
Result of left - right
-
Color operator*(const Color &left, const Color &right)#
Overload of the binary * operator.
This operator returns the component-wise multiplication (also called “modulation”) of two colors. Components are then divided by 255 so that the result is still in the range [0, 255].
- Parameters:
left – Left operand
right – Right operand
- Returns:
Result of left * right
-
Color &operator+=(Color &left, const Color &right)#
Overload of the binary += operator.
This operator computes the component-wise sum of two colors, and assigns the result to the left operand. Components that exceed 255 are clamped to 255.
- Parameters:
left – Left operand
right – Right operand
- Returns:
Reference to left
-
Color &operator-=(Color &left, const Color &right)#
Overload of the binary -= operator.
This operator computes the component-wise subtraction of two colors, and assigns the result to the left operand. Components below 0 are clamped to 0.
- Parameters:
left – Left operand
right – Right operand
- Returns:
Reference to left
-
Color &operator*=(Color &left, const Color &right)#
Overload of the binary *= operator.
This operator returns the component-wise multiplication (also called “modulation”) of two colors, and assigns the result to the left operand. Components are then divided by 255 so that the result is still in the range [0, 255].
- Parameters:
left – Left operand
right – Right operand
- Returns:
Reference to left
-
struct MutationRates#
- #include <DNA.hpp>
Mutation Rates.
Public Functions
-
MutationRates()#
default constructor default values
addNodeRate : 0.2
addConnRate : 0.3
removeConnRate : 0.2
perturbWeightsRate : 0.6
enableRate : 0.35
disableRate : 0.3
actTypeRate : 0.4
-
MutationRates(float addNodeRate, float addConnRate, float removeConnRate, float perturbWeightsRate, float enableRate, float disableRate, float actTypeRate)#
constructor with all the parameters
- Parameters:
addNodeRate – [in] rate to add nodes
addConnRate – [in] rate to add connections
removeConnRate – [in] rate to remove connections
perturbWeightsRate – [in] rate to change weights of a connection
enableRate – [in] rate to enable a dormant gene
disableRate – [in] rate to disable a enabled gene
actTypeRate – [in] rate to change activation function of a neuronGene
-
MutationRates(JsonBox::Object o)#
load a JsonBox::Object
- Parameters:
o – [in] JsonBox::Object
-
JsonBox::Value toJson() const noexcept#
converts to JsonBox::Value
- Returns:
JsonBox::Value
-
MutationRates()#
-
class DNA#
- #include <DNA.hpp>
DNA Component.
Public Functions
-
DNA()#
default constructor
-
DNA(JsonBox::Object o)#
load a JsonBox::Object containing a DNA
- Parameters:
o – [in] JsonBox::Object
-
JsonBox::Value toJson() const noexcept#
converts to JsonBox::Value
- Returns:
JsonBox::Value
-
DNA(std::vector<EvoAI::Genome> &&g)#
transfer a std::vector of genomes
- Parameters:
g – [in] std::vector<EvoAI::Genome>&&
-
void setFitness(double fit) noexcept#
sets the same fitness for all the genomes in DNA
- Parameters:
fit – [in] double fitness
-
double getFitness() noexcept#
gets fitness from genome[0]
- Returns:
double if genomes is empty returns 0.0d
-
DNA &add(const EvoAI::Genome &g) noexcept#
adds a Genome
- Parameters:
g – const EvoAI::Genome&
- Returns:
DNA&
-
bool remove(EvoAI::Genome *g) noexcept#
removes a EvoAI::Genome from DNA.
- Parameters:
g – [in] EvoAI::Genome* genome to remove
- Returns:
bool true if removed
-
void mutate(const MutationRates &mr) noexcept#
mutates all genomes
- Parameters:
mr – [in] Mutation Rates
-
std::size_t size() const noexcept#
get number of genomes
- Returns:
std::size_t number of genomes
-
~DNA() = default#
-
void operator=(const DNA &rhs) noexcept#
clears the DNA and copies the other
- Parameters:
rhs – [in] const DNA&
-
EvoAI::Genome &operator[](const std::size_t &index) noexcept#
direct access to genomes
- Parameters:
index – [in] std::size_t
- Returns:
EvoAI::Genome&
-
const EvoAI::Genome &operator[](const std::size_t &index) const noexcept#
direct access to genomes
- Parameters:
index – [in] std::size_t
- Returns:
const EvoAI::Genome&
-
DNA()#
-
struct Environment#
- #include <Environment.hpp>
the environment (humidity/temperature/altitude/terrainType) that fe::Stats is computed against.
A classifier’s JSON stores it only as a record of what it was trained under; it is not checked at classify time because the game varies the environment per flower on purpose.
humidityis only required to be finite: NaN would flow through fe::Stats into every feature that depends on it and poison a whole SOM from one sample.Public Functions
-
Environment() noexcept#
default constructor
-
Environment(float humidity, int temperature, int altitude, int terrainType)#
constructor with all the parameters
- Parameters:
humidity – [in] float 0.0 to 1.0 by convention, not enforced; must be finite
temperature – [in] int temperature
altitude – [in] int meters above sea
terrainType – [in] int terrain type
- Throws:
std::invalid_argument – if humidity is NaN or infinite.
-
explicit Environment(JsonBox::Object o)#
loads a JsonBox::Object
- Parameters:
o – [in] JsonBox::Object
- Throws:
std::invalid_argument – if humidity is present and NaN/infinite.
-
void validate() const#
the fields are public, so a value that was valid at construction can be changed afterwards; the code that consumes an environment calls this again.
- Throws:
std::invalid_argument – if humidity is NaN or infinite.
-
JsonBox::Value toJson() const noexcept#
converts to JsonBox::Value
- Returns:
JsonBox::Value
-
Environment() noexcept#
-
struct Flower#
- #include <Flower.hpp>
Flower struct.
Public Functions
-
Flower()#
default constructor
-
Flower(const fe::Vector2f &pos, int radius, int numLayers, float P, float bias)#
constructor to use when creating a random flower.
- Parameters:
pos – [in] position
radius – [in] radius
numLayers – [in] number of layers
P – [in] P
bias – [in] bias
-
Flower(const fe::Vector2f &pos, int radius, int numLayers, float P, float bias, const Petals::Type &type)#
constructor to use when creating a random flower.
- Parameters:
pos – [in] position
radius – [in] radius
numLayers – [in] number of layers
P – [in] P
bias – [in] bias
type – [in] Petals::Type
-
Flower(const fe::Vector2f &pos, int radius, int numLayers, float P, float bias, DNA &&dna)#
constructor to use when creating a child flower.
- Parameters:
pos – [in] position
radius – [in] radius
numLayers – [in] number of layers
P – [in] P
bias – [in] bias
dna – [in] fe::DNA to use to make this flower
-
Flower(const fe::Vector2f &pos, int radius, int numLayers, float P, float bias, DNA &&dna, const Petals::Type &type)#
constructor to use when creating a child flower.
- Parameters:
pos – [in] position
radius – [in] radius
numLayers – [in] number of layers
P – [in] P
bias – [in] bias
dna – [in] fe::DNA to use to make this flower
type – [in] Petals::Type
-
Flower(JsonBox::Object o)#
load a JsonBox::Object with [“Flower”]
- Parameters:
o – [in] JsonBox::Object
-
Flower()#
-
struct SpeciesMatch#
- #include <FlowerClassifier.hpp>
where a flower lands on a classifier’s grid: its species and how typical it is of it.
Public Members
-
std::size_t x = 0u#
column of the best matching unit on the SOM grid.
-
std::size_t y = 0u#
row of the best matching unit on the SOM grid.
-
double distance = 0.0#
distance from the flower’s feature vector to the species’ prototype (euclidean over the vector’s 267 values): 0 for a flower identical to the prototype, the larger the more atypical of its species. There is no absolute scale, compare it with the distances of other flowers.
-
std::size_t x = 0u#
-
struct FlowerClassifier#
- #include <FlowerClassifier.hpp>
a SOM species classifier: the trained EvoAI::SelfOrganizingMap<> plus the fe::Environment it was trained under (a record only, see fe::Environment).
Public Functions
-
FlowerClassifier(std::size_t width, std::size_t height, fe::Environment environment)#
fresh, untrained classifier of the given grid size, see train().
- Parameters:
width – [in] grid width, must be > 0
height – [in] grid height, must be > 0
environment – [in] a record only, see fe::Environment.
- Throws:
std::invalid_argument – if width or height is 0 (see EvoAI::SelfOrganizingMap).
-
explicit FlowerClassifier(JsonBox::Object o)#
loads a classifier saved with toJson().
- Parameters:
o – [in] JsonBox::Object
- Throws:
std::invalid_argument – if malformed (see EvoAI::SelfOrganizingMap(JsonBox::Object)), or if its input dimension doesn’t match FlowerClassifier::inputDim (trained with a different feature layout); it would otherwise load and then crash or match meaninglessly in classify().
-
std::optional<SpeciesMatch> classify(const std::string &genome, const fe::Environment &environment) const#
classifies a single flower from its genome string. Does extractFlowerFeatures() and the SOM lookup in one call.
- Parameters:
genome – [in] “{”Flower”: {“dna”: …, “petals”: …}}”
environment – [in] used for this flower’s fe::Stats. Not required or expected to match this.environment – see fe::Environment.
- Returns:
std::optional<SpeciesMatch> the best matching unit on the SOM grid and the distance to it, or empty if genome is malformed or its DNA is unusable.
-
std::optional<SpeciesMatch> classify(const fe::Flower &flower, const fe::Environment &environment) const#
classifies an already-built flower, for a native caller that holds a fe::Flower instead of its genome string. Delegates to the string overload; flower.petals.image is not reused because it was drawn with the trunk for display, not the petals-only render the classifier was trained on.
- Parameters:
flower – [in] the flower to classify.
environment – [in] used for this flower’s fe::Stats.
- Returns:
see the string overload.
-
std::optional<SpeciesMatch> classifyFeatures(const std::vector<double> &features) const#
classifies an already-extracted feature vector, see extractFlowerFeatures().
- Parameters:
features – [in] a vector of inputDim finite values.
- Returns:
std::optional<SpeciesMatch> empty if the vector has the wrong size or a value that is not finite.
-
SOMTrainingReport train(const std::vector<std::vector<double>> &samples, std::size_t epochs, double baseLR, double baseRadius, std::size_t epochOffset = 0, std::size_t totalEpochs = 0, const SOMEpochCallback &onEpoch = {})#
trains this classifier in place on already-extracted feature vectors (see extractFlowerFeatures()). Fine-tuning a trained classifier is the same call. Every binding delegates here, so this is the only place the decay schedule lives.
Learning rate and radius both decay exponentially from their base value to a fixed floor (0.01 and 0.5) over
totalEpochs.One decay can be split across several calls (progress reporting, a time budget): pass the same baseLR/baseRadius/totalEpochs each time and advance epochOffset by the epochs already done. The decay then matches a single call; the weights only match to rounding, and only when sample order does not matter (e.g. one sample), because each call reshuffles. A call without them starts a new decay at its own epoch 0, which is what fine-tuning on a new batch wants.
- Parameters:
samples – [in] each of size FlowerClassifier::inputDim. Unusable ones (wrong size, non-finite) are skipped; their indices are in the report.
epochs – [in] epochs to run in this call; 0 trains nothing.
baseLR – [in] learning rate at the start of the whole decay; finite and > 0.
baseRadius – [in] neighborhood radius at the start of the whole decay; finite and > 0.
epochOffset – [in] epochs of the decay already done by earlier calls.
totalEpochs – [in] epochs of the whole decay; 0 means epochOffset + epochs (this call is the last one, or the only one).
onEpoch – [in] called after every epoch with what it did, to report progress or to stop: returning false stops after that epoch (the epoch is in the report). An exception it throws stops the training and reaches the caller, the classifier keeps the epochs already done.
- Throws:
std::invalid_argument – if baseLR or baseRadius is not finite and > 0, if epochOffset + epochs doesn’t fit in totalEpochs, or if no sample is usable (samples empty or all skipped); the weights are left unchanged.
- Returns:
SOMTrainingReport one entry per epoch that ran, the indices of the skipped samples (always fewer than samples.size()) and the wins per node of the last epoch.
-
SOMEvaluation evaluate(const std::vector<std::vector<double>> &samples) const#
converts to JsonBox::Value.
measures how well this classifier fits
samples, see fe::evaluateSOM().- Parameters:
samples – [in] each of size FlowerClassifier::inputDim, see fe::extractFlowerFeatures(). Wrong-size or non-finite ones are counted in samplesSkipped, not an error.
- Throws:
std::invalid_argument – if no sample is usable (the mean would be undefined).
- Returns:
JsonBox::Value
- Returns:
-
JsonBox::Value toJson() const noexcept#
Public Static Functions
Public Static Attributes
-
static constexpr std::size_t silhouetteSize = 16#
side of the square silhouette in the feature vector.
-
static constexpr std::size_t inputDim = (silhouetteSize * silhouetteSize) + 11#
the length every feature vector passed to train()/classify() must have: the silhouette plus 11 normalized fe::Stats values. Fixed, since a classifier trained on one layout can’t classify another.
-
FlowerClassifier(std::size_t width, std::size_t height, fe::Environment environment)#
-
struct Image#
- #include <Image.hpp>
simple Image to replace the one from sfml for emscripten.
Public Functions
-
Image() noexcept#
default constructor
-
void create(std::size_t width, std::size_t height, const fe::Color &color) noexcept#
allocates the memory needed for the image
- Parameters:
width – std::size_t width of the image
height – std::size_t height of the image
color – default color to set
-
void setPixel(const fe::Vector2f &pos, const fe::Color &color) noexcept#
sets the pixel color
- Parameters:
pos – const fe::Vector2f& position
color – const fe::Color& color
-
Image() noexcept#
-
struct Petals#
- #include <Petals.hpp>
Petals component.
Petals p(64,3,6.0,1.0); // genome is a CPPN and has 4 inputs and 4 outputs draw(Petals::Type::TrunkAndPetals, p, genomes[index]);
Public Types
Public Functions
-
Petals() noexcept#
Default constructor.
-
Petals(int r, int nLayers, float P, float bias)#
constructor
- Parameters:
r – int radius in pixels
nLayers – int number of Layers
P – float parameter for NN
bias – flat bias for NN
-
Petals(JsonBox::Object o)#
load JsonBox::Object
- Parameters:
o – JsonBox::Object
-
JsonBox::Value toJson() const noexcept#
converts the object to JsonBox::Value
- Returns:
JsonBox::Value
-
Petals() noexcept#
-
template<typename T>
class Rect# - #include <Rect.hpp>
Utility class for manipulating 2D axis aligned rectangles.
A rectangle is defined by its top-left corner and its size. It is a very simple class defined for convenience, so its member variables (left, top, width and height) are public and can be accessed directly, just like the vector classes (Vector2 and Vector3).
To keep things simple, fe::Rect doesn’t define functions to emulate the properties that are not directly members (such as right, bottom, center, etc.), it rather only provides intersection functions.
fe::Rect uses the usual rules for its boundaries:
The left and top edges are included in the rectangle’s area
The right (left + width) and bottom (top + height) edges are excluded from the rectangle’s area
fe::Rect is a template and may be used with any numeric type, but for simplicity the instantiations used by SFML are typedef’d:
So that you don’t have to care about the template syntax.Usage example:
// Define a rectangle, located at (0, 0) with a size of 20x5 fe::IntRect r1(0, 0, 20, 5); // Define another rectangle, located at (4, 2) with a size of 18x10 fe::Vector2i position(4, 2); fe::Vector2i size(18, 10); fe::IntRect r2(position, size); // Test intersections with the point (3, 1) bool b1 = r1.contains(3, 1); // true bool b2 = r2.contains(3, 1); // false // Test the intersection between r1 and r2 fe::IntRect result; bool b3 = r1.intersects(r2, result); // true // result == (4, 2, 16, 3)
Public Functions
-
Rect()#
Default constructor.
Creates an empty rectangle (it is equivalent to calling Rect(0, 0, 0, 0)).
-
Rect(T rectLeft, T rectTop, T rectWidth, T rectHeight)#
Construct the rectangle from its coordinates.
Be careful, the last two parameters are the width and height, not the right and bottom coordinates!
- Parameters:
rectLeft – Left coordinate of the rectangle
rectTop – Top coordinate of the rectangle
rectWidth – Width of the rectangle
rectHeight – Height of the rectangle
-
Rect(const Vector2<T> &position, const Vector2<T> &size)#
Construct the rectangle from position and size.
Be careful, the last parameter is the size, not the bottom-right corner!
- Parameters:
position – Position of the top-left corner of the rectangle
size – Size of the rectangle
-
template<typename U>
explicit Rect(const Rect<U> &rectangle)# Construct the rectangle from another type of rectangle.
This constructor doesn’t replace the copy constructor, it’s called only when U != T. A call to this constructor will fail to compile if U is not convertible to T.
- Parameters:
rectangle – Rectangle to convert
-
bool contains(T x, T y) const#
Check if a point is inside the rectangle’s area.
This check is non-inclusive. If the point lies on the edge of the rectangle, this function will return false.
See also
- Parameters:
x – X coordinate of the point to test
y – Y coordinate of the point to test
- Returns:
True if the point is inside, false otherwise
-
bool contains(const Vector2<T> &point) const#
Check if a point is inside the rectangle’s area.
This check is non-inclusive. If the point lies on the edge of the rectangle, this function will return false.
See also
- Parameters:
point – Point to test
- Returns:
True if the point is inside, false otherwise
-
bool intersects(const Rect<T> &rectangle) const#
Check the intersection between two rectangles.
See also
- Parameters:
rectangle – Rectangle to test
- Returns:
True if rectangles overlap, false otherwise
-
bool intersects(const Rect<T> &rectangle, Rect<T> &intersection) const#
Check the intersection between two rectangles.
This overload returns the overlapped rectangle in the intersection parameter.
See also
- Parameters:
rectangle – Rectangle to test
intersection – Rectangle to be filled with the intersection
- Returns:
True if rectangles overlap, false otherwise
-
fe::Vector2<T> getPosition() const#
Get the position of the rectangle’s top-left corner.
See also
- Returns:
Position of rectangle
Public Members
-
template<typename T>
bool operator==(const Rect<T> &left, const Rect<T> &right)# Overload of binary operator ==.
This operator compares strict equality between two rectangles.
- Parameters:
left – Left operand (a rectangle)
right – Right operand (a rectangle)
- Returns:
True if left is equal to right
-
template<typename T>
bool operator!=(const Rect<T> &left, const Rect<T> &right)# Overload of binary operator !=.
This operator compares strict difference between two rectangles.
- Parameters:
left – Left operand (a rectangle)
right – Right operand (a rectangle)
- Returns:
True if left is not equal to right
-
struct SOMEvaluation#
- #include <SOMEvaluation.hpp>
how well a trained SOM fits a set of samples, see fe::evaluateSOM() and fe::FlowerClassifier::evaluate().
Public Functions
-
JsonBox::Value toJson() const noexcept#
converts to JsonBox::Value, nodeCounts as a flat array.
- Returns:
JsonBox::Value
Public Members
-
double meanQuantizationError = 0.0#
mean Euclidean distance from each usable sample to its BMU’s prototype.
-
std::size_t samplesUsed = 0#
usable samples, i.e. those the classifier could classify.
-
std::size_t samplesSkipped = 0#
samples that were skipped (wrong size / non-finite values).
-
std::size_t totalNodes = 0#
-
std::size_t usedNodes = 0#
nodes that are the BMU of at least one sample.
-
double fractionUsed = 0.0#
-
std::size_t busiestNodeCount = 0#
sample count of the most crowded node.
-
double samplesPerNodeMean = 0.0#
-
std::vector<std::size_t> nodeCounts#
how many samples landed on each node, row-major: index = y * width + x.
-
JsonBox::Value toJson() const noexcept#
-
struct SOMTrainingConfig#
- #include <SOMTrainingConfig.hpp>
SOM grid size and training hyperparameters.
JSON-serializable so a training pipeline can carry it across calls or messages. The defaults are placeholders, not tuned.
Public Functions
-
SOMTrainingConfig() noexcept = default#
default constructor, see the defaults below.
-
SOMTrainingConfig(std::size_t width, std::size_t height, std::size_t epochs, double baseLR, double baseRadius)#
constructor with all the parameters
- Throws:
std::invalid_argument – if width/height/epochs == 0, or baseLR/baseRadius <= 0.
-
explicit SOMTrainingConfig(JsonBox::Object o)#
loads a JsonBox::Object. A missing field uses its default; a present but invalid one (<= 0 where > 0 is required) throws instead of falling back to the default.
- Parameters:
o – [in] JsonBox::Object
- Throws:
std::invalid_argument – per the above.
-
void validate() const#
the fields are public, so a value that was valid at construction can be changed afterwards; the code that consumes a config calls this again.
- Throws:
std::invalid_argument – if width/height/epochs == 0, or baseLR/baseRadius is not finite and > 0.
-
JsonBox::Value toJson() const noexcept#
converts to JsonBox::Value
- Returns:
JsonBox::Value
-
SOMTrainingConfig() noexcept = default#
-
struct SOMEpoch#
- #include <SOMTrainingReport.hpp>
what one epoch of fe::FlowerClassifier::train() did.
Public Members
-
std::size_t epoch = 0#
index of the epoch in the whole decay (the epochOffset of the call plus the epochs before it in the call).
-
double learningRate = 0.0#
learning rate used in this epoch.
-
double radius = 0.0#
neighborhood radius used in this epoch, in grid cells.
-
double meanDistance = 0.0#
mean distance from each sample to its species’ prototype while the epoch ran. It is free, but the prototypes move during the epoch, so it differs a little from what fe::FlowerClassifier::evaluate() measures afterwards (fe::SOMEvaluation::meanQuantizationError).
-
std::size_t epoch = 0#
-
struct SOMTrainingReport#
- #include <SOMTrainingReport.hpp>
what fe::FlowerClassifier::train() did.
-
struct Stats#
- #include <Stats.hpp>
storage class for stats
Public Functions
-
Stats(const std::string &genome, float humidity, int temperature, int altitude, int terrainType)#
constructor to build stats from the flower genome.
- Parameters:
genome – const std::string& stringified flower.json
humidity – float 0.0 to 1.0
temperature – int temperature
altitude – int meters above sea
terrainType – int terrain type
-
JsonBox::Object toJson() const noexcept#
convert to json
- Returns:
JsonBox::Object
-
Stats(const std::string &genome, float humidity, int temperature, int altitude, int terrainType)#
-
template<typename T>
class Vector2# - #include <Vector2.hpp>
Utility template class for manipulating 2-dimensional vectors.
fe::Vector2 is a simple class that defines a mathematical vector with two coordinates (x and y). It can be used to represent anything that has two dimensions: a size, a point, a velocity, etc.
The template parameter T is the type of the coordinates. It can be any type that supports arithmetic operations (+, -, /, *) and comparisons (==, !=), for example int or float.
You generally don’t have to care about the templated form (fe::Vector2<T>), the most common specializations have special typedefs:
Usage example:
fe::Vector2f v1(16.5f, 24.f); v1.x = 18.2f; float y = v1.y; fe::Vector2f v2 = v1 * 5.f; fe::Vector2f v3; v3 = v1 + v2; bool different = (v2 != v3);
Note: for 3-dimensional vectors, see fe::Vector3.
Public Functions
-
Vector2()#
Default constructor.
Creates a Vector2(0, 0).
-
Vector2(T X, T Y)#
Construct the vector from its coordinates.
- Parameters:
X – X coordinate
Y – Y coordinate
-
template<typename U>
explicit Vector2(const Vector2<U> &vector)# Construct the vector from another type of vector.
This constructor doesn’t replace the copy constructor, it’s called only when U != T. A call to this constructor will fail to compile if U is not convertible to T.
- Parameters:
vector – Vector to convert
-
template<typename T>
Vector2<T> operator-(const Vector2<T> &right)# Overload of unary operator -.
- Parameters:
right – Vector to negate
- Returns:
Memberwise opposite of the vector
-
template<typename T>
Vector2<T> &operator+=(Vector2<T> &left, const Vector2<T> &right)# Overload of binary operator +=.
This operator performs a memberwise addition of both vectors, and assigns the result to left.
- Parameters:
left – Left operand (a vector)
right – Right operand (a vector)
- Returns:
Reference to left
-
template<typename T>
Vector2<T> &operator-=(Vector2<T> &left, const Vector2<T> &right)# Overload of binary operator -=.
This operator performs a memberwise subtraction of both vectors, and assigns the result to left.
- Parameters:
left – Left operand (a vector)
right – Right operand (a vector)
- Returns:
Reference to left
-
template<typename T>
Vector2<T> operator+(const Vector2<T> &left, const Vector2<T> &right)# Overload of binary operator +.
- Parameters:
left – Left operand (a vector)
right – Right operand (a vector)
- Returns:
Memberwise addition of both vectors
-
template<typename T>
Vector2<T> operator-(const Vector2<T> &left, const Vector2<T> &right)# Overload of binary operator -.
- Parameters:
left – Left operand (a vector)
right – Right operand (a vector)
- Returns:
Memberwise subtraction of both vectors
-
template<typename T>
Vector2<T> operator*(const Vector2<T> &left, T right)# Overload of binary operator *.
- Parameters:
left – Left operand (a vector)
right – Right operand (a scalar value)
- Returns:
Memberwise multiplication by right
-
template<typename T>
Vector2<T> operator*(T left, const Vector2<T> &right)# Overload of binary operator *.
- Parameters:
left – Left operand (a scalar value)
right – Right operand (a vector)
- Returns:
Memberwise multiplication by left
-
template<typename T>
Vector2<T> &operator*=(Vector2<T> &left, T right)# Overload of binary operator *=.
This operator performs a memberwise multiplication by right, and assigns the result to left.
- Parameters:
left – Left operand (a vector)
right – Right operand (a scalar value)
- Returns:
Reference to left
-
template<typename T>
Vector2<T> operator/(const Vector2<T> &left, T right)# Overload of binary operator /.
- Parameters:
left – Left operand (a vector)
right – Right operand (a scalar value)
- Returns:
Memberwise division by right
-
template<typename T>
Vector2<T> &operator/=(Vector2<T> &left, T right)# Overload of binary operator /=.
This operator performs a memberwise division by right, and assigns the result to left.
- Parameters:
left – Left operand (a vector)
right – Right operand (a scalar value)
- Returns:
Reference to left
-
namespace gltf#
Functions
-
JsonBox::Value toJson(const fe::gltf::Scene &scene, const fe::FlowerParameters ¶ms)#
converts a fe::gltf::Scene to a glTF 2.0 JSON from the provided scene.
Serializes the scene’s mesh parts, materials, and textures into a glTF asset with embedded Base64 binary data for geometry and images.
- Parameters:
scene – const fe::gltf::Scene& The populated fe::gltf::Scene object.
params – const fe::FlowerParameters& The FlowerParameters used for generation (can be used for glTF extras).
- Returns:
A JsonBox::Value containing the glTF JSON.
-
std::string toJsonStr(const JsonBox::Value &json)#
converts a JsonBox::Value to a std::string.
- Parameters:
json – const JsonBox::Value&
- Returns:
A std::string containing the glTF stringified json.
-
struct KHR_MaterialsTransmission#
- #include <Material.hpp>
KHR_MaterialsTransmission extension properties.
-
struct KHR_MaterialsVolume#
- #include <Material.hpp>
KHR_MaterialsVolume extension properties.
-
struct KHR_MaterialsIOR#
- #include <Material.hpp>
KHR_MaterialsIOR extension properties.
Public Members
-
float ior = 1.0f#
-
float ior = 1.0f#
-
struct KHR_MaterialsEmissiveStrength#
- #include <Material.hpp>
KHR_MaterialsEmissiveStrength extension properties.
Public Members
-
float emissiveStrength = 1.0f#
-
float emissiveStrength = 1.0f#
-
struct KHR_MaterialsClearcoat#
- #include <Material.hpp>
KHR_MaterialsClearcoat extension properties.
-
struct Material#
- #include <Material.hpp>
Defines material properties for rendering.
Public Functions
-
Material() = default#
Default constructor.
Public Members
-
std::string name#
-
std::optional<int> baseColorTextureIndex#
-
float metallicFactor = 0.0f#
-
float roughnessFactor = 0.5f#
-
std::optional<int> metallicRoughnessTextureIndex#
-
std::optional<int> normalTextureIndex#
-
std::optional<float> normalTextureScale = 1.0f#
-
std::optional<int> occlusionTextureIndex#
-
std::optional<float> occlusionTextureStrength = 1.0f#
-
std::optional<int> emissiveTextureIndex#
-
bool doubleSided = false#
-
std::string alphaMode = "OPAQUE"#
-
float alphaCutoff = 0.5f#
-
std::optional<KHR_MaterialsTransmission> khrMaterialsTransmission#
-
std::optional<KHR_MaterialsClearcoat> khrMaterialsClearcoat#
-
std::optional<KHR_MaterialsVolume> khrMaterialsVolume#
-
std::optional<KHR_MaterialsIOR> khrMaterialsIOR#
-
std::optional<KHR_MaterialsEmissiveStrength> khrMaterialsEmissiveStrength#
Public Static Functions
-
static Material createStemMaterial()#
Creates a default stem material.
- Returns:
A Material configured for a stem.
-
static Material createPistilStyleMaterial()#
creates a default Pistil style Material
- Returns:
A Material configured for a Pistil style.
-
static Material createPistilStigmaMaterial(int normal_tex_idx)#
creates a default Pistil stigma material
- Parameters:
normal_tex_idx – The index of the normal texture for the Stigma.
- Returns:
A Material configured for Pistil Stigma.
-
static Material createStamenFilamentMaterial()#
creates a default Stamen filament material
- Returns:
A Material configured for Stamen Filament.
-
static Material createStamenAntherMaterial(int normal_tex_idx)#
creates a default Stamen anther material
- Parameters:
normal_tex_idx – The index of the normal texture for the Anther.
- Returns:
A Material configured for Stamen Anther.
-
static Material createPetalMaterial(const std::string &petal_name, int texture_idx, int normal_idx, int emissive_idx)#
Creates a default petal material.
- Parameters:
petal_name – const std::string& The name for the petal material.
texture_idx – int The index of the base color texture for this petal.
normal_idx – int the index of the normal texture for this petal.
emissive_idx – int the index of the emissive texture for this petal.
- Returns:
A Material configured for a petal.
-
Material() = default#
-
struct Mesh#
- #include <Mesh.hpp>
Represents a distinct geometric part of the model.
It contains its own vertices, indices, and a reference to a material. Internally, this will correspond to a glTF
meshwith a single glTFprimitive.Public Functions
-
Mesh() noexcept#
default constructor
-
Mesh(int meshIndex, const std::string &name) noexcept#
constructor
- Parameters:
meshIndex – int index inside the scene
name – const std::string& name for the mesh
-
unsigned int addVertex(const Vertex &vertex)#
Adds a vertex to this mesh part and updates bounds.
- Parameters:
vertex – The fe::gltf::Vertex to add.
- Returns:
The 0-based index of the added vertex within this part’s
verticesvector.
-
void addTriangle(unsigned int idx0, unsigned int idx1, unsigned int idx2)#
Adds a triangle to this mesh part. Assumes vertices are already added via
addVertexand indices are relative to this part.- Parameters:
idx0 – Index of the first vertex of the triangle.
idx1 – Index of the second vertex of the triangle.
idx2 – Index of the third vertex of the triangle.
Public Members
-
std::string name#
-
std::vector<unsigned int> indices#
-
int materialIndex = -1#
-
int index = -1#
-
fe::Vec3f minBounds = {std::numeric_limits<float>::max(), std::numeric_limits<float>::max(), std::numeric_limits<float>::max()}#
-
fe::Vec3f maxBounds = {std::numeric_limits<float>::lowest(), std::numeric_limits<float>::lowest(), std::numeric_limits<float>::lowest()}#
-
bool hasNormals = false#
-
bool hasTexCoords0 = false#
-
Mesh() noexcept#
-
struct Node#
- #include <Node.hpp>
Node.
Public Functions
-
Node() noexcept#
default constructor
Public Members
-
std::optional<std::string> name#
-
std::optional<std::vector<double>> children#
-
std::optional<JsonBox::Object> extra#
-
std::optional<double> mesh#
Public Static Functions
-
static Node makeGroup(const std::string &name, const std::vector<int> &children) noexcept#
it makes a group of nodes
- Parameters:
name – const std::string& name for the node group
children – const std::vector<int>&
- Returns:
-
static Node makeNode(const std::string &name, const Mesh &mesh) noexcept#
it adds a mesh node
- Parameters:
name – const std::string& name for the mesh node
mesh – const fe::gltf::Mesh& mesh to get the index from.
- Returns:
-
Node() noexcept#
-
struct Scene#
- #include <Scene.hpp>
Top-level data structure for a glTF scene, typically representing a flower model.
Public Functions
-
explicit Scene(const std::string &id)#
Constructor.
- Parameters:
id – The model identifier.
-
int addTexture(const TextureInfo &textureInfo)#
Adds a texture to the scene’s texture list.
- Parameters:
textureInfo – The fe::gltf::textureInfo object describing the texture.
- Returns:
The 0-based index of the added texture in the
texturesvector.
-
int addMaterial(const Material &material)#
Adds a material to the scene’s material list.
- Parameters:
material – The fe::gltf::Material object describing the material.
- Returns:
The 0-based index of the added material in the
materialsvector.
-
Mesh &addMeshPart(const Mesh &part)#
Adds a mesh part to the scene.
Warning
do not add or create another mesh until you are done with the current one.
- Parameters:
part – The fe::gltf::Mesh to add.
- Returns:
A reference to the added GltfMeshPart within the
meshPartsvector. This can be useful if further modifications are needed after adding.
-
Mesh &createMeshPart(const std::string &name)#
Creates and adds a new mesh part to the scene, returning a reference to it.
Warning
do not add or create another mesh until you are done with the current one.
- Parameters:
name – The name for the new mesh part.
- Returns:
A reference to the newly created Mesh.
-
explicit Scene(const std::string &id)#
-
struct TextureInfo#
- #include <TextureInfo.hpp>
Stores information about a texture image to be used in glTF. Can hold raw image data for processing or the final Base64 URI.
Public Functions
-
TextureInfo(const std::string &tex_name, const std::string &base64_data_uri)#
Constructor for an embedded Base64 texture.
- Parameters:
tex_name – The name of the texture.
base64_data_uri – The full “data:image/png;base64,…” string.
Public Static Functions
-
static TextureInfo createFromImage(const std::string &tex_name, const fe::Image &raw_image)#
Static helper to create fe::gltf::TextureInfo by processing an fe::Image.
- Parameters:
tex_name – The name of the texture.
raw_image – The fe::Image object containing raw pixel data.
- Returns:
TextureInfo with the URI field populated.
-
TextureInfo(const std::string &tex_name, const std::string &base64_data_uri)#
-
struct Vertex#
- #include <Vertex.hpp>
Represents a single vertex with all its geometric attributes for glTF.
Public Functions
-
Vertex() = default#
Default constructor.
-
explicit Vertex(const fe::Vec3f &pos)#
Constructor with position.
- Parameters:
pos – The vertex position.
-
Vertex() = default#
-
JsonBox::Value toJson(const fe::gltf::Scene &scene, const fe::FlowerParameters ¶ms)#
-
namespace resources#
Variables
-
const std::string anther_normal_texture = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAfiElEQVR4Xm1be3SV1ZXfX27eISEkAaJAwiuQtBIJHTsgY6vLjl22YtE/HBPWLKtr2rHjsq0dF8K0JhCnBe2qLsU+xs4Uu6bJZdFaEWy1tB0crcAMLY+wxlwSNAa0XhCTkJDXzeOb32+fs+/9YOasBYSb+53vnH3247d/e5/g0+VLwt/dPiKfPP5lOf6FH8uHNxbIiWsvyvzz2dJybb58QUT++tWYLMe/FZXFMnTpfXnrQiX+J/LQzRdkRWxaftRdLPvWXZID75TKw3vOybyl1dLYsFJuLHxDrioP5Pa9M+ShJWPyhaMDMveVQqmLl8jevZdknYzL6VdFJt9Nydq2HJ3znvdnSDL7nKwezJXb4rMkJ7laHtkosvEJkfyBF2T2+jlSdvV5+dbCHPl2T5HsGr5PiorapLn6gnzz3KTkjWXLNYezZO5TWNfpQLqGc+Xns3Nk5+sVsmvZeWnvnpa34/Pkl99NymsjkxKcOrU0TFb0yYGymJydSskdo1my9r9j8pXrZ8hLv+6Xs89UyK8O9stPi7Jk/3aRj90UyMBHe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PMeXFz6ibv+fvcPcAU/S1IAQoniKbnhYkwqYzF5ckmBHG+6WZ7A9fnHnxAZxvX5WOlskUsXZeBktpQvnCVl91ySb/5lIIdSMdnxpwE5uzBL9v7rR56njMnzA6G0XRiWCzk5Uje5QF4v7pXrBlJyXf60vDIRk/8FDSF87PpehcgAAAAASUVORK5CYII="#
-
namespace Math#
Functions
-
float magnitude(const fe::Vector2f &v) noexcept#
calculates the magnitude of v
- Parameters:
v – const fe::Vector2f&
- Returns:
float magnitude of v
-
fe::Vector2f normalize(const fe::Vector2f &v) noexcept#
returns a normalized v
- Parameters:
v – [in] vector
- Returns:
fe::Vector2f normalized fe::Vector2f v
-
float angle(const fe::Vector2f &v, const fe::Vector2f &origin = fe::Vector2f(0.f, 0.f)) noexcept#
get the difference between v and origin in radians clockwise direction and -y is 0º degrees
// angle is 281.31º from 0,0 to 5,1 in clockwise direction auto angle = Math::radiansToDegrees(Math::angle({0,0},{5,1})); // angle is 101.31º from 5,1 to 0,0 in clockwise direction angle = Math::radiansToDegrees(Math::angle({5,1},{0,0})); //
- Parameters:
v – [in] fe::Vector2f
origin – [in] fe::Vector2f Origin which of fe::Vector2f v
- Returns:
float angle in radians
-
float directedAngle(const fe::Vector2f &v1, const fe::Vector2f &v2, const fe::Vector2f &origin = fe::Vector2f(0.f, 0.f)) noexcept#
get the difference from v1 and v2 with origin in radians clockwise direction and -y is 0º degrees
// angle is 326.31º degrees from [5,1] to [3,3] with origin [0,0] auto angle = Math::radiansToDegrees(Math::directedAngle({5,1},{3,3},{0,0})); // angle is 33.6901º degrees from [3,3] to [5,1] with origin [0,0] angle = Math::radiansToDegrees(Math::directedAngle({3,3},{5,1},{0,0})); // vector [5,1] with origin [3,3] is at 315º degrees from [3,3] angle = Math::radiansToDegrees(Math::directedAngle({5,1},{3,3},{3,3}));
- Parameters:
v1 – [in] const fe::Vector2f&
v2 – [in] const fe::Vector2f&
origin – [in] const fe::Vector2f&
- Returns:
float angles in radians
-
constexpr float degreesToRadians(float d) noexcept#
converts to radians
- Parameters:
d – [in] float degrees
- Returns:
float
-
constexpr float radiansToDegrees(float r) noexcept#
converts to degrees
- Parameters:
r – [in] float radians
- Returns:
float
Variables
-
constexpr double PI = 3.14159265358979323846#
PI.
-
float magnitude(const fe::Vector2f &v) noexcept#
-
namespace priv#
Functions
-
std::vector<double> queryNN(EvoAI::NeuralNetwork &nn, Petals &petals, const fe::Vector2f &pos, int currentRadius, int currentLayer) noexcept#
queries the neural network
- Parameters:
nn – [in] EvoAI::NeuralNetwork with 4 inputs 4 outputs
petals – [in] Petals that is being processed
pos – [in] position
currentRadius – [in] current radius
currentLayer – [in] current layer
- Returns:
std::vector<double> results
-
void setColorAndCut(const fe::Vector2f &pos, EvoAI::NeuralNetwork &nn, Petals &petals, int currentRadius, int currentLayer) noexcept#
sets color for every pixel in a line from petals.origin to pos as maximum if no cut is made.
- Parameters:
pos – [in] fe::Vector2f& position
nn – [in] EvoAI::NeuralNetwork with 4 inputs and 4 outputs
petals – [in] Petals that is being processed
currentRadius – [in] current radius
currentLayer – [in] current layer
-
void EightWaySymmetricSetColor(const fe::Vector2f &origin, const fe::Vector2f &r, Petals &petals, EvoAI::NeuralNetwork &nn, int currentRadius, int currentLayer) noexcept#
It will use setColorAndCut to draw a pattern into petals.
-
std::vector<double> queryNN(EvoAI::NeuralNetwork &nn, Petals &petals, const fe::Vector2f &pos, int currentRadius, int currentLayer) noexcept#
-
typedef signed char Int8#