Create a smooth 3D cubic bezier curve, defined by a start point, endpoint and two control points.
const curve = new v3d.CubicBezierCurve3(
new v3d.Vector3(-10, 0, 0),
new v3d.Vector3(-5, 15, 0),
new v3d.Vector3(20, 15, 0),
new v3d.Vector3(10, 0, 0)
);
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);
v0 – The starting point.
v1 – The first control point.
v2 – The second control point.
v3 – The ending point.
See the base Curve class for common properties.
The starting point.
The first control point.
The second control point.
The ending point.
See the base Curve class for common Methods.
For more info on how to obtain the source code of this module see this page.