问题描述
我正在使用jogl opengl绑定在java中编写程序。我需要创建一条沿曲线变化的贝塞尔曲线。到目前为止,我只管理了单点的薄贝塞尔曲线。我很确定这不是一件容易的事情,但我不知道在哪里开始寻找解决方案。如果有人能指出我正确的方向如何解决这个问题,我将不胜感激!
I am writing a program in java using the jogl opengl bindings. I need to create a bezier curve that varies in thickness along the curve. So far I've only managed a thin bezier curve of single points. I'm pretty sure that this isnt going to be an easy thing to do, but i I have no idea where to even begin looking for the solution. If anyone could point me in the right direction as to how to solve this, it'd be greatly appreciated!
James
推荐答案
对曲线进行采样,并为每个采样点计算两个点,曲线两侧各一个点,沿着采样点的法线,距离等于所需的距离采样点的宽度。这将创建一个多边形,您将其绘制为已填充。
Sample the curve and for each sample point compute two points, one on each side of the curve, along the normal line at the sample point and at a distance equal to the desired width at the sample point. This creates a polygon, which you draw as filled.
这篇关于OpenGL中的厚Bezier曲线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!