fromPath static method
Implementation
static ParametricTubeGeometry fromPath(Curve path, [int segments = 64, double radius = 1, int segmentsRadius = 8, bool closed = false ]) {
final numpoints = segments + 1;
final frames = path.computeFrenetFrames( segments, closed ),
//tangents = frames.tangents,
normals = frames.normals,
binormals = frames.binormals;
final position = new Vector3();
parametricTube(double u, double v, Vector3 target ) {
v *= 2 * math.pi;
final i = ( u * ( numpoints - 1 ) ).floor();
path.getPointAt( u, position );
final normal = normals![ i ];
final binormal = binormals![ i ];
final cx = - radius * math.cos( v ); // TODO: Hack: Negating it so it faces outside.
final cy = radius * math.sin( v );
position.x += cx * normal.x + cy * binormal.x;
position.y += cx * normal.y + cy * binormal.y;
position.z += cx * normal.z + cy * binormal.z;
target.setFrom( position );
}
return ParametricTubeGeometry.init( parametricTube, segments, segmentsRadius );
// proxy internals
// this.tangents = tangents;
// this.normals = normals;
// this.binormals = binormals;
}