4d225c65f2
- Barotrauma's projects are in the Barotrauma directory - All libraries are in the Libraries directory - MonoGame is now managed by NuGet, rather than referenced from the installed files (TODO: consider using PCL for easier cross-platform development?) - NuGet libraries are not included in the repo, as getting the latest versions automatically should be preferred - Removed Content/effects.mgfx as it didn't seem to be used anywhere - Removed some references to Subsurface directory - Renamed Launcher2 to Launcher
60 lines
1.3 KiB
C#
60 lines
1.3 KiB
C#
using System.Collections.Generic;
|
|
|
|
namespace FarseerPhysics.Common.Decomposition.Seidel
|
|
{
|
|
internal class Edge
|
|
{
|
|
// Pointers used for building trapezoidal map
|
|
public Trapezoid Above;
|
|
public float B;
|
|
public Trapezoid Below;
|
|
|
|
// Montone mountain points
|
|
public HashSet<Point> MPoints;
|
|
public Point P;
|
|
public Point Q;
|
|
|
|
// Slope of the line (m)
|
|
public float Slope;
|
|
|
|
|
|
public Edge(Point p, Point q)
|
|
{
|
|
P = p;
|
|
Q = q;
|
|
|
|
if (q.X - p.X != 0)
|
|
Slope = (q.Y - p.Y) / (q.X - p.X);
|
|
else
|
|
Slope = 0;
|
|
|
|
B = p.Y - (p.X * Slope);
|
|
Above = null;
|
|
Below = null;
|
|
MPoints = new HashSet<Point>();
|
|
MPoints.Add(p);
|
|
MPoints.Add(q);
|
|
}
|
|
|
|
public bool IsAbove(Point point)
|
|
{
|
|
return P.Orient2D(Q, point) < 0;
|
|
}
|
|
|
|
public bool IsBelow(Point point)
|
|
{
|
|
return P.Orient2D(Q, point) > 0;
|
|
}
|
|
|
|
public void AddMpoint(Point point)
|
|
{
|
|
foreach (Point mp in MPoints)
|
|
{
|
|
if (!mp.Neq(point))
|
|
return;
|
|
}
|
|
|
|
MPoints.Add(point);
|
|
}
|
|
}
|
|
} |