Browse Source

Code documentation (#23723)

Jason Sturges 3 years ago
parent
commit
93f0f985fb

+ 2 - 2
src/extras/Earcut.js

@@ -359,7 +359,7 @@ function compareX( a, b ) {
 
 
 }
 }
 
 
-// find a bridge between vertices that connects hole with an outer ring and and link it
+// find a bridge between vertices that connects hole with an outer ring and link it
 function eliminateHole( hole, outerNode ) {
 function eliminateHole( hole, outerNode ) {
 
 
 	outerNode = findHoleBridge( hole, outerNode );
 	outerNode = findHoleBridge( hole, outerNode );
@@ -591,7 +591,7 @@ function pointInTriangle( ax, ay, bx, by, cx, cy, px, py ) {
 // check if a diagonal between two polygon nodes is valid (lies in polygon interior)
 // check if a diagonal between two polygon nodes is valid (lies in polygon interior)
 function isValidDiagonal( a, b ) {
 function isValidDiagonal( a, b ) {
 
 
-	return a.next.i !== b.i && a.prev.i !== b.i && ! intersectsPolygon( a, b ) && // dones't intersect other edges
+	return a.next.i !== b.i && a.prev.i !== b.i && ! intersectsPolygon( a, b ) && // doesn't intersect other edges
 		( locallyInside( a, b ) && locallyInside( b, a ) && middleInside( a, b ) && // locally visible
 		( locallyInside( a, b ) && locallyInside( b, a ) && middleInside( a, b ) && // locally visible
 		( area( a.prev, a, b.prev ) || area( a, b.prev, b ) ) || // does not create opposite-facing sectors
 		( area( a.prev, a, b.prev ) || area( a, b.prev, b ) ) || // does not create opposite-facing sectors
 		equals( a, b ) && area( a.prev, a, a.next ) > 0 && area( b.prev, b, b.next ) > 0 ); // special zero-length case
 		equals( a, b ) && area( a.prev, a, a.next ) > 0 && area( b.prev, b, b.next ) > 0 ); // special zero-length case

+ 2 - 2
src/geometries/TorusKnotGeometry.js

@@ -44,7 +44,7 @@ class TorusKnotGeometry extends BufferGeometry {
 
 
 		for ( let i = 0; i <= tubularSegments; ++ i ) {
 		for ( let i = 0; i <= tubularSegments; ++ i ) {
 
 
-			// the radian "u" is used to calculate the position on the torus curve of the current tubular segement
+			// the radian "u" is used to calculate the position on the torus curve of the current tubular segment
 
 
 			const u = i / tubularSegments * p * Math.PI * 2;
 			const u = i / tubularSegments * p * Math.PI * 2;
 
 
@@ -76,7 +76,7 @@ class TorusKnotGeometry extends BufferGeometry {
 				const cy = tube * Math.sin( v );
 				const cy = tube * Math.sin( v );
 
 
 				// now calculate the final vertex position.
 				// now calculate the final vertex position.
-				// first we orient the extrusion with our basis vectos, then we add it to the current position on the curve
+				// first we orient the extrusion with our basis vectors, then we add it to the current position on the curve
 
 
 				vertex.x = P1.x + ( cx * N.x + cy * B.x );
 				vertex.x = P1.x + ( cx * N.x + cy * B.x );
 				vertex.y = P1.y + ( cx * N.y + cy * B.y );
 				vertex.y = P1.y + ( cx * N.y + cy * B.y );

+ 1 - 1
src/geometries/WireframeGeometry.js

@@ -39,7 +39,7 @@ class WireframeGeometry extends BufferGeometry {
 
 
 				}
 				}
 
 
-				// create a data structure that contains all eges without duplicates
+				// create a data structure that contains all edges without duplicates
 
 
 				for ( let o = 0, ol = groups.length; o < ol; ++ o ) {
 				for ( let o = 0, ol = groups.length; o < ol; ++ o ) {
 
 

+ 3 - 3
src/math/Box3.js

@@ -508,9 +508,9 @@ function satForAxes( axes, v0, v1, v2, extents ) {
 	for ( let i = 0, j = axes.length - 3; i <= j; i += 3 ) {
 	for ( let i = 0, j = axes.length - 3; i <= j; i += 3 ) {
 
 
 		_testAxis.fromArray( axes, i );
 		_testAxis.fromArray( axes, i );
-		// project the aabb onto the seperating axis
+		// project the aabb onto the separating axis
 		const r = extents.x * Math.abs( _testAxis.x ) + extents.y * Math.abs( _testAxis.y ) + extents.z * Math.abs( _testAxis.z );
 		const r = extents.x * Math.abs( _testAxis.x ) + extents.y * Math.abs( _testAxis.y ) + extents.z * Math.abs( _testAxis.z );
-		// project all 3 vertices of the triangle onto the seperating axis
+		// project all 3 vertices of the triangle onto the separating axis
 		const p0 = v0.dot( _testAxis );
 		const p0 = v0.dot( _testAxis );
 		const p1 = v1.dot( _testAxis );
 		const p1 = v1.dot( _testAxis );
 		const p2 = v2.dot( _testAxis );
 		const p2 = v2.dot( _testAxis );
@@ -518,7 +518,7 @@ function satForAxes( axes, v0, v1, v2, extents ) {
 		if ( Math.max( - Math.max( p0, p1, p2 ), Math.min( p0, p1, p2 ) ) > r ) {
 		if ( Math.max( - Math.max( p0, p1, p2 ), Math.min( p0, p1, p2 ) ) > r ) {
 
 
 			// points of the projected triangle are outside the projected half-length of the aabb
 			// points of the projected triangle are outside the projected half-length of the aabb
-			// the axis is seperating and we can exit
+			// the axis is separating and we can exit
 			return false;
 			return false;
 
 
 		}
 		}

+ 1 - 1
src/math/Spherical.js

@@ -39,7 +39,7 @@ class Spherical {
 
 
 	}
 	}
 
 
-	// restrict phi to be betwee EPS and PI-EPS
+	// restrict phi to be between EPS and PI-EPS
 	makeSafe() {
 	makeSafe() {
 
 
 		const EPS = 0.000001;
 		const EPS = 0.000001;

+ 1 - 1
src/math/interpolants/DiscreteInterpolant.js

@@ -2,7 +2,7 @@ import { Interpolant } from '../Interpolant.js';
 
 
 /**
 /**
  *
  *
- * Interpolant that evaluates to the sample value at the position preceeding
+ * Interpolant that evaluates to the sample value at the position preceding
  * the parameter.
  * the parameter.
  */
  */
 
 

+ 1 - 1
src/renderers/shaders/ShaderChunk/dithering_pars_fragment.glsl.js

@@ -9,7 +9,7 @@ export default /* glsl */`
 		//Shift the individual colors differently, thus making it even harder to see the dithering pattern
 		//Shift the individual colors differently, thus making it even harder to see the dithering pattern
 		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
 		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
 
 
-		//modify shift acording to grid position.
+		//modify shift according to grid position.
 		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
 		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
 
 
 		//shift the color by dither_shift
 		//shift the color by dither_shift

+ 1 - 1
src/renderers/webgl/WebGLBindingStates.js

@@ -568,7 +568,7 @@
 
 
 	}
 	}
 
 
-	// for backward-compatilibity
+	// for backward-compatibility
 
 
 	function resetDefaultState() {
 	function resetDefaultState() {