// Token: 0x060042CD RID: 17101 RVA: 0x001566F4 File Offset: 0x00154AF4 public float GetNearestEdge(Ray ray, out PPMesh.HalfEdge minEdge, bool excludeBackSidePolygons) { Vector3 origin = this.Transform.InverseTransformPoint(ray.origin); Vector3 direction = this.Transform.InverseTransformDirection(ray.direction); Ray ray2 = new Ray(origin, direction); float num = float.MaxValue; minEdge = null; foreach (PPMesh.HalfEdge halfEdge in this.edges.Values) { Vector3 vector = this.vertices[halfEdge.point]; Vector3 vector2 = this.vertices[halfEdge.nextEdge.point]; float num2 = MeshUtils.SegmentSegmentDistance2(vector, vector2, ray2.origin, ray2.origin + ray2.direction * 10000f); if (num2 < num) { if (excludeBackSidePolygons) { Vector3 c = this.vertices[halfEdge.nextEdge.nextEdge.point]; if (!PrimitivesPro.Utils.Plane.GetSide(vector, vector2, c, ray2.origin)) { continue; } } num = num2; minEdge = halfEdge; } } return(num); }
// Token: 0x060042D0 RID: 17104 RVA: 0x00156914 File Offset: 0x00154D14 public Vector3[] GetEdgeLine(PPMesh.HalfEdge edge) { Vector3 vector = this.Transform.TransformPoint(this.vertices[edge.point]); Vector3 vector2 = this.Transform.TransformPoint(this.vertices[edge.nextEdge.point]); return(new Vector3[] { vector, vector2 }); }
// Token: 0x060042C9 RID: 17097 RVA: 0x001561FC File Offset: 0x001545FC private void Populate(Mesh mesh) { this.edges = new Dictionary <long, PPMesh.HalfEdge>(mesh.triangles.Length); this.faces = new HashSet <PPMesh.Face>(); this.vertexFaces = new PPMesh.Face[mesh.vertexCount]; this.vertices = new Vector3[mesh.vertexCount]; this.normals = new Vector3[mesh.vertexCount]; this.uvs = new Vector2[mesh.vertexCount]; this.verticesDelta = new HashSet <int>(); Array.Copy(mesh.vertices, this.vertices, mesh.vertexCount); Array.Copy(mesh.normals, this.normals, mesh.vertexCount); Array.Copy(mesh.uv, this.uvs, mesh.vertexCount); int[] triangles = mesh.triangles; for (int i = 0; i < triangles.Length; i += 3) { long key = this.HashEdge(triangles[i], triangles[i + 1]); long key2 = this.HashEdge(triangles[i + 1], triangles[i + 2]); long key3 = this.HashEdge(triangles[i + 2], triangles[i]); PPMesh.Face face = new PPMesh.Face(triangles[i], triangles[i + 1], triangles[i + 2]); PPMesh.HalfEdge halfEdge = new PPMesh.HalfEdge { face = face, point = triangles[i] }; PPMesh.HalfEdge halfEdge2 = new PPMesh.HalfEdge { face = face, point = triangles[i + 1] }; PPMesh.HalfEdge halfEdge3 = new PPMesh.HalfEdge { face = face, point = triangles[i + 2] }; this.vertexFaces[triangles[i]] = face; this.vertexFaces[triangles[i + 1]] = face; this.vertexFaces[triangles[i + 2]] = face; try { halfEdge.nextEdge = halfEdge2; halfEdge2.nextEdge = halfEdge3; halfEdge3.nextEdge = halfEdge; this.edges.Add(key, halfEdge); this.edges.Add(key2, halfEdge2); this.edges.Add(key3, halfEdge3); this.faces.Add(face); } catch { } } foreach (PPMesh.HalfEdge halfEdge4 in this.edges.Values) { int point = halfEdge4.point; int point2 = halfEdge4.nextEdge.point; if (halfEdge4.oppositeEdge == null) { long key4 = this.HashEdge(point2, point); PPMesh.HalfEdge halfEdge5; if (this.edges.TryGetValue(key4, out halfEdge5)) { halfEdge4.oppositeEdge = halfEdge5; halfEdge5.oppositeEdge = halfEdge4; } } } }