[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Surface.java,1.12,1.13
Status: Pre-Alpha
Brought to you by:
henryml
From: rimestad <rim...@us...> - 2005-08-26 12:15:23
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23236/model Modified Files: Surface.java Log Message: Changede the calculation of the normal Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Surface.java 25 Aug 2005 14:32:37 -0000 1.12 --- Surface.java 26 Aug 2005 12:15:15 -0000 1.13 *************** *** 132,135 **** --- 132,151 ---- /** + * Get the front Space + * @return The space in front of the surfacespace + */ + public Space getFrontSpace() { + return null; + } + + /** + * Get the rear Space + * @return The rear space + */ + public Space getRearSpace() { + return null; + } + + /** * Returns the normal to this * @return A vector normal for this surface, null if the surface consists of only one edge *************** *** 137,154 **** public Vertex normal() { if (edges.size() > 1) { - Iterator it = edges.iterator(); EdgeFacade ef = EdgeFacade.getInstance(); ! Edge e1 = ef.findById(((Edge)it.next()).getId()); ! Edge e2 = ef.findById(((Edge)it.next()).getId()); Vertex v1 = e1.getFrom(); Vertex v2 = e1.getTo(); ! Vertex v3 = e2.getTo(); ! ! if (v3.equals(v2) || v3.equals(v1)) { ! v3 = e2.getFrom(); } ! Vertex v2v1 = v1.minus(v2); ! Vertex v2v3 = v3.minus(v2); ! return v2v1.cross(v2v3); } return null; --- 153,177 ---- public Vertex normal() { if (edges.size() > 1) { EdgeFacade ef = EdgeFacade.getInstance(); ! Edge e1 = ef.findById(((Edge)edges.get(0)).getId()); ! Edge e2 = ef.findById(((Edge)edges.get(1)).getId()); Vertex v1 = e1.getFrom(); Vertex v2 = e1.getTo(); ! Vertex v3 = null; ! ! if (e2.otherVertex(v1) == null) { ! v3 = e2.otherVertex(v2); ! // v2 is the center ! Vertex v2v1 = v2.minus(v1); ! Vertex v2v3 = v2.minus(v3); ! return v2v3.cross(v2v1); ! } else if (e2.otherVertex(v2) == null) { ! // v1 is the center ! v3 = e2.otherVertex(v1); ! Vertex v1v2 = v1.minus(v2); ! Vertex v1v3 = v1.minus(v3); ! return v1v3.cross(v1v2); } ! return null; } return null; |