const pointCap = Array<Vector3>();
const barycenter = Vector3.Zero();
let i: number;
for (i = 0; i < shapePath.length; i++) {
barycenter.addInPlace(shapePath[i]);
}
barycenter.scaleInPlace(1.0 / shapePath.length);
for (i = 0; i < shapePath.length; i++) {
pointCap.push(barycenter);
}
return pointCap;
The previous function (that I keep as default in this PR) what just adding for all points, the barycenter.
NB: Params has been added at the end of the list, for retrocompatibility and non breaking change.
NB2: The above playground is using a custom cap function I tried myself, just to test. Please note that various CAP function could be used, this test is not guaranteed to work on any shape, but thatâs not the point of the PR. The point is just being able to pass a function.
@Tricotou good job bro, that defenitvelly does the job .
however, you can go deep to it and add another function that will be used for holes, for more complexe shapes to extrude . what do you think ?
The function takes the last loop as input, and returns the new loop. Thatâs all it does (no change in number of vertices, faces, or whatever. And then it adds it at first, at last, or at both :
I see , so indeed we can work on holes :
Since it taking the last loop and returning the current one , i guess that it s giving the loops in the same order you passed the shape , so you can use the current loop to create the cap like you did , and then draw faces of the cross bridge between the current and the last cap ⌠We need a complxe