/**
 * package for gemometry objects
 */
package simogl.geometry;

/**
 * This class represents a face, that can be used in a mesh. A face
 * consist of two triangles.
 * @author Frank Bruns
 *
 */
public class Face
{
	private Triangle triangle1 = null;
	private Triangle triangle2 = null;
	
	/**
	 * Creates a new face. A face consists of two triangles forming a
	 * square. When creating a face, there are some default texture 
	 * coordinates assigned to the triangles of the face. So in order to
	 * use some specialised texture coordinates, always assign these 
	 * coordinates after creating a face object.
	 * @param trig1 first triangle of the face
	 * @param trig2 second triangle of the face
	 */
	public Face(Triangle trig1, Triangle trig2)
	{
		this.triangle1 = trig1;
		this.triangle1.setTexCoords(0f, 0f, 1f, 0f, 1f, 1f);
		
		this.triangle2 = trig2;
		this.triangle2.setTexCoords(1f, 1f, 0f, 1f, 0f, 0f);
	}
	
	/**
	 * Returns the first triangle of the face
	 * @return face's first triangle
	 */
	public Triangle getTriangle1()
	{
		return this.triangle1;
	}
	
	/**
	 * Sets the first triangle of the face
	 * @param triangle1 first triangle of the mesh
	 */
	public void setTriangle1(Triangle triangle1)
	{
		this.triangle1 = triangle1;
	}
	
	/**
	 * Returns the second triangle of the face
	 * @return face's second triangle
	 */
	public Triangle getTriangle2()
	{
		return this.triangle2;
	}		
	
	/**
	 * Sets the second triangle of the face
	 * @param triangle2 second triangle of the mesh
	 */
	public void setTriangle2(Triangle triangle2)
	{
		this.triangle2 = triangle2;
	}
}
