# How to taper geometry?

I would like to load custom model and taper its buffer geometry, how should I do it in the most efficient way in Three.js? I am also having hard time finding the correct algorithm for doing this type of modification on the object, is there some good resource for such non-linear transformations?

EDIT:
For example I am loading custom GLTF model and I am modifying its BufferGeometry as such:

``````				function modify(geometry) {
var positionAttribute = geometry.attributes.position;

for (var i = 0; i < positionAttribute.count; i++) {

var x = positionAttribute.getX(i);
var y = positionAttribute.getY(i);
var z = positionAttribute.getZ(i);

z += Math.random() * 0.1;

positionAttribute.setXYZ(i, x, y, z);

}
}
``````

And I would like the know if it is possible to taper my geometry with this approach and what is the best way to do it?

Could you elaborate a bit, what do you mean by “tapering” ? Randomizing z-position of each vertex ? Shrinking?

When I say Tapering I mean this

In my addons Addon. Produces almost infinite many time-varying geometries with functions I have realized such deformations individually using different functions.

I made it for Geometry, indexed and non-indexed BufferGeometry.
Try it out: https://hofk.de/main/threejs/sandbox/

Maybe you can take something from there.

e.g.

https://github.com/hofk/THREEf.js/blob/7b76151f112779f48f16878c571541d44b00a70b/THREEf_90/THREEf.js

line 1994, 2052

https://github.com/hofk/THREEp.js/blob/6a268d2eafa7782ce267c5d8e6c5e0c4c4d81fe5/THREEp_90/THREEp.js

line 2075, 2158, 2221

1 Like

Do mean something like this?

2 Likes