質問

I have a simple 3D L-System made from cylinders, and I currently just go through each symbol in the final string and do appropriate actions like draw, turn, rotate, push and pop. I am aware that push and pop pretty much resembles a new branch, but I tried changing the radius whenever push is called, but it leads to strange results.

Does anyone have the correct way of making newer branches becoming thinner than the previous branches?

Thanks.

    else if((*it) == Push)
    {
       Radius -= 0.1f;
       PushMatrix();
    }
    else if((*it) == Pop)
    {
       Radius += 0.1f;
       PopMatrix();
    }
役に立ちましたか?

解決

You also need to reset the position of the turtle back to the point of the branch.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top