1.3.49
 
Loading...
Searching...
No Matches
CanopyGenerator Class Reference

Public Member Functions

 CanopyGenerator (helios::Context *context)
 Canopy geometry generator constructor.
 
template<typename CanopyType , typename... Args>
void storeCanopyParameters (Args &&...args)
 Stores the given canopy parameters.
 
std::vector< std::shared_ptr< BaseCanopyParameters > > getCanopyParametersList ()
 
void loadXML (const char *filename, bool build=true)
 Reads the XML file of the given name and stores all the configured canopy parameters.
 
void buildCanopies ()
 Builds canopies for all the stored canopy parameters.
 
void buildCanopy (const HomogeneousCanopyParameters &params)
 Build a canopy consisting of a homogeneous volume of leaves.
 
void buildCanopy (const SphericalCrownsCanopyParameters &params)
 Build a canopy consisting of spherical crowns filled with homogeneous leaves.
 
void buildCanopy (const ConicalCrownsCanopyParameters &params)
 Build a canopy consisting of conical crowns filled with homogeneous leaves.
 
void buildCanopy (const VSPGrapevineParameters &params)
 Build a canopy consisting of grapevines on VSP trellis.
 
void buildCanopy (const SplitGrapevineParameters &params)
 Build a canopy consisting of grapevines on split trellis.
 
void buildCanopy (const UnilateralGrapevineParameters &params)
 Build a canopy consisting of grapevines on unilateral trellis.
 
void buildCanopy (const GobletGrapevineParameters &params)
 Build a canopy consisting of grapevines on Goblet trellis.
 
void buildCanopy (const WhiteSpruceCanopyParameters &params)
 Build a canopy consisting of white spruce trees.
 
void buildCanopy (const TomatoParameters &params)
 Build a canopy consisting of tomato plants.
 
void buildCanopy (const StrawberryParameters &params)
 Build a canopy consisting of strawberry plants.
 
void buildCanopy (const WalnutCanopyParameters &params)
 Build a canopy consisting of walnut trees.
 
void buildCanopy (const SorghumCanopyParameters &params)
 Build a canopy consisting of sorghum plants.
 
void buildCanopy (const BeanParameters &params)
 Build a canopy consisting of common bean plants.
 
void buildGround (const helios::vec3 &ground_origin, const helios::vec2 &ground_extent, const helios::int2 &texture_subtiles, const helios::int2 &texture_subpatches, const char *ground_texture_file)
 Build a ground consisting of texture sub-tiles and sub-patches, which can be different sizes.
 
void buildGround (const helios::vec3 &ground_origin, const helios::vec2 &ground_extent, const helios::int2 &texture_subtiles, const helios::int2 &texture_subpatches, const char *ground_texture_file, float ground_rotation)
 Build a ground with azimuthal rotation consisting of texture sub-tiles and sub-patches, which can be different sizes.
 
std::vector< uintgetTrunkUUIDs (uint PlantID)
 Get the unique universal identifiers (UUIDs) for the primitives that make up the plant trunk.
 
std::vector< uintgetTrunkUUIDs ()
 Get the unique universal identifiers (UUIDs) for all trunk primitives in a single 1D vector.
 
std::vector< uintgetBranchUUIDs (uint PlantID)
 Get the unique universal identifiers (UUIDs) for the primitives that make up the plant branches.
 
std::vector< uintgetBranchUUIDs ()
 Get the unique universal identifiers (UUIDs) for all branch primitives in a single 1D vector.
 
std::vector< std::vector< uint > > getLeafUUIDs (uint PlantID)
 Get the unique universal identifiers (UUIDs) for the primitives that make up the plant leaves.
 
std::vector< uintgetLeafUUIDs ()
 Get the unique universal identifiers (UUIDs) for all leaf primitives in a single 1D vector.
 
std::vector< std::vector< std::vector< uint > > > getFruitUUIDs (uint PlantID)
 Get the unique universal identifiers (UUIDs) for the primitives that make up the tree fruit.
 
std::vector< uintgetFruitUUIDs ()
 Get the unique universal identifiers (UUIDs) for all fruit primitives in a single 1D vector.
 
std::vector< uintgetGroundUUIDs ()
 Get the unique universal identifiers (UUIDs) for the primitives that make up the ground.
 
std::vector< uintgetAllUUIDs (uint PlantID)
 Get the unique universal identifiers (UUIDs) for all primitives that make up the tree.
 
uint getPlantCount ()
 Get the current number of plants added to the Canopy Generator.
 
void seedRandomGenerator (uint seed)
 Seed the random number generator. This can be useful for generating repeatable trees, say, within a loop.
 
void disableMessages ()
 Disable standard messages from being printed to screen (default is to enable messages)
 
void enableMessages ()
 Enable standard messages to be printed to screen (default is to enable messages)
 
void buildIndividualPlants (helios::vec3 position)
 Builds individual plants based on the stored canopy parameters, at the given position.
 
void buildIndividualPlants ()
 Builds individual plants based on the stored canopy parameters (using canopy_origin as the position)
 
std::vector< std::vector< uint > > addGrapeCluster (helios::vec3 position, float grape_rad, float cluster_rad, helios::RGBcolor grape_color, uint grape_subdiv)
 Function to add an individual grape berry cluster.
 
uint grapevineVSP (const VSPGrapevineParameters &params, const helios::vec3 &origin)
 Function to add an individual grapevine plant on a vertical shoot positioned (VSP) trellis.
 
uint grapevineSplit (const SplitGrapevineParameters &params, const helios::vec3 &origin)
 Function to add an individual grapevine plant on a split trellis.
 
uint grapevineUnilateral (const UnilateralGrapevineParameters &params, const helios::vec3 &origin)
 Function to add an individual grapevine plant on a unilateral trellis.
 
uint grapevineGoblet (const GobletGrapevineParameters &params, const helios::vec3 &origin)
 Function to add an individual grapevine plant on a goblet (vent a taille) trellis.
 
uint whitespruce (const WhiteSpruceCanopyParameters &params, const helios::vec3 &origin)
 Function to add an individual white spruce tree.
 
uint tomato (const TomatoParameters &params, const helios::vec3 &origin)
 Function to add an individual tomato plant.
 
uint strawberry (const StrawberryParameters &params, const helios::vec3 &origin)
 Function to add an individual strawberry plant.
 
uint walnut (const WalnutCanopyParameters &params, const helios::vec3 &origin)
 Function to add an individual walnut tree.
 
uint sorghum (const SorghumCanopyParameters &params, const helios::vec3 &origin)
 Function to add an individual sorghum plant.
 
uint bean (const BeanParameters &params, const helios::vec3 &origin)
 Function to add an individual bean plant.
 
void createElementLabels ()
 Create primitive data that explicitly labels all primitives according to the plant element they correspond to.
 
void disableElementLabels ()
 Toggle off primitive data element type labels.
 

Static Public Member Functions

static int selfTest (int argc=0, char **argv=nullptr)
 Unit testing routine.
 

Detailed Description

Definition at line 1037 of file CanopyGenerator.h.

Constructor & Destructor Documentation

◆ CanopyGenerator()

CanopyGenerator::CanopyGenerator ( helios::Context context)
explicit

Canopy geometry generator constructor.

Parameters
[in]contextPointer to the Helios context

Definition at line 1879 of file CanopyGenerator.cpp.

Member Function Documentation

◆ addGrapeCluster()

std::vector< std::vector< uint > > CanopyGenerator::addGrapeCluster ( helios::vec3  position,
float  grape_rad,
float  cluster_rad,
helios::RGBcolor  grape_color,
uint  grape_subdiv 
)

Function to add an individual grape berry cluster.

Parameters
[in]positionCartesian (x,y,z) position of the cluster main stem.
[in]grape_radMaximum grape berry radius.
[in]cluster_radRadius of berry cluster at widest point.
[in]grape_subdivNumber of azimuthal and zenithal berry sub-triangle subdivisions.
Returns
2D vector of primitive UUIDs. The first index is the UUID for each primitive (triangles) comprising individual berries, second index corresponds to each berry in the cluster.

Definition at line 21 of file grapevine.cpp.

◆ bean()

uint CanopyGenerator::bean ( const BeanParameters params,
const helios::vec3 origin 
)

Function to add an individual bean plant.

Parameters
[in]paramsSet of parameters defining bean plants/canopy.
[in]originCartesian (x,y,z) position of the center of the canopy.
Returns
Plant ID of bean plant.

Definition at line 284 of file bean.cpp.

◆ buildCanopies()

void CanopyGenerator::buildCanopies ( )

Builds canopies for all the stored canopy parameters.

Definition at line 2150 of file CanopyGenerator.cpp.

◆ buildCanopy() [1/13]

void CanopyGenerator::buildCanopy ( const BeanParameters params)

Build a canopy consisting of common bean plants.

Parameters
[in]paramsStructure containing parameters for bean canopy.

Definition at line 2737 of file CanopyGenerator.cpp.

◆ buildCanopy() [2/13]

void CanopyGenerator::buildCanopy ( const ConicalCrownsCanopyParameters params)

Build a canopy consisting of conical crowns filled with homogeneous leaves.

Parameters
[in]paramsStructure containing parameters for conical crown canopy.

Definition at line 2314 of file CanopyGenerator.cpp.

◆ buildCanopy() [3/13]

void CanopyGenerator::buildCanopy ( const GobletGrapevineParameters params)

Build a canopy consisting of grapevines on Goblet trellis.

Parameters
[in]paramsStructure containing parameters for Goblet grapevine canopy.

Definition at line 2532 of file CanopyGenerator.cpp.

◆ buildCanopy() [4/13]

void CanopyGenerator::buildCanopy ( const HomogeneousCanopyParameters params)

Build a canopy consisting of a homogeneous volume of leaves.

Parameters
[in]paramsStructure containing parameters for homogeneous canopy.

Definition at line 2156 of file CanopyGenerator.cpp.

◆ buildCanopy() [5/13]

void CanopyGenerator::buildCanopy ( const SorghumCanopyParameters params)

Build a canopy consisting of sorghum plants.

Parameters
[in]paramsStructure containing parameters for sorghum plant canopy.

Definition at line 2708 of file CanopyGenerator.cpp.

◆ buildCanopy() [6/13]

void CanopyGenerator::buildCanopy ( const SphericalCrownsCanopyParameters params)

Build a canopy consisting of spherical crowns filled with homogeneous leaves.

Parameters
[in]paramsStructure containing parameters for spherical crown canopy.

Definition at line 2222 of file CanopyGenerator.cpp.

◆ buildCanopy() [7/13]

void CanopyGenerator::buildCanopy ( const SplitGrapevineParameters params)

Build a canopy consisting of grapevines on split trellis.

Parameters
[in]paramsStructure containing parameters for split trellis grapevine canopy.

Definition at line 2452 of file CanopyGenerator.cpp.

◆ buildCanopy() [8/13]

void CanopyGenerator::buildCanopy ( const StrawberryParameters params)

Build a canopy consisting of strawberry plants.

Parameters
[in]paramsStructure containing parameters for strawberry canopy.

Definition at line 2650 of file CanopyGenerator.cpp.

◆ buildCanopy() [9/13]

void CanopyGenerator::buildCanopy ( const TomatoParameters params)

Build a canopy consisting of tomato plants.

Parameters
[in]paramsStructure containing parameters for tomato canopy.

Definition at line 2621 of file CanopyGenerator.cpp.

◆ buildCanopy() [10/13]

void CanopyGenerator::buildCanopy ( const UnilateralGrapevineParameters params)

Build a canopy consisting of grapevines on unilateral trellis.

Parameters
[in]paramsStructure containing parameters for unilateral grapevine canopy.

Definition at line 2492 of file CanopyGenerator.cpp.

◆ buildCanopy() [11/13]

void CanopyGenerator::buildCanopy ( const VSPGrapevineParameters params)

Build a canopy consisting of grapevines on VSP trellis.

Parameters
[in]paramsStructure containing parameters for VSP grapevine canopy.

Definition at line 2407 of file CanopyGenerator.cpp.

◆ buildCanopy() [12/13]

void CanopyGenerator::buildCanopy ( const WalnutCanopyParameters params)

Build a canopy consisting of walnut trees.

Parameters
[in]paramsStructure containing parameters for walnut tree canopy.

Definition at line 2679 of file CanopyGenerator.cpp.

◆ buildCanopy() [13/13]

void CanopyGenerator::buildCanopy ( const WhiteSpruceCanopyParameters params)

Build a canopy consisting of white spruce trees.

Parameters
[in]paramsStructure containing parameters for white spruce canopy.

Definition at line 2572 of file CanopyGenerator.cpp.

◆ buildGround() [1/2]

void CanopyGenerator::buildGround ( const helios::vec3 ground_origin,
const helios::vec2 ground_extent,
const helios::int2 texture_subtiles,
const helios::int2 texture_subpatches,
const char *  ground_texture_file 
)

Build a ground consisting of texture sub-tiles and sub-patches, which can be different sizes.

Parameters
[in]ground_originx-, y-, and z-position of the ground center point.
[in]ground_extentWidth of the ground in the x- and y-directions.
[in]texture_subtilesNumber of sub-divisions of the ground into texture map tiles in the x- and y-directions.
[in]texture_subpatchesNumber of sub-divisions of each texture tile into sub-patches in the x- and y-directions.
[in]ground_texture_filePath to file used for tile texture mapping.

Definition at line 2114 of file CanopyGenerator.cpp.

◆ buildGround() [2/2]

void CanopyGenerator::buildGround ( const helios::vec3 ground_origin,
const helios::vec2 ground_extent,
const helios::int2 texture_subtiles,
const helios::int2 texture_subpatches,
const char *  ground_texture_file,
float  ground_rotation 
)

Build a ground with azimuthal rotation consisting of texture sub-tiles and sub-patches, which can be different sizes.

Parameters
[in]ground_originx-, y-, and z-position of the ground center point.
[in]ground_extentWidth of the ground in the x- and y-directions.
[in]texture_subtilesNumber of sub-divisions of the ground into texture map tiles in the x- and y-directions.
[in]texture_subpatchesNumber of sub-divisions of each texture tile into sub-patches in the x- and y-directions.
[in]ground_texture_filePath to file used for tile texture mapping.
[in]ground_rotationAzimuthal rotation angle of ground in radians.

Definition at line 2118 of file CanopyGenerator.cpp.

◆ buildIndividualPlants() [1/2]

void CanopyGenerator::buildIndividualPlants ( )

Builds individual plants based on the stored canopy parameters (using canopy_origin as the position)

Definition at line 3007 of file CanopyGenerator.cpp.

◆ buildIndividualPlants() [2/2]

void CanopyGenerator::buildIndividualPlants ( helios::vec3  position)

Builds individual plants based on the stored canopy parameters, at the given position.

Note
If you have multiple canopy parameters stored, this will try to build an individual plant of each type at the same position

Definition at line 3001 of file CanopyGenerator.cpp.

◆ createElementLabels()

void CanopyGenerator::createElementLabels ( )

Create primitive data that explicitly labels all primitives according to the plant element they correspond to.

Definition at line 3130 of file CanopyGenerator.cpp.

◆ disableElementLabels()

void CanopyGenerator::disableElementLabels ( )

Toggle off primitive data element type labels.

Definition at line 3134 of file CanopyGenerator.cpp.

◆ disableMessages()

void CanopyGenerator::disableMessages ( )

Disable standard messages from being printed to screen (default is to enable messages)

Definition at line 2993 of file CanopyGenerator.cpp.

◆ enableMessages()

void CanopyGenerator::enableMessages ( )

Enable standard messages to be printed to screen (default is to enable messages)

Definition at line 2997 of file CanopyGenerator.cpp.

◆ getAllUUIDs()

std::vector< uint > CanopyGenerator::getAllUUIDs ( uint  PlantID)

Get the unique universal identifiers (UUIDs) for all primitives that make up the tree.

Parameters
[in]PlantIDIdentifier of tree.

Definition at line 2959 of file CanopyGenerator.cpp.

◆ getBranchUUIDs() [1/2]

std::vector< uint > CanopyGenerator::getBranchUUIDs ( )

Get the unique universal identifiers (UUIDs) for all branch primitives in a single 1D vector.

Definition at line 2900 of file CanopyGenerator.cpp.

◆ getBranchUUIDs() [2/2]

std::vector< uint > CanopyGenerator::getBranchUUIDs ( uint  PlantID)

Get the unique universal identifiers (UUIDs) for the primitives that make up the plant branches.

Parameters
[in]PlantIDIdentifier of plant.

Definition at line 2890 of file CanopyGenerator.cpp.

◆ getCanopyParametersList()

std::vector< std::shared_ptr< BaseCanopyParameters > > CanopyGenerator::getCanopyParametersList ( )

Definition at line 1898 of file CanopyGenerator.cpp.

◆ getFruitUUIDs() [1/2]

std::vector< uint > CanopyGenerator::getFruitUUIDs ( )

Get the unique universal identifiers (UUIDs) for all fruit primitives in a single 1D vector.

Definition at line 2932 of file CanopyGenerator.cpp.

◆ getFruitUUIDs() [2/2]

std::vector< std::vector< std::vector< uint > > > CanopyGenerator::getFruitUUIDs ( uint  PlantID)

Get the unique universal identifiers (UUIDs) for the primitives that make up the tree fruit.

Parameters
[in]PlantIDIdentifier of tree.
Note
First index is the cluster of fruit (if applicable), second index is the fruit, third index is the UUIDs making up the sub-primitives of the fruit.

Definition at line 2922 of file CanopyGenerator.cpp.

◆ getGroundUUIDs()

std::vector< uint > CanopyGenerator::getGroundUUIDs ( )

Get the unique universal identifiers (UUIDs) for the primitives that make up the ground.

Definition at line 2945 of file CanopyGenerator.cpp.

◆ getLeafUUIDs() [1/2]

std::vector< uint > CanopyGenerator::getLeafUUIDs ( )

Get the unique universal identifiers (UUIDs) for all leaf primitives in a single 1D vector.

Definition at line 2916 of file CanopyGenerator.cpp.

◆ getLeafUUIDs() [2/2]

std::vector< std::vector< uint > > CanopyGenerator::getLeafUUIDs ( uint  PlantID)

Get the unique universal identifiers (UUIDs) for the primitives that make up the plant leaves.

Parameters
[in]PlantIDIdentifier of plant.
Note
The first index is the leaf, second index is the UUIDs making up the sub-primitives of the leaf (if applicable).

Definition at line 2906 of file CanopyGenerator.cpp.

◆ getPlantCount()

uint CanopyGenerator::getPlantCount ( )

Get the current number of plants added to the Canopy Generator.

Definition at line 2985 of file CanopyGenerator.cpp.

◆ getTrunkUUIDs() [1/2]

std::vector< uint > CanopyGenerator::getTrunkUUIDs ( )

Get the unique universal identifiers (UUIDs) for all trunk primitives in a single 1D vector.

Definition at line 2884 of file CanopyGenerator.cpp.

◆ getTrunkUUIDs() [2/2]

std::vector< uint > CanopyGenerator::getTrunkUUIDs ( uint  PlantID)

Get the unique universal identifiers (UUIDs) for the primitives that make up the plant trunk.

Parameters
[in]PlantIDIdentifier of plant.

Definition at line 2874 of file CanopyGenerator.cpp.

◆ grapevineGoblet()

uint CanopyGenerator::grapevineGoblet ( const GobletGrapevineParameters params,
const helios::vec3 origin 
)

Function to add an individual grapevine plant on a goblet (vent a taille) trellis.

Parameters
[in]paramsSet of parameters defining grapevine plant.
[in]originCartesian (x,y,z) position of the center of the canopy.
Returns
Plant ID of bean plant.

Definition at line 1047 of file grapevine.cpp.

◆ grapevineSplit()

uint CanopyGenerator::grapevineSplit ( const SplitGrapevineParameters params,
const helios::vec3 origin 
)

Function to add an individual grapevine plant on a split trellis.

Parameters
[in]paramsSet of parameters defining grapevine plant.
[in]originCartesian (x,y,z) position of the center of the canopy.
Returns
Plant ID of bean plant.

Definition at line 455 of file grapevine.cpp.

◆ grapevineUnilateral()

uint CanopyGenerator::grapevineUnilateral ( const UnilateralGrapevineParameters params,
const helios::vec3 origin 
)

Function to add an individual grapevine plant on a unilateral trellis.

Parameters
[in]paramsSet of parameters defining grapevine plant.
[in]originCartesian (x,y,z) position of the center of the canopy.
Returns
Plant ID of bean plant.

Definition at line 816 of file grapevine.cpp.

◆ grapevineVSP()

uint CanopyGenerator::grapevineVSP ( const VSPGrapevineParameters params,
const helios::vec3 origin 
)

Function to add an individual grapevine plant on a vertical shoot positioned (VSP) trellis.

Parameters
[in]paramsSet of parameters defining grapevine plant.
[in]originCartesian (x,y,z) position of the center of the canopy.
Returns
Plant ID of bean plant.

Definition at line 146 of file grapevine.cpp.

◆ loadXML()

void CanopyGenerator::loadXML ( const char *  filename,
bool  build = true 
)

Reads the XML file of the given name and stores all the configured canopy parameters.

Parameters
[in]filenamePath to XML file to be read
[in]buildtrue if we should build all the canopies for which we read parameters in the XML file

Definition at line 1906 of file CanopyGenerator.cpp.

◆ seedRandomGenerator()

void CanopyGenerator::seedRandomGenerator ( uint  seed)

Seed the random number generator. This can be useful for generating repeatable trees, say, within a loop.

Parameters
[in]seedRandom number seed

Definition at line 2989 of file CanopyGenerator.cpp.

◆ selfTest()

int CanopyGenerator::selfTest ( int  argc = 0,
char **  argv = nullptr 
)
static

Unit testing routine.

Definition at line 184 of file selfTest.cpp.

◆ sorghum()

uint CanopyGenerator::sorghum ( const SorghumCanopyParameters params,
const helios::vec3 origin 
)

Function to add an individual sorghum plant.

Parameters
[in]paramsSet of parameters defining sorghum plants/canopy.
[in]originCartesian (x,y,z) position of the center of the canopy.
Returns
Plant ID of bean plant.

Definition at line 8 of file sorghum.cpp.

◆ storeCanopyParameters()

template<typename CanopyType , typename... Args>
void CanopyGenerator::storeCanopyParameters ( Args &&...  args)

Stores the given canopy parameters.

Definition at line 1893 of file CanopyGenerator.cpp.

◆ strawberry()

uint CanopyGenerator::strawberry ( const StrawberryParameters params,
const helios::vec3 origin 
)

Function to add an individual strawberry plant.

Parameters
[in]paramsSet of parameters defining strawberry plants/canopy.
[in]originCartesian (x,y,z) position of the center of the canopy.
Returns
Plant ID of bean plant.

Definition at line 203 of file strawberry.cpp.

◆ tomato()

uint CanopyGenerator::tomato ( const TomatoParameters params,
const helios::vec3 origin 
)

Function to add an individual tomato plant.

Parameters
[in]paramsSet of parameters defining tomato plants/canopy.
[in]originCartesian (x,y,z) position of the center of the canopy.
Returns
Plant ID of bean plant.

Definition at line 130 of file tomato.cpp.

◆ walnut()

uint CanopyGenerator::walnut ( const WalnutCanopyParameters params,
const helios::vec3 origin 
)

Function to add an individual walnut tree.

Parameters
[in]paramsSet of parameters defining walnut trees/canopy.
[in]originCartesian (x,y,z) position of the center of the canopy.
Returns
Plant ID of bean plant.

Definition at line 316 of file walnut.cpp.

◆ whitespruce()

uint CanopyGenerator::whitespruce ( const WhiteSpruceCanopyParameters params,
const helios::vec3 origin 
)

Function to add an individual white spruce tree.

Parameters
[in]paramsSet of parameters defining white spruce tree.
[in]originCartesian (x,y,z) position of the center of the canopy.
Returns
Plant ID of bean plant.

Definition at line 6 of file whitespruce.cpp.


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