载入中...
搜索中...
未找到
eve::procgen::LSystem类 参考

General stochastic bracketed L-system engine. 更多...

#include <LSystem.h>

Public 成员函数

 LSystem ()
 L system.
 
void setAxiom (const std::string &axiom)
 Set the starting string.
 
void addRule (char symbol, const std::string &production)
 Add a deterministic production for one symbol.
 
void addRules (char symbol, const std::vector< std::string > &productions, const std::vector< float > &weights)
 Add weighted (stochastic) productions for one symbol.
 
void clearRules ()
 Remove all production rules (the axiom and alphabet remain).
 
void setAngle (float degrees)
 Set the turtle turn angle.
 
void setStep (float step)
 Set the forward distance per F.
 
void setIterations (int iterations)
 Set the grammar expansion count.
 
void setSeed (uint32_t seed)
 Set the deterministic seed.
 
void setInitialHeading (float x, float y, float z)
 Set the initial heading (normalized).
 
void setBranchRadius (float radius)
 Set the trunk radius at depth 0.
 
void setBranchRadiusFalloff (float factor)
 Set the per-depth radius multiplier.
 
void setLeafSize (float size)
 Set the foliage card size.
 
void setLeafSymbols (const std::string &symbols)
 Set the set of symbols that emit a leaf marker.
 
void setTropism (float x, float y, float z)
 Bias growth toward a direction (phototropism).
 
uint32_t getSeed () const
 Current seed.
 
int getIterations () const
 Current iteration count.
 
std::string derive () const
 Expand the grammar iterations times.
 
void generate (LSystemResult &out) const
 Expand then interpret with the turtle.
 
void toPointSet (PointSet &out) const
 Generate and pack segment endpoints into a PointSet.
 

详细描述

General stochastic bracketed L-system engine.

A starting axiom is rewritten iterations times using production rules; a symbol may carry several weighted productions (chosen deterministically from the seed). The derived word is then interpreted by a 3D turtle:

F draw forward one step f move forward, no draw

  • / - yaw (heading around up) & / ^ pitch (down / up) \ / / roll around the heading [ ] push / pop turtle state <leaf> emit a leaf (see setLeafSymbols)

Limb thickness falls off with bracket depth, so [ ] bracketing produces tapering branches. The engine is not tied to mesh output: call toPointSet() to recover segments as spline control points (roads, 2D layouts) or run the mesh.lsystem recipe for tree/plant meshes. A fixed seed reproduces the exact same result.

在文件 LSystem.h 第 55 行定义.

构造及析构函数说明

◆ LSystem()

eve::procgen::LSystem::LSystem ( )

L system.

在文件 LSystem.cpp 第 20 行定义.

成员函数说明

◆ addRule()

void eve::procgen::LSystem::addRule ( char  symbol,
const std::string &  production 
)

Add a deterministic production for one symbol.

参数
symbolSource symbol.
productionReplacement.

在文件 LSystem.cpp 第 26 行定义.

◆ addRules()

void eve::procgen::LSystem::addRules ( char  symbol,
const std::vector< std::string > &  productions,
const std::vector< float > &  weights 
)

Add weighted (stochastic) productions for one symbol.

参数
symbolSource symbol.
productionsReplacements.
weightsSelection weights.

在文件 LSystem.cpp 第 30 行定义.

引用了 count, target, w , 以及 weights.

◆ clearRules()

void eve::procgen::LSystem::clearRules ( )

Remove all production rules (the axiom and alphabet remain).

在文件 LSystem.cpp 第 41 行定义.

◆ derive()

std::string eve::procgen::LSystem::derive ( ) const

Expand the grammar iterations times.

返回
The derived word.

在文件 LSystem.cpp 第 96 行定义.

引用了 r, unit , 以及 word.

被这些函数引用 generate().

◆ generate()

void eve::procgen::LSystem::generate ( LSystemResult &  out) const

Expand then interpret with the turtle.

参数
outResult to fill.

在文件 LSystem.cpp 第 231 行定义.

引用了 eve::procgen::LSystemResult::derivation, derive(), eve::procgen::LSystemResult::leafCount , 以及 eve::procgen::LSystemResult::segments.

被这些函数引用 eve::procgen::generateLSystemMesh() , 以及 toPointSet().

◆ getIterations()

int eve::procgen::LSystem::getIterations ( ) const

Current iteration count.

返回
Iterations.

在文件 LSystem.cpp 第 68 行定义.

◆ getSeed()

uint32_t eve::procgen::LSystem::getSeed ( ) const

Current seed.

返回
Seed.

在文件 LSystem.cpp 第 67 行定义.

◆ setAngle()

void eve::procgen::LSystem::setAngle ( float  degrees)

Set the turtle turn angle.

参数
degreesAngle in degrees.

在文件 LSystem.cpp 第 45 行定义.

引用了 degrees.

被这些函数引用 eve::procgen::generateLSystemMesh().

◆ setAxiom()

void eve::procgen::LSystem::setAxiom ( const std::string &  axiom)

Set the starting string.

参数
axiomAxiom.

在文件 LSystem.cpp 第 24 行定义.

◆ setBranchRadius()

void eve::procgen::LSystem::setBranchRadius ( float  radius)

Set the trunk radius at depth 0.

参数
radiusRadius.

在文件 LSystem.cpp 第 56 行定义.

引用了 radius.

被这些函数引用 eve::procgen::generateLSystemMesh().

◆ setBranchRadiusFalloff()

void eve::procgen::LSystem::setBranchRadiusFalloff ( float  factor)

Set the per-depth radius multiplier.

参数
factorFactor in (0, 1].

在文件 LSystem.cpp 第 57 行定义.

被这些函数引用 eve::procgen::generateLSystemMesh().

◆ setInitialHeading()

void eve::procgen::LSystem::setInitialHeading ( float  x,
float  y,
float  z 
)

Set the initial heading (normalized).

参数
xX.
yY.
zZ.

在文件 LSystem.cpp 第 50 行定义.

引用了 n, x, y , 以及 z.

◆ setIterations()

void eve::procgen::LSystem::setIterations ( int  iterations)

Set the grammar expansion count.

参数
iterationsRewrite count.

在文件 LSystem.cpp 第 47 行定义.

引用了 iterations.

被这些函数引用 eve::procgen::generateLSystemMesh().

◆ setLeafSize()

void eve::procgen::LSystem::setLeafSize ( float  size)

Set the foliage card size.

参数
sizeSize.

在文件 LSystem.cpp 第 58 行定义.

引用了 size.

被这些函数引用 eve::procgen::generateLSystemMesh().

◆ setLeafSymbols()

void eve::procgen::LSystem::setLeafSymbols ( const std::string &  symbols)

Set the set of symbols that emit a leaf marker.

参数
symbolsCharacter list, e.g. "L@".

在文件 LSystem.cpp 第 60 行定义.

引用了 c.

◆ setSeed()

void eve::procgen::LSystem::setSeed ( uint32_t  seed)

Set the deterministic seed.

参数
seedSeed.

在文件 LSystem.cpp 第 48 行定义.

引用了 seed.

被这些函数引用 eve::procgen::generateLSystemMesh().

◆ setStep()

void eve::procgen::LSystem::setStep ( float  step)

Set the forward distance per F.

参数
stepStep length.

在文件 LSystem.cpp 第 46 行定义.

引用了 step.

◆ setTropism()

void eve::procgen::LSystem::setTropism ( float  x,
float  y,
float  z 
)

Bias growth toward a direction (phototropism).

参数
xX.
yY.
zZ.

在文件 LSystem.cpp 第 65 行定义.

引用了 x, y , 以及 z.

被这些函数引用 eve::procgen::generateLSystemMesh().

◆ toPointSet()

void eve::procgen::LSystem::toPointSet ( PointSet &  out) const

Generate and pack segment endpoints into a PointSet.

参数
outSet to fill.

在文件 LSystem.cpp 第 238 行定义.

引用了 eve::procgen::PointSet::add(), generate() , 以及 eve::procgen::LSystemResult::segments.


该类的文档由以下文件生成: