Quantcast
Channel: openFrameworks - Latest posts
Viewing all articles
Browse latest Browse all 40524

Using ofNode to build an L-System

$
0
0

Out of the loop it is easier because i can recreate a new ofNode for every point, and the transformation are in the correct order (before the rotation and after the translation)

    ofNode root = ofNode();
    root.setPosition(450, 700, 0);
    auto branch = ofNode();
    branch.setParent(root);
    branch.roll(45.00);
    branch.move(ofVec3f(0, -100, 0));
    mesh.addVertex(branch.getGlobalPosition());
    mesh.addColor(ofFloatColor(1.0, 1.0, 0.0));

    auto branch2 = ofNode();
    branch2.setParent(branch);
    branch2.roll(45.00);
    branch2.move(ofVec3f(0, -100, 0));
    mesh.addVertex(branch2.getGlobalPosition());
    mesh.addColor(ofFloatColor(1.0, 1.0, 0.0));

    auto branch3 = ofNode();
    branch3.setParent(branch2);
    branch3.roll(45.00);
    branch3.move(ofVec3f(0, -100, 0));
    mesh.addVertex(branch3.getGlobalPosition());
    mesh.addColor(ofFloatColor(1.0, 1.0, 0.0));

Viewing all articles
Browse latest Browse all 40524

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>