L 系统 - 减少新分支的圆柱体半径
我有一个由圆柱体制成的简单 3D L 系统,目前我只是遍历最终字符串中的每个符号并执行适当的操作,例如绘制、旋转、旋转、推送和弹出。我知道推送和弹出非常类似于新分支,但我尝试在调用推送时更改半径,但这会导致奇怪的结果。
有谁有正确的方法使新的分支比以前的分支更细?
谢谢。
else if((*it) == Push)
{
Radius -= 0.1f;
PushMatrix();
}
else if((*it) == Pop)
{
Radius += 0.1f;
PopMatrix();
}
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();
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您还需要将海龟的位置重置回分支点。
You also need to reset the position of the turtle back to the point of the branch.