Curve

CatmullRomCurve3

Создание гладкой 3d сплайн-кривой из серии точек с помощью алгоритма Catmull-Rom.

Пример

//Create a closed wavey loop const curve = new v3d.CatmullRomCurve3([ new v3d.Vector3(-10, 0, 10), new v3d.Vector3(-5, 5, 5), new v3d.Vector3(0, 0, 0), new v3d.Vector3(5, -5, 5), new v3d.Vector3(10, 0, 10) ]); const points = curve.getPoints(50); const geometry = new v3d.BufferGeometry().setFromPoints(points); const material = new v3d.LineBasicMaterial({ color : 0xff0000 }); // Create the final object to add to the scene const curveObject = new v3d.Line(geometry, material);

Примеры

WebGL / geometry / extrude / splines

Конструктор

CatmullRomCurve3(points : Array, closed : Boolean, curveType : String, tension : Float)

points – Массив Vector3 points
closed –Является ли кривая замкнутой. По умолчанию false.
curveType – Тип кривой. По умолчанию centripetal.
tension – Натяжение кривой. По умолчанию 0.5.

Свойства

Общие свойства смотрите в базовом классе Curve.

.points : Array

Массив точек Vector3, определяющих кривую. Должно быть не менее двух записей.

.closed : Boolean

Кривая будет зацикливаться сама на себя, если это так.

.curveType : String

Возможные значения: centripetal, chordal и catmullrom.

.tension : Float

Если .curveType - catmullrom, определяет напряжение catmullrom.

Методы

Общие методы смотрите в базовом классе Curve..

Исходный файл

О том как получить исходный код этого модуля читайте тут.