Graphics Reference
In-Depth Information
2, 20, false);
var mesh = new THREE.Mesh(tube, new
THREE.MeshNormalMaterial({
opacity: 0.6,
transparent: true
}));
scene.add(mesh);
How it works...
The
QuadraticBezierCurve3
object we created in this recipe has a number of
different functions (
getTangentAt
and
getPointAt
) that determine the location
somewhere along the path. These functions return information based on the
start
,
middle
, and
end
vectors passed in to the constructor. When we pass
Quadrat-
icBezierCurve3
into
THREE.TubeGeometry
,
THREE.TubeGeometry
uses the
getTangentAt
function to determine where to position its vertices.
There's moreā¦
In this recipe, we used
THREE.QuadraticBezierCurve3
to create our spline.
Three.js also provides a
THREE.CubicBezierCurve3
and
THREE.SplineCurve3
curve, which you can use to define these kinds of splines.
You can find more information on the differences between a quadratic Bezier curve
and a cubic Bezier curve at
http://stackoverflow.com/questions/18814022/what-is-