src/Matter/World.js
function buildEdge(vertex1, vertex2, tileBody, vertex0, vertex3) {
	vertex0 = vertex0 || null;
	vertex3 = vertex3 || null;

	let vertices = [];
	
	// Build the vertices
	vertices.push(
		vertex0 ? buildEdgeVertex(0, vertex0.x, vertex0.y, tileBody, true) : null,
		buildEdgeVertex(1, vertex1.x, vertex1.y, tileBody),
		buildEdgeVertex(2, vertex2.x, vertex2.y, tileBody),
		vertex3 ? buildEdgeVertex(3, vertex3.x, vertex3.y, tileBody, true) : null
	);
	
	// Build the edge
	let edge = {
		vertices: vertices,
		normals: null
	};
	
	// Calculate normals
	edge.normals = Axes.fromVertices(edge.vertices);
	
	// Calculate position
	edge.position = Vector.create(
		(vertex1.x + vertex2.x) / 2,
		(vertex1.y + vertex2.y) / 2
	);
	
	edge.index = vertex1.index;
	
	return edge;
}
function buildEdge(vertex1, vertex2, tileBody, vertex0, vertex3) {
	vertex0 = vertex0 || null;
	vertex3 = vertex3 || null;

	let vertices = [];
	
	// Build the vertices
	vertices.push(
		vertex0 ? buildEdgeVertex(0, vertex0.x, vertex0.y, tileBody, true) : null,
		buildEdgeVertex(1, vertex1.x, vertex1.y, tileBody),
		buildEdgeVertex(2, vertex2.x, vertex2.y, tileBody),
		vertex3 ? buildEdgeVertex(3, vertex3.x, vertex3.y, tileBody, true) : null
	);
	
	// Build the edge
	let edge = {
		vertices: vertices,
		normals: null
	};
	
	// Calculate normals
	edge.normals = Axes.fromVertices(edge.vertices);
	
	// Calculate position
	edge.position = Vector.create(
		(vertex1.x + vertex2.x) / 2,
		(vertex1.y + vertex2.y) / 2
	);
	
	edge.index = vertex1.index;
	
	return edge;
}
function buildEdge ( vertex1 , vertex2 , tileBody , vertex0 , vertex3 ) { vertex0 = vertex0 || null ; vertex3 = vertex3 || null ; let vertices = [ ] ; // Build the vertices vertices . push ( vertex0 ? buildEdgeVertex ( 0 , vertex0 . x , vertex0 . y , tileBody , true ) : null , buildEdgeVertex ( 1 , vertex1 . x , vertex1 . y , tileBody ) , buildEdgeVertex ( 2 , vertex2 . x , vertex2 . y , tileBody ) , vertex3 ? buildEdgeVertex ( 3 , vertex3 . x , vertex3 . y , tileBody , true ) : null ) ; // Build the edge let edge = { vertices : vertices , normals : null } ; // Calculate normals edge . normals = Axes . fromVertices ( edge . vertices ) ; // Calculate position edge . position = Vector . create ( ( vertex1 . x + vertex2 . x ) / 2 , ( vertex1 . y + vertex2 . y ) / 2 ) ; edge . index = vertex1 . index ; return edge ; }
Build a ghost edge for a tile body.

@param {Object} vertex1 - The first vertex of the central edge.
@param {Object} vertex2 - The second vertex of the central edge.
@param {Object} tileBody - The tile body the ghost edge belongs to.
@param {Object} [vertex0] - The vertex of the leading ghost edge.
@param {Object} [vertex3] - The vertex of the trailing ghost edge.
Build a ghost edge for a tile body .