Face3.js 576 字节
Newer Older
M
Mr.doob 已提交
1 2 3 4
/**
 * @author mr.doob / http://mrdoob.com/
 */

5
THREE.Face3 = function ( a, b, c, normal, color ) {
6

M
Mr.doob 已提交
7 8 9
	this.a = a;
	this.b = b;
	this.c = c;
10

M
Mr.doob 已提交
11
	this.centroid = new THREE.Vector3();
M
Mr.doob 已提交
12
	this.normal = normal || new THREE.Vector3();
13

M
Mr.doob 已提交
14
	this.color = color || new THREE.Color( 0xff000000 );
15

M
Mr.doob 已提交
16 17 18 19
};

THREE.Face3.prototype = {

M
Mr.doob 已提交
20 21 22 23 24 25 26 27
	// TODO: Dupe? (Geometry/computeCentroid)

	getCenter : function(){

		return this.a.clone().addSelf( this.b ).addSelf( this.c ).divideScalar( 3 );

	},

M
Mr.doob 已提交
28
	toString: function () {
29

M
Mr.doob 已提交
30
		return 'THREE.Face3 ( ' + this.a + ', ' + this.b + ', ' + this.c + ' )';
31

M
Mr.doob 已提交
32
	}
33

M
Mr.doob 已提交
34
}