ExtrudeGeometry’s bevel algorithm

Description of the problem

A bug for bevel contour algorithm.
The code below

function scalePt2( pt, vec, size ) {

     if ( ! vec ) console.error( "THREE.ExtrudeGeometry: vec does not exist" );

     return vec.clone().multiplyScalar( size ).add( pt );

}

in src/geometry/ExtrudeGeometry.js which is definitely wrong when the center of the contour is not (0, 0) .
It’s also very easy to test this wrong algorithm. In the example webgl_geometry_extrude_shapes.html, you can just change the line 140 from

pts.push( new THREE.Vector2 ( Math.cos( a ) * l , Math.sin( a ) * l ) );

to

pts.push( new THREE.Vector2 ( Math.cos( a ) * l + 3, Math.sin( a ) * l ) );

Then, you’ll find the red bevel of the ‘star’ become strange.

Three.js version

0.86.0

Browser
  • All of them
OS
  • All of them
Hardware Requirements (graphics card, VR Device, …)

Author: Fantashit

1 thought on “ExtrudeGeometry’s bevel algorithm

  1. I don’t have a ad-hoc solution for this problem because the code obviously assumes that the contour is not translated. Unfortunately, i’m not familiar with this part of ExtrudeGeometry so i need to study the implementation first.

    Any help with this issue is highly appreciated 😊

Comments are closed.