Răsfoiți Sursa

Update ExtrudeGeometry.js (#9409)

Changed the bevel so that it is elliptical instead of sinusoidal. Formatted both areas the same with the linear option in the comments.
flagstone78 9 ani în urmă
părinte
comite
bf50f022aa
1 a modificat fișierele cu 7 adăugiri și 5 ștergeri
  1. 7 5
      src/extras/geometries/ExtrudeGeometry.js

+ 7 - 5
src/extras/geometries/ExtrudeGeometry.js

@@ -361,10 +361,10 @@ ExtrudeGeometry.prototype.addShape = function ( shape, options ) {
 		//for ( b = bevelSegments; b > 0; b -- ) {
 
 		t = b / bevelSegments;
-		z = bevelThickness * ( 1 - t );
+		z = bevelThickness * Math.cos ( t * Math.PI / 2 ); // curved
+		//z = bevelThickness * ( 1 - t ); //linear
 
-		//z = bevelThickness * t;
-		bs = bevelSize * ( Math.sin ( t * Math.PI / 2 ) ); // curved
+		bs = bevelSize * Math.sin ( t * Math.PI / 2 ); // curved
 		//bs = bevelSize * t; // linear
 
 		// contract shape
@@ -462,9 +462,11 @@ ExtrudeGeometry.prototype.addShape = function ( shape, options ) {
 	for ( b = bevelSegments - 1; b >= 0; b -- ) {
 
 		t = b / bevelSegments;
-		z = bevelThickness * ( 1 - t );
-		//bs = bevelSize * ( 1-Math.sin ( ( 1 - t ) * Math.PI/2 ) );
+		z = bevelThickness * Math.cos ( t * Math.PI / 2 ); // curved
+		//z = bevelThickness * ( 1 - t ); //linear
+		
 		bs = bevelSize * Math.sin ( t * Math.PI / 2 );
+		//bs = bevelSize * t; // linear
 
 		// contract shape