(function () {

    "use strict";

    var Vec3 = require('./Vec3');

    /**
     * Instantiates a Triangle object.
     * @class Triangle
     * @classdesc A triangle object.
     */
    function Triangle( spec ) {
        this.positions = [
            new Vec3( spec.positions[0] || spec[0] ),
            new Vec3( spec.positions[1] || spec[1] ),
            new Vec3( spec.positions[2] || spec[2] )
        ];
    }

    /**
     * Returns the radius of the bounding sphere of the triangle.
     *
     * @returns {number} The radius of the bounding sphere.
     */
    Triangle.prototype.getRadius = function() {
        if ( !this.radius ) {
            var positions = this.positions,
                centroid = this.getCentroid(),
                aDist = positions[0].sub( centroid ).length(),
                bDist = positions[1].sub( centroid ).length(),
                cDist = positions[2].sub( centroid ).length();
            this.radius = Math.max( aDist, Math.max( bDist, cDist ) );
        }
        return this.radius;
    };

    /**
     * Returns the centroid of the triangle.
     *
     * @returns {number} The centroid of the triangle.
     */
    Triangle.prototype.getCentroid = function() {
        if ( !this.centroid ) {
            var positions = this.positions;
            this.centroid = positions[0]
                .add( positions[1] )
                .add( positions[2] )
                .div( 3 );
        }
        return this.centroid;
    };

    /**
     * Returns the normal of the triangle.
     *
     * @returns {number} The normal of the triangle.
     */
    Triangle.prototype.getNormal = function() {
        if ( !this.normal ) {
            var positions = this.positions,
                ab = positions[0].sub( positions[1] ),
                ac = positions[0].sub( positions[2] );
            this.normal = ab.cross( ac ).normalize();
        }
        return this.normal;
    };

    module.exports = Triangle;

}());

@@ -1743,33 +1743,33 @@
  ab = positions%5B
-0
+1
 %5D.sub( positions
@@ -1769,17 +1769,17 @@
 sitions%5B
-1
+0
 %5D ),%0A   
@@ -1802,25 +1802,25 @@
 = positions%5B
-0
+2
 %5D.sub( posit
@@ -1824,17 +1824,17 @@
 sitions%5B
-2
+0
 %5D );%0A   

Fix inverted normal in Triangle class.