pointsToStroke static method
dynamic
pointsToStroke(
- dynamic points,
- dynamic style, [
- dynamic arcDivisions,
- dynamic minDistance,
Implementation
static pointsToStroke(points, style,
[arcDivisions, minDistance]) {
// Generates a stroke with some witdh around the given path.
// The path can be open or closed (last point equals to first point)
// Param points: Array of Vector2D (the path). Minimum 2 points.
// Param style: Object with SVG properties as returned by SVGLoader.getStrokeStyle(), or SVGLoader.parse() in the path.userData.style object
// Params arcDivisions: Arc divisions for round joins and endcaps. (Optional)
// Param minDistance: Points closer to this distance will be merged. (Optional)
// Returns BufferGeometry with stroke triangles (In plane z = 0). UV coordinates are generated ('u' along path. 'v' across it, from left to right)
List<double> vertices = [];
List<double> normals = [];
List<double> uvs = [];
if (SVGLoader.pointsToStrokeWithBuffers(points, style, arcDivisions,
minDistance, vertices, normals, uvs, 0) ==
0) {
return null;
}
var geometry = BufferGeometry();
geometry.setAttribute('position',
Float32BufferAttribute(Float32Array.from(vertices), 3, false));
geometry.setAttribute(
'normal', Float32BufferAttribute(Float32Array.from(normals), 3, false));
geometry.setAttribute(
'uv', Float32BufferAttribute(Float32Array.from(uvs), 2, false));
return geometry;
}