Update of /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11398/src/net/sourceforge/bprocessor/model
Modified Files:
CoordinateSystem.java
Log Message:
Added a method to check if a geometric is in the xy plane of the coordinatesystem
Index: CoordinateSystem.java
===================================================================
RCS file: /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model/CoordinateSystem.java,v
retrieving revision 1.55
retrieving revision 1.56
diff -C2 -d -r1.55 -r1.56
*** CoordinateSystem.java 11 Sep 2007 10:59:59 -0000 1.55
--- CoordinateSystem.java 27 Sep 2007 10:41:25 -0000 1.56
***************
*** 15,18 ****
--- 15,20 ----
import java.util.Map;
+ import org.apache.log4j.Logger;
+
/**
* The CoordinateSystem is represented by
***************
*** 25,28 ****
--- 27,33 ----
*/
public class CoordinateSystem extends Constructor {
+ /** The logger */
+ private static Logger log = Logger.getLogger(CoordinateSystem.class);
+
/** The i unit vector (x-direction) */
protected Vertex i;
***************
*** 67,70 ****
--- 72,99 ----
/**
+ * Check if the given geometry is in the xyplane of the coordinatesystem
+ * @param g the geometric to check
+ * @return True if g is in the plane false otherwise
+ */
+ public boolean isInXYPlane(Geometric g) {
+ if (g instanceof Edge) {
+ Edge e = (Edge)g;
+ return isInXYPlane(e.getFrom()) & isInXYPlane(e.getTo());
+ } else if (g instanceof Vertex) {
+ return this.translate((Vertex)g).getZ() == 0.0;
+ } else if (g instanceof Surface) {
+ for (Vertex v : ((Surface)g).getVertices()) {
+ if (!this.isInXYPlane(v)) {
+ return false;
+ }
+ }
+ return true;
+ } else {
+ log.error("The computation of isInXYPlane dont cover " + g.getClass().getSimpleName());
+ }
+ return false;
+ }
+
+ /**
* Returns a CoordinateSystem for the given geometric object.
* @param geometric The geometric object to return a CoordinateSystem for
|