Browse Source

rn setPointsAndIndices -> setFromPointsAndIndices and add unit test.

Ben Houston 12 years ago
parent
commit
6662934d5c
2 changed files with 12 additions and 1 deletions
  1. 1 1
      src/math/Triangle3.js
  2. 11 0
      test/core/Triangle3.js

+ 1 - 1
src/math/Triangle3.js

@@ -68,7 +68,7 @@ THREE.Triangle3.prototype = {
 
 
 	},
 	},
 
 
-	setPointsAndIndices: function ( points, i0, i1, i2 ) {
+	setFromPointsAndIndices: function ( points, i0, i1, i2 ) {
 
 
 		this.a.copy( points[i0] );
 		this.a.copy( points[i0] );
 		this.b.copy( points[i1] );
 		this.b.copy( points[i1] );

+ 11 - 0
test/core/Triangle3.js

@@ -32,6 +32,17 @@ test( "copy", function() {
 	ok( b.c.equals( two3 ), "Passed!" );
 	ok( b.c.equals( two3 ), "Passed!" );
 });
 });
 
 
+test( "setFromPointsAndIndices", function() {
+	var a = new THREE.Triangle3();
+
+	var points = [ one3, one3.clone().negate(), two3 ];
+	a.setFromPointsAndIndices( points, 1, 0, 2 );
+	ok( a.a.equals( one3.clone().negate() ), "Passed!" );
+	ok( a.b.equals( one3 ), "Passed!" );
+	ok( a.c.equals( two3 ), "Passed!" );
+
+});
+
 test( "set", function() {
 test( "set", function() {
 	var a = new THREE.Triangle3();
 	var a = new THREE.Triangle3();