Update of /cvsroot/bprocessor/test/src/net/sourceforge/bprocessor/test
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26131/src/net/sourceforge/bprocessor/test
Added Files:
SurfaceAngle.java
Log Message:
Preserves ordering of created surfaces in extrusion
Added test of normal calculations as preperation for improved version
--- NEW FILE: SurfaceAngle.java ---
//---------------------------------------------------------------------------------
// $Id: SurfaceAngle.java,v 1.1 2006/12/07 00:24:45 henryml Exp $
//
// Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net)
// Released under the Lesser GNU Public License v2.1
//---------------------------------------------------------------------------------
package net.sourceforge.bprocessor.test;
import java.io.File;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import net.sourceforge.bprocessor.model.Entity;
import net.sourceforge.bprocessor.model.Persistence;
import net.sourceforge.bprocessor.model.Project;
import net.sourceforge.bprocessor.model.Surface;
import net.sourceforge.bprocessor.model.Vertex;
/**
*
*/
public class SurfaceAngle {
/**
* @param args args
*/
public static void main(String[] args) {
File input = new File(args[0]);
try {
Persistence.load(input);
printNormals(Project.getInstance().world().getSurfaces());
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Prints the normals of the surfaces
* @param surfaces collection of Surface whose normals are to be printed
*/
private static void printNormals(Collection surfaces) {
List sorted = new LinkedList(surfaces);
Entity.sort(sorted);
Iterator iter = sorted.iterator();
while (iter.hasNext()) {
Surface current = (Surface) iter.next();
Vertex normal = current.normal();
System.out.println(current.getName() + " normal: " + normal);
}
}
}
|