private static bool AreEdgesParallelOrIsAtLeastOneAPoint(DecalsMesh a_DecalsMesh, OptimizeEdge a_Edge1, OptimizeEdge a_Edge2) { bool flag = false; Vector3 vector5 = a_DecalsMesh.Vertices[a_Edge1.vertex2Index] - a_DecalsMesh.Vertices[a_Edge1.vertex1Index]; Vector3 vector6 = a_DecalsMesh.Vertices[a_Edge2.vertex2Index] - a_DecalsMesh.Vertices[a_Edge2.vertex1Index]; vector5.Normalize(); vector6.Normalize(); if (Vector3Extension.Approximately(vector5, Vector3.zero, s_CurrentMaximumAbsoluteError, s_CurrentMaximumRelativeError) || Vector3Extension.Approximately(vector6, Vector3.zero, s_CurrentMaximumAbsoluteError, s_CurrentMaximumRelativeError)) { flag = true; } else if (MathfExtension.Approximately(Mathf.Abs(Vector3.Dot(vector5, vector6)), 1f, s_CurrentMaximumAbsoluteError, s_CurrentMaximumRelativeError)) { flag = true; } return(flag); }
public static bool Approximately(Vector2 a_Vector1, Vector2 a_Vector2, float a_MaximumAbsoluteError, float a_MaximumRelativeError) => MathfExtension.Approximately(a_Vector1.x, a_Vector2.x, a_MaximumAbsoluteError, a_MaximumRelativeError) && MathfExtension.Approximately(a_Vector1.y, a_Vector2.y, a_MaximumAbsoluteError, a_MaximumRelativeError);
private bool IsVertexObsolete(DecalsMesh a_DecalsMesh, int a_VertexIndex) { bool flag = false; if (this.m_NeighboringTriangles.Count <= 0) { return(flag); } else { flag = true; bool flag2 = false; Vector3 zero = Vector3.zero; foreach (int num in this.m_NeighboringTriangles) { zero = this.m_TriangleNormals[num]; if (zero != Vector3.zero) { flag2 = true; break; } } if (flag2) { foreach (int num2 in this.m_NeighboringTriangles) { Vector3 rhs = this.m_TriangleNormals[num2]; if ((rhs != Vector3.zero) && !MathfExtension.Approximately(Vector3.Dot(zero, rhs), 1f, DecalsMeshMinimizer.s_CurrentMaximumAbsoluteError, DecalsMeshMinimizer.s_CurrentMaximumRelativeError)) { flag = false; break; } } } if (!flag) { return(flag); } else { float num4 = 0f; int num5 = 0; while (true) { if (num5 >= this.m_NeighboringVertexIndices.Count) { float num7 = 0f; if (!MathfExtension.Approximately(num4, 0f, DecalsMeshMinimizer.s_CurrentMaximumAbsoluteError, DecalsMeshMinimizer.s_CurrentMaximumRelativeError)) { num7 = 1f / num4; } for (int i = 0; i < this.m_NeighboringVertexIndices.Count; i++) { float num9 = this.m_NeighboringVertexDistances[i]; if (!MathfExtension.Approximately(num9, 0f, DecalsMeshMinimizer.s_CurrentMaximumAbsoluteError, DecalsMeshMinimizer.s_CurrentMaximumRelativeError)) { float item = 1f - (num9 / num7); this.m_NeighboringVertexWeight.Add(item); } else { this.m_NeighboringVertexWeight.Add(0f); int num10 = this.m_NeighboringVertexIndices[i]; flag = this.AreVertexPropertiesIdentical(a_DecalsMesh, a_VertexIndex, num10); if (!flag) { break; } } } break; } float num6 = this.m_NeighboringVertexDistances[num5]; num4 += num6; num5++; } } } if (flag) { flag = this.AreWeightedVertexPropertiesApproximatelyVertexProperties(a_DecalsMesh, a_VertexIndex); } return(flag); }