Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: move next halfedge util to global #72

Merged
merged 1 commit into from
Oct 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions Runtime/Triangulator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1357,9 +1357,6 @@ private void BuildInternalConstraints()
internalConstraints.Sort();
}

static int NextHalfedge(int i) => i % 3 == 2 ? i - 2 : i + 1;
static int PrevHalfedge(int i) => i % 3 == 0 ? i + 2 : i - 1;

private void TryApplyConstraint(int i)
{
intersections.Clear();
Expand Down Expand Up @@ -1712,7 +1709,6 @@ public void InsertPoint(float2 p, int tId)
}
eId++;
}
static int NextHalfedge(int i) => i % 3 == 2 ? i - 2 : i + 1;

Triangulator.InsertPoint(p, initTriangles: new() { tId }, triangles, circles, outputPositions, constraintEdges, halfedges, pointToHalfedge);
}
Expand Down Expand Up @@ -2381,7 +2377,6 @@ void VisitEdge(int t0, int t1)
}
}
}
static int NextHalfedge(int i) => i % 3 == 2 ? i - 2 : i + 1;

void ProcessBadTriangles(int pId)
{
Expand Down Expand Up @@ -2508,7 +2503,7 @@ void RemoveHalfedge(int he, int offset)
halfedges[heOffset + 3 * (pathPoints.Length - 1) + 2] = heOffset;
}
}

private static int NextHalfedge(int he) => he % 3 == 2 ? he - 2 : he + 1;
private static float Angle(float2 a, float2 b) => math.atan2(Cross(a, b), math.dot(a, b));
private static float Cross(float2 a, float2 b) => a.x * b.y - a.y * b.x;
private static Circle CalculateCircumCircle(Triangle triangle, NativeArray<float2> outputPositions)
Expand Down