1   /*
2    * Created on 2005-01-07
3    *
4    * TODO To change the template for this generated file go to
5    * Window - Preferences - Java - Code Style - Code Templates
6    */
7   package org.sourceforge.jvb3d.Loader;
8   
9   import javax.vecmath.Point2d;
10  import javax.vecmath.Point2f;
11  import javax.vecmath.Point3d;
12  
13  import junit.framework.TestCase;
14  
15  /***
16   * @author Develop
17   *
18   * TODO To change the template for this generated type comment go to
19   * Window - Preferences - Java - Code Style - Code Templates
20   */
21  public class SurfaceTest extends TestCase {
22  	Surface testedSurface = null;
23  	Point3d[] points = null;
24  	
25  	protected void setUp() throws Exception {
26  		super.setUp();
27  		points = new Point3d[4];
28  		points[0] = new Point3d(-3, 2, 0);
29  		points[1] = new Point3d(2, 2, 0);
30  		points[2] = new Point3d(2, -1, 0);
31  		points[3] = new Point3d(-3, -1, 0);
32  		testedSurface = new Surface(points, "su-2");
33  	}
34  	
35  	protected void tearDown() throws Exception {
36  		testedSurface = null;
37  		super.tearDown();
38  	}
39  	public void testCutOpening() {
40  		Point3d[] cutPoints = new Point3d[4];
41  		
42  		cutPoints[0] = new Point3d(-2, 1, 0);
43  		cutPoints[1] = new Point3d(-1, 1, 0);
44  		cutPoints[2] = new Point3d(-1, 0, 0);
45  		cutPoints[3] = new Point3d(-2, 0, 0);
46  		
47  		testedSurface.cutOpening(cutPoints);
48  		
49  		Point2f[] texCoords = new Point2f[4];
50  		texCoords[0] = new Point2f(0,0);
51  		texCoords[1] = new Point2f(1,0);
52  		texCoords[2] = new Point2f(1,1);
53  		texCoords[3] = new Point2f(0,1);
54  		
55  		testedSurface.createTextureCoords();
56  		testedSurface.createShape();
57  	}
58  
59  }