From efd90b56b761219af6425b1c7a2cdd3b6ffb4de2 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Thu, 27 Dec 2007 21:41:48 +0000 Subject: * Optimized usings * shortened references * Removed redundant 'this' * Normalized EOF --- OpenSim/Region/Physics/Meshing/SimpleHull.cs | 120 ++++++++++++++------------- 1 file changed, 62 insertions(+), 58 deletions(-) (limited to 'OpenSim/Region/Physics/Meshing/SimpleHull.cs') diff --git a/OpenSim/Region/Physics/Meshing/SimpleHull.cs b/OpenSim/Region/Physics/Meshing/SimpleHull.cs index a769053..809f3d5 100644 --- a/OpenSim/Region/Physics/Meshing/SimpleHull.cs +++ b/OpenSim/Region/Physics/Meshing/SimpleHull.cs @@ -28,9 +28,8 @@ using System; using System.Collections.Generic; -using System.Text; - using OpenSim.Framework.Console; +using OpenSim.Region.Physics.Manager; namespace OpenSim.Region.Physics.Meshing { @@ -43,17 +42,18 @@ namespace OpenSim.Region.Physics.Meshing // is defined by the hull lies inside or outside the simplex chain public class SimpleHull { - List vertices = new List(); - List holeVertices = new List(); // Only used, when the hull is hollow + private List vertices = new List(); + private List holeVertices = new List(); // Only used, when the hull is hollow // Adds a vertex to the end of the list - public void AddVertex(Vertex v) { + public void AddVertex(Vertex v) + { vertices.Add(v); } - override public String ToString() + public override String ToString() { - String result=""; + String result = ""; foreach (Vertex v in vertices) { result += "b:" + v.ToString() + "\n"; @@ -63,7 +63,8 @@ namespace OpenSim.Region.Physics.Meshing } - public List getVertices() { + public List getVertices() + { List newVertices = new List(); newVertices.AddRange(vertices); @@ -81,27 +82,27 @@ namespace OpenSim.Region.Physics.Meshing result.AddVertex(v.Clone()); } - foreach (Vertex v in this.holeVertices) + foreach (Vertex v in holeVertices) { result.holeVertices.Add(v.Clone()); } - + return result; } public bool IsPointIn(Vertex v1) { - int iCounter=0; - List simplices=buildSimplexList(); + int iCounter = 0; + List simplices = buildSimplexList(); foreach (Simplex s in simplices) { // Send a ray along the positive X-Direction // Note, that this direction must correlate with the "below" interpretation // of handling for the special cases below - Manager.PhysicsVector intersection = s.RayIntersect(v1, new Manager.PhysicsVector(1.0f, 0.0f, 0.0f), true); + PhysicsVector intersection = s.RayIntersect(v1, new PhysicsVector(1.0f, 0.0f, 0.0f), true); if (intersection == null) - continue; // No intersection. Done. More tests to follow otherwise + continue; // No intersection. Done. More tests to follow otherwise // Did we hit the end of a simplex? // Then this can be one of two special cases: @@ -111,19 +112,21 @@ namespace OpenSim.Region.Physics.Meshing // Solution: If the other vertex is "below" the ray, we don't count it // Thus corners pointing down are counted twice, corners pointing up are not counted // borders are counted once - if (intersection.IsIdentical(s.v1, 0.001f)) { + if (intersection.IsIdentical(s.v1, 0.001f)) + { if (s.v2.Y < v1.Y) continue; } // Do this for the other vertex two - if (intersection.IsIdentical(s.v2, 0.001f)) { - if (s.v1.Y buildSimplexList() { - + private List buildSimplexList() + { List result = new List(); // Not asserted but assumed: at least three vertices - for (int i=0; i simple = buildSimplexList(); foreach (Simplex sTest in simple) { - Manager.PhysicsVector vvTemp = Simplex.Intersect(sTest, s, -.001f, -.001f, 0.999f, .999f); - - Vertex vTemp=null; + PhysicsVector vvTemp = Simplex.Intersect(sTest, s, -.001f, -.001f, 0.999f, .999f); + + Vertex vTemp = null; if (vvTemp != null) vTemp = new Vertex(vvTemp); - if (vTemp!=null) { - - Manager.PhysicsVector diff=(s.v1-vTemp); - float distTemp=diff.length(); + if (vTemp != null) + { + PhysicsVector diff = (s.v1 - vTemp); + float distTemp = diff.length(); - if (bestIntersection==null || distTemp