lib/toxi/processing/ToxiclibsSupport.js
function(tri,isFullShape){

		var isTriangle = function(){
			if(tri.a !== undefined && tri.b !== undefined && tri.c !== undefined){
				return (tri.a.x !== undefined);
			}
			return false;
		},
		isTriangle3D = function(){
			if(isTriangle()){
				return (tri.a.z !== undefined);
			}
			return false;
		};

		if(isFullShape || isFullShape === undefined){
			this.gfx.beginShape(this.app.TRIANGLES);
		}
		if(isTriangle3D()){
			var n = tri.computeNormal();
			this.gfx.normal(n.x,n.y,n.z);
			this.gfx.vertex(tri.a.x, tri.a.y, tri.a.z);
			this.gfx.vertex(tri.b.x, tri.b.y, tri.b.z);
			this.gfx.vertex(tri.c.x, tri.c.y, tri.c.z);
		} else { //should be Triangle2D
			this.gfx.vertex(tri.a.x,tri.a.y);
			this.gfx.vertex(tri.b.x,tri.b.y);
			this.gfx.vertex(tri.c.x,tri.c.y);
		}
    	if(isFullShape || isFullShape === undefined){
    		this.gfx.endShape();
    	}
	}
function(tri,isFullShape){

		var isTriangle = function(){
			if(tri.a !== undefined && tri.b !== undefined && tri.c !== undefined){
				return (tri.a.x !== undefined);
			}
			return false;
		},
		isTriangle3D = function(){
			if(isTriangle()){
				return (tri.a.z !== undefined);
			}
			return false;
		};

		if(isFullShape || isFullShape === undefined){
			this.gfx.beginShape(this.app.TRIANGLES);
		}
		if(isTriangle3D()){
			var n = tri.computeNormal();
			this.gfx.normal(n.x,n.y,n.z);
			this.gfx.vertex(tri.a.x, tri.a.y, tri.a.z);
			this.gfx.vertex(tri.b.x, tri.b.y, tri.b.z);
			this.gfx.vertex(tri.c.x, tri.c.y, tri.c.z);
		} else { //should be Triangle2D
			this.gfx.vertex(tri.a.x,tri.a.y);
			this.gfx.vertex(tri.b.x,tri.b.y);
			this.gfx.vertex(tri.c.x,tri.c.y);
		}
    	if(isFullShape || isFullShape === undefined){
    		this.gfx.endShape();
    	}
	}
function ( tri , isFullShape ) { var isTriangle = function ( ) { if ( tri . a !== undefined && tri . b !== undefined && tri . c !== undefined ) { return ( tri . a . x !== undefined ) ; } return false ; } , isTriangle3D = function ( ) { if ( isTriangle ( ) ) { return ( tri . a . z !== undefined ) ; } return false ; } ; if ( isFullShape || isFullShape === undefined ) { this . gfx . beginShape ( this . app . TRIANGLES ) ; } if ( isTriangle3D ( ) ) { var n = tri . computeNormal ( ) ; this . gfx . normal ( n . x , n . y , n . z ) ; this . gfx . vertex ( tri . a . x , tri . a . y , tri . a . z ) ; this . gfx . vertex ( tri . b . x , tri . b . y , tri . b . z ) ; this . gfx . vertex ( tri . c . x , tri . c . y , tri . c . z ) ; } else { //should be Triangle2D this . gfx . vertex ( tri . a . x , tri . a . y ) ; this . gfx . vertex ( tri . b . x , tri . b . y ) ; this . gfx . vertex ( tri . c . x , tri . c . y ) ; } if ( isFullShape || isFullShape === undefined ) { this . gfx . endShape ( ) ; } }
works for Triangle3D or Triangle2D
works for Triangle3D or Triangle2D