diff --git a/CtrEditor.csproj b/CtrEditor.csproj index 365e2d3..ca9b246 100644 --- a/CtrEditor.csproj +++ b/CtrEditor.csproj @@ -77,13 +77,13 @@ - - + + - - - - + + + + diff --git a/Documentation/Aether.Physics2D.txt b/Documentation/Aether.Physics2D.txt new file mode 100644 index 0000000..fc52a68 --- /dev/null +++ b/Documentation/Aether.Physics2D.txt @@ -0,0 +1,1694 @@ + +Esto es .NET 9.0. +--------------------- +Versión del SDK: 9.0.203 + +Telemetría +--------- +Las herramientas de .NET recopilan datos de uso para ayudarnos a mejorar su experiencia. Microsoft los recopila y los comparte con la comunidad. Puede optar por no participar en la telemetría si establece la variable de entorno DOTNET_CLI_TELEMETRY_OPTOUT en "1" o "true" mediante su shell favorito. + +Lea más sobre la telemetría de las herramientas de la CLI de .NET: https://aka.ms/dotnet-cli-telemetry + +---------------- +Instalar un certificado de desarrollo HTTPS de ASP.NET Core. +Para confiar en el certificado, ejecute "dotnet dev-certs https --trust" +Obtenga información sobre HTTPS: https://aka.ms/dotnet-https + +---------------- +Escribir su primera aplicación: https://aka.ms/dotnet-hello-world +Descubra las novedades: https://aka.ms/dotnet-whats-new +Explore la documentación: https://aka.ms/dotnet-docs +Notificar problemas y encontrar el código fuente en GitHub: https://github.com/dotnet/core +Use "dotnet --help" para ver los comandos disponibles o visite: https://aka.ms/dotnet-cli +-------------------------------------------------------------------------------------- +[assembly: System.Runtime.Versioning.TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName=".NET 8.0")] +namespace nkast.Aether.Physics2D.Collision +{ + public struct AABB + { + public nkast.Aether.Physics2D.Common.Vector2 LowerBound; + public nkast.Aether.Physics2D.Common.Vector2 UpperBound; + public AABB(nkast.Aether.Physics2D.Common.Vector2 min, nkast.Aether.Physics2D.Common.Vector2 max) { } + public AABB(ref nkast.Aether.Physics2D.Common.Vector2 min, ref nkast.Aether.Physics2D.Common.Vector2 max) { } + public AABB(nkast.Aether.Physics2D.Common.Vector2 center, float width, float height) { } + public nkast.Aether.Physics2D.Common.Vector2 Center { get; } + public nkast.Aether.Physics2D.Common.Vector2 Extents { get; } + public float Height { get; } + public float Perimeter { get; } + public nkast.Aether.Physics2D.Collision.AABB Q1 { get; } + public nkast.Aether.Physics2D.Collision.AABB Q2 { get; } + public nkast.Aether.Physics2D.Collision.AABB Q3 { get; } + public nkast.Aether.Physics2D.Collision.AABB Q4 { get; } + public nkast.Aether.Physics2D.Common.Vertices Vertices { get; } + public float Width { get; } + public void Combine(ref nkast.Aether.Physics2D.Collision.AABB aabb) { } + public void Combine(ref nkast.Aether.Physics2D.Collision.AABB aabb1, ref nkast.Aether.Physics2D.Collision.AABB aabb2) { } + public bool Contains(ref nkast.Aether.Physics2D.Collision.AABB aabb) { } + public bool Contains(ref nkast.Aether.Physics2D.Common.Vector2 point) { } + public bool IsValid() { } + public bool RayCast(out nkast.Aether.Physics2D.Collision.RayCastOutput output, ref nkast.Aether.Physics2D.Collision.RayCastInput input, bool doInteriorCheck = true) { } + public static bool TestOverlap(ref nkast.Aether.Physics2D.Collision.AABB a, ref nkast.Aether.Physics2D.Collision.AABB b) { } + } + public delegate bool BroadPhaseQueryCallback(int proxyId); + public delegate float BroadPhaseRayCastCallback(ref nkast.Aether.Physics2D.Collision.RayCastInput input, int proxyId); + public delegate void BroadphaseDelegate(int proxyIdA, int proxyIdB); + public struct ClipVertex + { + public nkast.Aether.Physics2D.Collision.ContactID ID; + public nkast.Aether.Physics2D.Common.Vector2 V; + } + public static class Collision + { + public static void CollideCircles(ref nkast.Aether.Physics2D.Collision.Manifold manifold, nkast.Aether.Physics2D.Collision.Shapes.CircleShape circleA, ref nkast.Aether.Physics2D.Common.Transform xfA, nkast.Aether.Physics2D.Collision.Shapes.CircleShape circleB, ref nkast.Aether.Physics2D.Common.Transform xfB) { } + public static void CollideEdgeAndCircle(ref nkast.Aether.Physics2D.Collision.Manifold manifold, nkast.Aether.Physics2D.Collision.Shapes.EdgeShape edgeA, ref nkast.Aether.Physics2D.Common.Transform transformA, nkast.Aether.Physics2D.Collision.Shapes.CircleShape circleB, ref nkast.Aether.Physics2D.Common.Transform transformB) { } + public static void CollideEdgeAndPolygon(ref nkast.Aether.Physics2D.Collision.Manifold manifold, nkast.Aether.Physics2D.Collision.Shapes.EdgeShape edgeA, ref nkast.Aether.Physics2D.Common.Transform xfA, nkast.Aether.Physics2D.Collision.Shapes.PolygonShape polygonB, ref nkast.Aether.Physics2D.Common.Transform xfB) { } + public static void CollidePolygonAndCircle(ref nkast.Aether.Physics2D.Collision.Manifold manifold, nkast.Aether.Physics2D.Collision.Shapes.PolygonShape polygonA, ref nkast.Aether.Physics2D.Common.Transform xfA, nkast.Aether.Physics2D.Collision.Shapes.CircleShape circleB, ref nkast.Aether.Physics2D.Common.Transform xfB) { } + public static void CollidePolygons(ref nkast.Aether.Physics2D.Collision.Manifold manifold, nkast.Aether.Physics2D.Collision.Shapes.PolygonShape polyA, ref nkast.Aether.Physics2D.Common.Transform transformA, nkast.Aether.Physics2D.Collision.Shapes.PolygonShape polyB, ref nkast.Aether.Physics2D.Common.Transform transformB) { } + public static void GetPointStates(out nkast.Aether.Physics2D.Common.FixedArray2 state1, out nkast.Aether.Physics2D.Common.FixedArray2 state2, ref nkast.Aether.Physics2D.Collision.Manifold manifold1, ref nkast.Aether.Physics2D.Collision.Manifold manifold2) { } + public static bool TestOverlap(nkast.Aether.Physics2D.Collision.Shapes.Shape shapeA, int indexA, nkast.Aether.Physics2D.Collision.Shapes.Shape shapeB, int indexB, ref nkast.Aether.Physics2D.Common.Transform xfA, ref nkast.Aether.Physics2D.Common.Transform xfB) { } + } + public struct ContactFeature + { + public byte IndexA; + public byte IndexB; + public byte TypeA; + public byte TypeB; + } + public struct ContactID + { + public nkast.Aether.Physics2D.Collision.ContactFeature Features; + public uint Key; + } + public static class Distance + { + [System.ThreadStatic] + public static int GJKCalls; + [System.ThreadStatic] + public static int GJKIters; + [System.ThreadStatic] + public static int GJKMaxIters; + public static void ComputeDistance(out nkast.Aether.Physics2D.Collision.DistanceOutput output, out nkast.Aether.Physics2D.Collision.SimplexCache cache, nkast.Aether.Physics2D.Collision.DistanceInput input) { } + } + public struct DistanceInput + { + public nkast.Aether.Physics2D.Collision.DistanceProxy ProxyA; + public nkast.Aether.Physics2D.Collision.DistanceProxy ProxyB; + public nkast.Aether.Physics2D.Common.Transform TransformA; + public nkast.Aether.Physics2D.Common.Transform TransformB; + public bool UseRadii; + } + public struct DistanceOutput + { + public float Distance; + public int Iterations; + public nkast.Aether.Physics2D.Common.Vector2 PointA; + public nkast.Aether.Physics2D.Common.Vector2 PointB; + } + public struct DistanceProxy + { + public DistanceProxy(nkast.Aether.Physics2D.Collision.Shapes.Shape shape, int index) { } + public int GetSupport(nkast.Aether.Physics2D.Common.Vector2 direction) { } + public nkast.Aether.Physics2D.Common.Vector2 GetSupportVertex(nkast.Aether.Physics2D.Common.Vector2 direction) { } + } + public class DynamicTreeBroadPhase : nkast.Aether.Physics2D.Collision.DynamicTreeBroadPhase, nkast.Aether.Physics2D.Collision.IBroadPhase, nkast.Aether.Physics2D.Collision.IBroadPhase + { + public DynamicTreeBroadPhase() { } + } + public class DynamicTreeBroadPhase : nkast.Aether.Physics2D.Collision.IBroadPhase + where TNode : struct + { + public DynamicTreeBroadPhase() { } + public int ProxyCount { get; } + public int TreeBalance { get; } + public int TreeHeight { get; } + public float TreeQuality { get; } + public int AddProxy(ref nkast.Aether.Physics2D.Collision.AABB aabb) { } + public void GetFatAABB(int proxyId, out nkast.Aether.Physics2D.Collision.AABB aabb) { } + public TNode GetProxy(int proxyId) { } + public void MoveProxy(int proxyId, ref nkast.Aether.Physics2D.Collision.AABB aabb, nkast.Aether.Physics2D.Common.Vector2 displacement) { } + public void Query(nkast.Aether.Physics2D.Collision.BroadPhaseQueryCallback callback, ref nkast.Aether.Physics2D.Collision.AABB aabb) { } + public void RayCast(nkast.Aether.Physics2D.Collision.BroadPhaseRayCastCallback callback, ref nkast.Aether.Physics2D.Collision.RayCastInput input) { } + public void RemoveProxy(int proxyId) { } + public void SetProxy(int proxyId, ref TNode proxy) { } + public void ShiftOrigin(nkast.Aether.Physics2D.Common.Vector2 newOrigin) { } + public bool TestOverlap(int proxyIdA, int proxyIdB) { } + public void TouchProxy(int proxyId) { } + public void UpdatePairs(nkast.Aether.Physics2D.Collision.BroadphaseDelegate callback) { } + } + public class DynamicTree + { + public DynamicTree() { } + public float AreaRatio { get; } + public int Height { get; } + public int MaxBalance { get; } + public int AddProxy(ref nkast.Aether.Physics2D.Collision.AABB aabb) { } + public int ComputeHeight() { } + public int ComputeHeight(int nodeId) { } + public nkast.Aether.Physics2D.Collision.AABB GetFatAABB(int proxyId) { } + public void GetFatAABB(int proxyId, out nkast.Aether.Physics2D.Collision.AABB fatAABB) { } + public TNode GetUserData(int proxyId) { } + public bool MoveProxy(int proxyId, ref nkast.Aether.Physics2D.Collision.AABB aabb, nkast.Aether.Physics2D.Common.Vector2 displacement) { } + public void Query(nkast.Aether.Physics2D.Collision.BroadPhaseQueryCallback callback, ref nkast.Aether.Physics2D.Collision.AABB aabb) { } + public void RayCast(nkast.Aether.Physics2D.Collision.BroadPhaseRayCastCallback callback, ref nkast.Aether.Physics2D.Collision.RayCastInput input) { } + public void RebuildBottomUp() { } + public void RemoveProxy(int proxyId) { } + public void SetUserData(int proxyId, TNode userData) { } + public void ShiftOrigin(nkast.Aether.Physics2D.Common.Vector2 newOrigin) { } + public bool TestFatAABBOverlap(int proxyIdA, int proxyIdB) { } + public void Validate() { } + public void ValidateMetrics(int index) { } + public void ValidateStructure(int index) { } + } + public struct EPAxis + { + public int Index; + public float Separation; + public nkast.Aether.Physics2D.Collision.EPAxisType Type; + } + public enum EPAxisType + { + Unknown = 0, + EdgeA = 1, + EdgeB = 2, + } + public interface IBroadPhase : nkast.Aether.Physics2D.Collision.IBroadPhase { } + public interface IBroadPhase + where TNode : struct + { + int ProxyCount { get; } + int AddProxy(ref nkast.Aether.Physics2D.Collision.AABB aabb); + void GetFatAABB(int proxyId, out nkast.Aether.Physics2D.Collision.AABB aabb); + TNode GetProxy(int proxyId); + void MoveProxy(int proxyId, ref nkast.Aether.Physics2D.Collision.AABB aabb, nkast.Aether.Physics2D.Common.Vector2 displacement); + void Query(nkast.Aether.Physics2D.Collision.BroadPhaseQueryCallback callback, ref nkast.Aether.Physics2D.Collision.AABB aabb); + void RayCast(nkast.Aether.Physics2D.Collision.BroadPhaseRayCastCallback callback, ref nkast.Aether.Physics2D.Collision.RayCastInput input); + void RemoveProxy(int proxyId); + void SetProxy(int proxyId, ref TNode proxy); + void ShiftOrigin(nkast.Aether.Physics2D.Common.Vector2 newOrigin); + bool TestOverlap(int proxyIdA, int proxyIdB); + void TouchProxy(int proxyId); + void UpdatePairs(nkast.Aether.Physics2D.Collision.BroadphaseDelegate callback); + } + public struct Manifold + { + public nkast.Aether.Physics2D.Common.Vector2 LocalNormal; + public nkast.Aether.Physics2D.Common.Vector2 LocalPoint; + public int PointCount; + public nkast.Aether.Physics2D.Common.FixedArray2 Points; + public nkast.Aether.Physics2D.Collision.ManifoldType Type; + } + public struct ManifoldPoint + { + public nkast.Aether.Physics2D.Collision.ContactID Id; + public nkast.Aether.Physics2D.Common.Vector2 LocalPoint; + public float NormalImpulse; + public float TangentImpulse; + } + public enum ManifoldType + { + Circles = 0, + FaceA = 1, + FaceB = 2, + } + public enum PointState + { + Null = 0, + Add = 1, + Persist = 2, + Remove = 3, + } + public struct RayCastInput + { + public float MaxFraction; + public nkast.Aether.Physics2D.Common.Vector2 Point1; + public nkast.Aether.Physics2D.Common.Vector2 Point2; + } + public struct RayCastOutput + { + public float Fraction; + public nkast.Aether.Physics2D.Common.Vector2 Normal; + } + public struct ReferenceFace + { + public int i1; + public int i2; + public nkast.Aether.Physics2D.Common.Vector2 normal; + public nkast.Aether.Physics2D.Common.Vector2 sideNormal1; + public nkast.Aether.Physics2D.Common.Vector2 sideNormal2; + public float sideOffset1; + public float sideOffset2; + public nkast.Aether.Physics2D.Common.Vector2 v1; + public nkast.Aether.Physics2D.Common.Vector2 v2; + } + public static class SeparationFunction + { + public static float Evaluate(int indexA, int indexB, float t) { } + public static float FindMinSeparation(out int indexA, out int indexB, float t) { } + public static void Set(ref nkast.Aether.Physics2D.Collision.SimplexCache cache, ref nkast.Aether.Physics2D.Collision.DistanceProxy proxyA, ref nkast.Aether.Physics2D.Common.Sweep sweepA, ref nkast.Aether.Physics2D.Collision.DistanceProxy proxyB, ref nkast.Aether.Physics2D.Common.Sweep sweepB, float t1) { } + } + public enum SeparationFunctionType + { + Points = 0, + FaceA = 1, + FaceB = 2, + } + public struct SimplexCache + { + public ushort Count; + public nkast.Aether.Physics2D.Common.FixedArray3 IndexA; + public nkast.Aether.Physics2D.Common.FixedArray3 IndexB; + public float Metric; + } + public class TOIInput + { + public nkast.Aether.Physics2D.Collision.DistanceProxy ProxyA; + public nkast.Aether.Physics2D.Collision.DistanceProxy ProxyB; + public nkast.Aether.Physics2D.Common.Sweep SweepA; + public nkast.Aether.Physics2D.Common.Sweep SweepB; + public float TMax; + public TOIInput() { } + } + public struct TOIOutput + { + public nkast.Aether.Physics2D.Collision.TOIOutputState State; + public float T; + } + public enum TOIOutputState + { + Unknown = 0, + Failed = 1, + Overlapped = 2, + Touching = 3, + Seperated = 4, + } + public static class TimeOfImpact + { + [System.ThreadStatic] + public static int TOICalls; + [System.ThreadStatic] + public static int TOIIters; + [System.ThreadStatic] + public static int TOIMaxIters; + [System.ThreadStatic] + public static int TOIMaxRootIters; + [System.ThreadStatic] + public static int TOIRootIters; + public static void CalculateTimeOfImpact(out nkast.Aether.Physics2D.Collision.TOIOutput output, ref nkast.Aether.Physics2D.Collision.TOIInput input) { } + } +} +namespace nkast.Aether.Physics2D.Collision.Shapes +{ + public class ChainShape : nkast.Aether.Physics2D.Collision.Shapes.Shape + { + public nkast.Aether.Physics2D.Common.Vertices Vertices; + public ChainShape() { } + public ChainShape(nkast.Aether.Physics2D.Common.Vertices vertices, bool createLoop = false) { } + public override int ChildCount { get; } + public nkast.Aether.Physics2D.Common.Vector2 NextVertex { get; set; } + public nkast.Aether.Physics2D.Common.Vector2 PrevVertex { get; set; } + public override nkast.Aether.Physics2D.Collision.Shapes.Shape Clone() { } + public bool CompareTo(nkast.Aether.Physics2D.Collision.Shapes.ChainShape shape) { } + public override void ComputeAABB(out nkast.Aether.Physics2D.Collision.AABB aabb, ref nkast.Aether.Physics2D.Common.Transform transform, int childIndex) { } + protected override void ComputeProperties() { } + public override float ComputeSubmergedArea(ref nkast.Aether.Physics2D.Common.Vector2 normal, float offset, ref nkast.Aether.Physics2D.Common.Transform xf, out nkast.Aether.Physics2D.Common.Vector2 sc) { } + public nkast.Aether.Physics2D.Collision.Shapes.EdgeShape GetChildEdge(int index) { } + public override bool RayCast(out nkast.Aether.Physics2D.Collision.RayCastOutput output, ref nkast.Aether.Physics2D.Collision.RayCastInput input, ref nkast.Aether.Physics2D.Common.Transform transform, int childIndex) { } + public override bool TestPoint(ref nkast.Aether.Physics2D.Common.Transform transform, ref nkast.Aether.Physics2D.Common.Vector2 point) { } + } + public class CircleShape : nkast.Aether.Physics2D.Collision.Shapes.Shape + { + public CircleShape(float radius, float density) { } + public override int ChildCount { get; } + public nkast.Aether.Physics2D.Common.Vector2 Position { get; set; } + public override nkast.Aether.Physics2D.Collision.Shapes.Shape Clone() { } + public bool CompareTo(nkast.Aether.Physics2D.Collision.Shapes.CircleShape shape) { } + public override void ComputeAABB(out nkast.Aether.Physics2D.Collision.AABB aabb, ref nkast.Aether.Physics2D.Common.Transform transform, int childIndex) { } + protected override sealed void ComputeProperties() { } + public override float ComputeSubmergedArea(ref nkast.Aether.Physics2D.Common.Vector2 normal, float offset, ref nkast.Aether.Physics2D.Common.Transform xf, out nkast.Aether.Physics2D.Common.Vector2 sc) { } + public override bool RayCast(out nkast.Aether.Physics2D.Collision.RayCastOutput output, ref nkast.Aether.Physics2D.Collision.RayCastInput input, ref nkast.Aether.Physics2D.Common.Transform transform, int childIndex) { } + public override bool TestPoint(ref nkast.Aether.Physics2D.Common.Transform transform, ref nkast.Aether.Physics2D.Common.Vector2 point) { } + } + public class EdgeShape : nkast.Aether.Physics2D.Collision.Shapes.Shape + { + public EdgeShape(nkast.Aether.Physics2D.Common.Vector2 start, nkast.Aether.Physics2D.Common.Vector2 end) { } + public override int ChildCount { get; } + public bool HasVertex0 { get; set; } + public bool HasVertex3 { get; set; } + public nkast.Aether.Physics2D.Common.Vector2 Vertex0 { get; set; } + public nkast.Aether.Physics2D.Common.Vector2 Vertex1 { get; set; } + public nkast.Aether.Physics2D.Common.Vector2 Vertex2 { get; set; } + public nkast.Aether.Physics2D.Common.Vector2 Vertex3 { get; set; } + public override nkast.Aether.Physics2D.Collision.Shapes.Shape Clone() { } + public bool CompareTo(nkast.Aether.Physics2D.Collision.Shapes.EdgeShape shape) { } + public override void ComputeAABB(out nkast.Aether.Physics2D.Collision.AABB aabb, ref nkast.Aether.Physics2D.Common.Transform transform, int childIndex) { } + protected override void ComputeProperties() { } + public override float ComputeSubmergedArea(ref nkast.Aether.Physics2D.Common.Vector2 normal, float offset, ref nkast.Aether.Physics2D.Common.Transform xf, out nkast.Aether.Physics2D.Common.Vector2 sc) { } + public override bool RayCast(out nkast.Aether.Physics2D.Collision.RayCastOutput output, ref nkast.Aether.Physics2D.Collision.RayCastInput input, ref nkast.Aether.Physics2D.Common.Transform transform, int childIndex) { } + public void Set(nkast.Aether.Physics2D.Common.Vector2 start, nkast.Aether.Physics2D.Common.Vector2 end) { } + public override bool TestPoint(ref nkast.Aether.Physics2D.Common.Transform transform, ref nkast.Aether.Physics2D.Common.Vector2 point) { } + } + public struct MassData : System.IEquatable + { + public float Area { get; } + public nkast.Aether.Physics2D.Common.Vector2 Centroid { get; } + public float Inertia { get; } + public float Mass { get; } + public bool Equals(nkast.Aether.Physics2D.Collision.Shapes.MassData other) { } + public override bool Equals(object obj) { } + public override int GetHashCode() { } + public static bool operator !=(nkast.Aether.Physics2D.Collision.Shapes.MassData left, nkast.Aether.Physics2D.Collision.Shapes.MassData right) { } + public static bool operator ==(nkast.Aether.Physics2D.Collision.Shapes.MassData left, nkast.Aether.Physics2D.Collision.Shapes.MassData right) { } + } + public class PolygonShape : nkast.Aether.Physics2D.Collision.Shapes.Shape + { + public PolygonShape(float density) { } + public PolygonShape(nkast.Aether.Physics2D.Common.Vertices vertices, float density) { } + public override int ChildCount { get; } + public nkast.Aether.Physics2D.Common.Vertices Normals { get; } + public nkast.Aether.Physics2D.Common.Vertices Vertices { get; set; } + public override nkast.Aether.Physics2D.Collision.Shapes.Shape Clone() { } + public bool CompareTo(nkast.Aether.Physics2D.Collision.Shapes.PolygonShape shape) { } + public override void ComputeAABB(out nkast.Aether.Physics2D.Collision.AABB aabb, ref nkast.Aether.Physics2D.Common.Transform transform, int childIndex) { } + protected override void ComputeProperties() { } + public override float ComputeSubmergedArea(ref nkast.Aether.Physics2D.Common.Vector2 normal, float offset, ref nkast.Aether.Physics2D.Common.Transform xf, out nkast.Aether.Physics2D.Common.Vector2 sc) { } + public override bool RayCast(out nkast.Aether.Physics2D.Collision.RayCastOutput output, ref nkast.Aether.Physics2D.Collision.RayCastInput input, ref nkast.Aether.Physics2D.Common.Transform transform, int childIndex) { } + public override bool TestPoint(ref nkast.Aether.Physics2D.Common.Transform transform, ref nkast.Aether.Physics2D.Common.Vector2 point) { } + } + public abstract class Shape + { + public nkast.Aether.Physics2D.Collision.Shapes.MassData MassData; + protected Shape(float density) { } + public abstract int ChildCount { get; } + public float Density { get; set; } + public float Radius { get; set; } + public nkast.Aether.Physics2D.Collision.Shapes.ShapeType ShapeType { get; } + public abstract nkast.Aether.Physics2D.Collision.Shapes.Shape Clone(); + public abstract void ComputeAABB(out nkast.Aether.Physics2D.Collision.AABB aabb, ref nkast.Aether.Physics2D.Common.Transform transform, int childIndex); + protected abstract void ComputeProperties(); + public abstract float ComputeSubmergedArea(ref nkast.Aether.Physics2D.Common.Vector2 normal, float offset, ref nkast.Aether.Physics2D.Common.Transform xf, out nkast.Aether.Physics2D.Common.Vector2 sc); + public abstract bool RayCast(out nkast.Aether.Physics2D.Collision.RayCastOutput output, ref nkast.Aether.Physics2D.Collision.RayCastInput input, ref nkast.Aether.Physics2D.Common.Transform transform, int childIndex); + public abstract bool TestPoint(ref nkast.Aether.Physics2D.Common.Transform transform, ref nkast.Aether.Physics2D.Common.Vector2 point); + } + public enum ShapeType + { + Unknown = -1, + Circle = 0, + Edge = 1, + Polygon = 2, + Chain = 3, + TypeCount = 4, + } +} +namespace nkast.Aether.Physics2D.Common +{ + public struct Complex + { + public float R; + public float i; + public Complex(float real, float imaginary) { } + public float Magnitude { get; } + public float Phase { get; set; } + public static nkast.Aether.Physics2D.Common.Complex ImaginaryOne { get; } + public static nkast.Aether.Physics2D.Common.Complex One { get; } + public void Conjugate() { } + public float MagnitudeSquared() { } + public void Negate() { } + public void Normalize() { } + public override string ToString() { } + public nkast.Aether.Physics2D.Common.Vector2 ToVector2() { } + public static nkast.Aether.Physics2D.Common.Complex Conjugate(ref nkast.Aether.Physics2D.Common.Complex value) { } + public static nkast.Aether.Physics2D.Common.Complex Divide(ref nkast.Aether.Physics2D.Common.Complex left, ref nkast.Aether.Physics2D.Common.Complex right) { } + public static nkast.Aether.Physics2D.Common.Vector2 Divide(ref nkast.Aether.Physics2D.Common.Vector2 left, ref nkast.Aether.Physics2D.Common.Complex right) { } + public static nkast.Aether.Physics2D.Common.Vector2 Divide(nkast.Aether.Physics2D.Common.Vector2 left, ref nkast.Aether.Physics2D.Common.Complex right) { } + public static void Divide(ref nkast.Aether.Physics2D.Common.Complex left, ref nkast.Aether.Physics2D.Common.Complex right, out nkast.Aether.Physics2D.Common.Complex result) { } + public static void Divide(nkast.Aether.Physics2D.Common.Vector2 left, ref nkast.Aether.Physics2D.Common.Complex right, out nkast.Aether.Physics2D.Common.Vector2 result) { } + public static nkast.Aether.Physics2D.Common.Complex FromAngle(float angle) { } + public static nkast.Aether.Physics2D.Common.Complex Multiply(ref nkast.Aether.Physics2D.Common.Complex left, ref nkast.Aether.Physics2D.Common.Complex right) { } + public static nkast.Aether.Physics2D.Common.Vector2 Multiply(ref nkast.Aether.Physics2D.Common.Vector2 left, ref nkast.Aether.Physics2D.Common.Complex right) { } + public static nkast.Aether.Physics2D.Common.Vector2 Multiply(nkast.Aether.Physics2D.Common.Vector2 left, ref nkast.Aether.Physics2D.Common.Complex right) { } + public static void Multiply(ref nkast.Aether.Physics2D.Common.Vector2 left, ref nkast.Aether.Physics2D.Common.Complex right, out nkast.Aether.Physics2D.Common.Vector2 result) { } + public static nkast.Aether.Physics2D.Common.Complex Negate(ref nkast.Aether.Physics2D.Common.Complex value) { } + public static nkast.Aether.Physics2D.Common.Complex Normalize(ref nkast.Aether.Physics2D.Common.Complex value) { } + } + public struct FixedArray2 + { + public T this[int index] { get; set; } + } + public struct FixedArray3 + { + public T this[int index] { get; set; } + } + public struct FixedArray4 + { + public T this[int index] { get; set; } + } + public struct FixedArray8 + { + public T this[int index] { get; set; } + } + public static class LineTools + { + public static float DistanceBetweenPointAndLineSegment(ref nkast.Aether.Physics2D.Common.Vector2 point, ref nkast.Aether.Physics2D.Common.Vector2 start, ref nkast.Aether.Physics2D.Common.Vector2 end) { } + public static nkast.Aether.Physics2D.Common.Vector2 LineIntersect(nkast.Aether.Physics2D.Common.Vector2 p1, nkast.Aether.Physics2D.Common.Vector2 p2, nkast.Aether.Physics2D.Common.Vector2 q1, nkast.Aether.Physics2D.Common.Vector2 q2) { } + public static bool LineIntersect(ref nkast.Aether.Physics2D.Common.Vector2 point1, ref nkast.Aether.Physics2D.Common.Vector2 point2, ref nkast.Aether.Physics2D.Common.Vector2 point3, ref nkast.Aether.Physics2D.Common.Vector2 point4, out nkast.Aether.Physics2D.Common.Vector2 intersectionPoint) { } + public static bool LineIntersect(nkast.Aether.Physics2D.Common.Vector2 point1, nkast.Aether.Physics2D.Common.Vector2 point2, nkast.Aether.Physics2D.Common.Vector2 point3, nkast.Aether.Physics2D.Common.Vector2 point4, out nkast.Aether.Physics2D.Common.Vector2 intersectionPoint) { } + public static bool LineIntersect(nkast.Aether.Physics2D.Common.Vector2 point1, nkast.Aether.Physics2D.Common.Vector2 point2, nkast.Aether.Physics2D.Common.Vector2 point3, nkast.Aether.Physics2D.Common.Vector2 point4, bool firstIsSegment, bool secondIsSegment, out nkast.Aether.Physics2D.Common.Vector2 intersectionPoint) { } + public static bool LineIntersect(ref nkast.Aether.Physics2D.Common.Vector2 point1, ref nkast.Aether.Physics2D.Common.Vector2 point2, ref nkast.Aether.Physics2D.Common.Vector2 point3, ref nkast.Aether.Physics2D.Common.Vector2 point4, bool firstIsSegment, bool secondIsSegment, out nkast.Aether.Physics2D.Common.Vector2 point) { } + public static bool LineIntersect2(ref nkast.Aether.Physics2D.Common.Vector2 a0, ref nkast.Aether.Physics2D.Common.Vector2 a1, ref nkast.Aether.Physics2D.Common.Vector2 b0, ref nkast.Aether.Physics2D.Common.Vector2 b1, out nkast.Aether.Physics2D.Common.Vector2 intersectionPoint) { } + public static nkast.Aether.Physics2D.Common.Vertices LineSegmentAABBIntersect(ref nkast.Aether.Physics2D.Common.Vector2 point1, ref nkast.Aether.Physics2D.Common.Vector2 point2, nkast.Aether.Physics2D.Collision.AABB aabb) { } + public static nkast.Aether.Physics2D.Common.Vertices LineSegmentVerticesIntersect(ref nkast.Aether.Physics2D.Common.Vector2 point1, ref nkast.Aether.Physics2D.Common.Vector2 point2, nkast.Aether.Physics2D.Common.Vertices vertices) { } + } + public struct Mat22 + { + public nkast.Aether.Physics2D.Common.Vector2 ex; + public nkast.Aether.Physics2D.Common.Vector2 ey; + public Mat22(nkast.Aether.Physics2D.Common.Vector2 c1, nkast.Aether.Physics2D.Common.Vector2 c2) { } + public Mat22(float a11, float a12, float a21, float a22) { } + public nkast.Aether.Physics2D.Common.Mat22 Inverse { get; } + public void Set(nkast.Aether.Physics2D.Common.Vector2 c1, nkast.Aether.Physics2D.Common.Vector2 c2) { } + public void SetIdentity() { } + public void SetZero() { } + public nkast.Aether.Physics2D.Common.Vector2 Solve(nkast.Aether.Physics2D.Common.Vector2 b) { } + public static void Add(ref nkast.Aether.Physics2D.Common.Mat22 A, ref nkast.Aether.Physics2D.Common.Mat22 B, out nkast.Aether.Physics2D.Common.Mat22 R) { } + } + public struct Mat33 + { + public nkast.Aether.Physics2D.Common.Vector3 ex; + public nkast.Aether.Physics2D.Common.Vector3 ey; + public nkast.Aether.Physics2D.Common.Vector3 ez; + public Mat33(nkast.Aether.Physics2D.Common.Vector3 c1, nkast.Aether.Physics2D.Common.Vector3 c2, nkast.Aether.Physics2D.Common.Vector3 c3) { } + public void GetInverse22(ref nkast.Aether.Physics2D.Common.Mat33 M) { } + public void GetSymInverse33(ref nkast.Aether.Physics2D.Common.Mat33 M) { } + public void SetZero() { } + public nkast.Aether.Physics2D.Common.Vector2 Solve22(nkast.Aether.Physics2D.Common.Vector2 b) { } + public nkast.Aether.Physics2D.Common.Vector3 Solve33(nkast.Aether.Physics2D.Common.Vector3 b) { } + } + public static class MathUtils + { + public static nkast.Aether.Physics2D.Common.Vector2 Abs(nkast.Aether.Physics2D.Common.Vector2 v) { } + public static float Area(nkast.Aether.Physics2D.Common.Vector2 a, nkast.Aether.Physics2D.Common.Vector2 b, nkast.Aether.Physics2D.Common.Vector2 c) { } + public static float Area(ref nkast.Aether.Physics2D.Common.Vector2 a, ref nkast.Aether.Physics2D.Common.Vector2 b, ref nkast.Aether.Physics2D.Common.Vector2 c) { } + public static float Clamp(float a, float low, float high) { } + public static int Clamp(int a, int low, int high) { } + public static nkast.Aether.Physics2D.Common.Vector2 Clamp(nkast.Aether.Physics2D.Common.Vector2 a, nkast.Aether.Physics2D.Common.Vector2 low, nkast.Aether.Physics2D.Common.Vector2 high) { } + public static nkast.Aether.Physics2D.Common.Vector2 Cross(float s, ref nkast.Aether.Physics2D.Common.Vector2 a) { } + public static nkast.Aether.Physics2D.Common.Vector2 Cross(nkast.Aether.Physics2D.Common.Vector2 a, float s) { } + public static float Cross(ref nkast.Aether.Physics2D.Common.Vector2 a, ref nkast.Aether.Physics2D.Common.Vector2 b) { } + public static float Cross(nkast.Aether.Physics2D.Common.Vector2 a, nkast.Aether.Physics2D.Common.Vector2 b) { } + public static nkast.Aether.Physics2D.Common.Vector3 Cross(ref nkast.Aether.Physics2D.Common.Vector3 a, ref nkast.Aether.Physics2D.Common.Vector3 b) { } + public static void Cross(float s, ref nkast.Aether.Physics2D.Common.Vector2 a, out nkast.Aether.Physics2D.Common.Vector2 b) { } + public static void Cross(ref nkast.Aether.Physics2D.Common.Vector2 a, ref nkast.Aether.Physics2D.Common.Vector2 b, out float c) { } + public static float Dot(nkast.Aether.Physics2D.Common.Vector2 a, ref nkast.Aether.Physics2D.Common.Vector2 b) { } + public static float Dot(nkast.Aether.Physics2D.Common.Vector3 a, nkast.Aether.Physics2D.Common.Vector3 b) { } + public static bool FloatEquals(float value1, float value2) { } + public static bool FloatEquals(float value1, float value2, float delta) { } + public static bool FloatInRange(float value, float min, float max) { } + public static bool IsCollinear(ref nkast.Aether.Physics2D.Common.Vector2 a, ref nkast.Aether.Physics2D.Common.Vector2 b, ref nkast.Aether.Physics2D.Common.Vector2 c, float tolerance = 0) { } + public static bool IsValid(float x) { } + public static bool IsValid(this nkast.Aether.Physics2D.Common.Vector2 x) { } + public static nkast.Aether.Physics2D.Common.Vector2 Mul(ref nkast.Aether.Physics2D.Common.Mat22 A, nkast.Aether.Physics2D.Common.Vector2 v) { } + public static nkast.Aether.Physics2D.Common.Vector2 Mul(ref nkast.Aether.Physics2D.Common.Mat22 A, ref nkast.Aether.Physics2D.Common.Vector2 v) { } + public static nkast.Aether.Physics2D.Common.Vector3 Mul(nkast.Aether.Physics2D.Common.Mat33 A, nkast.Aether.Physics2D.Common.Vector3 v) { } + public static nkast.Aether.Physics2D.Common.Vector2 Mul22(nkast.Aether.Physics2D.Common.Mat33 A, nkast.Aether.Physics2D.Common.Vector2 v) { } + public static nkast.Aether.Physics2D.Common.Vector2 MulT(ref nkast.Aether.Physics2D.Common.Mat22 A, nkast.Aether.Physics2D.Common.Vector2 v) { } + public static nkast.Aether.Physics2D.Common.Vector2 MulT(ref nkast.Aether.Physics2D.Common.Mat22 A, ref nkast.Aether.Physics2D.Common.Vector2 v) { } + public static void MulT(ref nkast.Aether.Physics2D.Common.Mat22 A, ref nkast.Aether.Physics2D.Common.Mat22 B, out nkast.Aether.Physics2D.Common.Mat22 C) { } + public static nkast.Aether.Physics2D.Common.Vector2 Rot270(ref nkast.Aether.Physics2D.Common.Vector2 a) { } + public static nkast.Aether.Physics2D.Common.Vector2 Rot90(ref nkast.Aether.Physics2D.Common.Vector2 a) { } + public static nkast.Aether.Physics2D.Common.Vector2 Skew(nkast.Aether.Physics2D.Common.Vector2 input) { } + public static void Swap(ref T a, ref T b) { } + public static double VectorAngle(ref nkast.Aether.Physics2D.Common.Vector2 p1, ref nkast.Aether.Physics2D.Common.Vector2 p2) { } + public static double VectorAngle(nkast.Aether.Physics2D.Common.Vector2 p1, nkast.Aether.Physics2D.Common.Vector2 p2) { } + } + public class Path + { + public System.Collections.Generic.List ControlPoints; + public Path() { } + public Path(System.Collections.Generic.IList vertices) { } + public Path(nkast.Aether.Physics2D.Common.Vector2[] vertices) { } + public bool Closed { get; set; } + public void Add(nkast.Aether.Physics2D.Common.Vector2 point) { } + public float GetLength() { } + public nkast.Aether.Physics2D.Common.Vector2 GetPosition(float time) { } + public nkast.Aether.Physics2D.Common.Vector2 GetPositionNormal(float time) { } + public nkast.Aether.Physics2D.Common.Vertices GetVertices(int divisions) { } + public int NextIndex(int index) { } + public int PreviousIndex(int index) { } + public void Remove(nkast.Aether.Physics2D.Common.Vector2 point) { } + public void RemoveAt(int index) { } + public void Rotate(float value) { } + public void Scale(ref nkast.Aether.Physics2D.Common.Vector2 value) { } + public System.Collections.Generic.List SubdivideEvenly(int divisions) { } + public override string ToString() { } + public void Translate(ref nkast.Aether.Physics2D.Common.Vector2 vector) { } + } + public static class PathManager + { + public static System.Collections.Generic.List AttachBodiesWithRevoluteJoint(nkast.Aether.Physics2D.Dynamics.World world, System.Collections.Generic.List bodies, nkast.Aether.Physics2D.Common.Vector2 localAnchorA, nkast.Aether.Physics2D.Common.Vector2 localAnchorB, bool connectFirstAndLast, bool collideConnected) { } + public static void ConvertPathToEdges(nkast.Aether.Physics2D.Common.Path path, nkast.Aether.Physics2D.Dynamics.Body body, int subdivisions) { } + public static void ConvertPathToPolygon(nkast.Aether.Physics2D.Common.Path path, nkast.Aether.Physics2D.Dynamics.Body body, float density, int subdivisions) { } + public static System.Collections.Generic.List EvenlyDistributeShapesAlongPath(nkast.Aether.Physics2D.Dynamics.World world, nkast.Aether.Physics2D.Common.Path path, System.Collections.Generic.IEnumerable shapes, nkast.Aether.Physics2D.Dynamics.BodyType type, int copies, object userData = null) { } + public static System.Collections.Generic.List EvenlyDistributeShapesAlongPath(nkast.Aether.Physics2D.Dynamics.World world, nkast.Aether.Physics2D.Common.Path path, nkast.Aether.Physics2D.Collision.Shapes.Shape shape, nkast.Aether.Physics2D.Dynamics.BodyType type, int copies, object userData = null) { } + public static void MoveBodyOnPath(nkast.Aether.Physics2D.Common.Path path, nkast.Aether.Physics2D.Dynamics.Body body, float time, float strength, float timeStep) { } + public enum LinkType + { + Revolute = 0, + Slider = 1, + } + } + public enum PolygonError + { + NoError = 0, + InvalidAmountOfVertices = 1, + NotSimple = 2, + NotCounterClockWise = 3, + NotConvex = 4, + AreaTooSmall = 5, + SideTooSmall = 6, + } + public static class PolygonTools + { + public static nkast.Aether.Physics2D.Common.Vertices CreateArc(float radians, int sides, float radius) { } + public static nkast.Aether.Physics2D.Common.Vertices CreateCapsule(float height, float endRadius, int edges) { } + public static nkast.Aether.Physics2D.Common.Vertices CreateCapsule(float height, float topRadius, int topEdges, float bottomRadius, int bottomEdges) { } + public static nkast.Aether.Physics2D.Common.Vertices CreateCircle(float radius, int numberOfEdges) { } + public static nkast.Aether.Physics2D.Common.Vertices CreateEllipse(float xRadius, float yRadius, int numberOfEdges) { } + public static nkast.Aether.Physics2D.Common.Vertices CreateGear(float radius, int numberOfTeeth, float tipPercentage, float toothHeight) { } + public static nkast.Aether.Physics2D.Common.Vertices CreateLine(nkast.Aether.Physics2D.Common.Vector2 start, nkast.Aether.Physics2D.Common.Vector2 end) { } + public static nkast.Aether.Physics2D.Common.Vertices CreateRectangle(float hx, float hy) { } + public static nkast.Aether.Physics2D.Common.Vertices CreateRectangle(float hx, float hy, nkast.Aether.Physics2D.Common.Vector2 center, float angle) { } + public static nkast.Aether.Physics2D.Common.Vertices CreateRoundedRectangle(float width, float height, float xRadius, float yRadius, int segments) { } + } + public struct Sweep + { + public float A; + public float A0; + public float Alpha0; + public nkast.Aether.Physics2D.Common.Vector2 C; + public nkast.Aether.Physics2D.Common.Vector2 C0; + public nkast.Aether.Physics2D.Common.Vector2 LocalCenter; + public void Advance(float alpha) { } + public void GetTransform(out nkast.Aether.Physics2D.Common.Transform xfb, float beta) { } + public void Normalize() { } + } + public struct Transform + { + public nkast.Aether.Physics2D.Common.Vector2 p; + public nkast.Aether.Physics2D.Common.Complex q; + public Transform(nkast.Aether.Physics2D.Common.Vector2 position, float angle) { } + public Transform(nkast.Aether.Physics2D.Common.Vector2 position, nkast.Aether.Physics2D.Common.Complex rotation) { } + public static nkast.Aether.Physics2D.Common.Transform Identity { get; } + public static nkast.Aether.Physics2D.Common.Transform Divide(ref nkast.Aether.Physics2D.Common.Transform left, ref nkast.Aether.Physics2D.Common.Transform right) { } + public static nkast.Aether.Physics2D.Common.Vector2 Divide(nkast.Aether.Physics2D.Common.Vector2 left, ref nkast.Aether.Physics2D.Common.Transform right) { } + public static nkast.Aether.Physics2D.Common.Vector2 Divide(ref nkast.Aether.Physics2D.Common.Vector2 left, ref nkast.Aether.Physics2D.Common.Transform right) { } + public static void Divide(ref nkast.Aether.Physics2D.Common.Transform left, nkast.Aether.Physics2D.Common.Complex right, out nkast.Aether.Physics2D.Common.Transform result) { } + public static void Divide(ref nkast.Aether.Physics2D.Common.Transform left, ref nkast.Aether.Physics2D.Common.Transform right, out nkast.Aether.Physics2D.Common.Transform result) { } + public static void Divide(nkast.Aether.Physics2D.Common.Vector2 left, ref nkast.Aether.Physics2D.Common.Transform right, out nkast.Aether.Physics2D.Common.Vector2 result) { } + public static nkast.Aether.Physics2D.Common.Transform Multiply(ref nkast.Aether.Physics2D.Common.Transform left, ref nkast.Aether.Physics2D.Common.Transform right) { } + public static nkast.Aether.Physics2D.Common.Vector2 Multiply(nkast.Aether.Physics2D.Common.Vector2 left, ref nkast.Aether.Physics2D.Common.Transform right) { } + public static nkast.Aether.Physics2D.Common.Vector2 Multiply(ref nkast.Aether.Physics2D.Common.Vector2 left, ref nkast.Aether.Physics2D.Common.Transform right) { } + public static void Multiply(ref nkast.Aether.Physics2D.Common.Transform left, nkast.Aether.Physics2D.Common.Complex right, out nkast.Aether.Physics2D.Common.Transform result) { } + } + public struct Vector2 : System.IEquatable + { + public float X; + public float Y; + public Vector2(float xy) { } + public Vector2(float x, float y) { } + public static nkast.Aether.Physics2D.Common.Vector2 One { get; } + public static nkast.Aether.Physics2D.Common.Vector2 Zero { get; } + public bool Equals(nkast.Aether.Physics2D.Common.Vector2 other) { } + public override bool Equals(object obj) { } + public override int GetHashCode() { } + public float Length() { } + public float LengthSquared() { } + public void Normalize() { } + public override string ToString() { } + public static void Add(ref nkast.Aether.Physics2D.Common.Vector2 left, ref nkast.Aether.Physics2D.Common.Vector2 right, out nkast.Aether.Physics2D.Common.Vector2 result) { } + public static void Distance(ref nkast.Aether.Physics2D.Common.Vector2 v1, ref nkast.Aether.Physics2D.Common.Vector2 v2, out float result) { } + public static void DistanceSquared(ref nkast.Aether.Physics2D.Common.Vector2 v1, ref nkast.Aether.Physics2D.Common.Vector2 v2, out float result) { } + public static void Divide(ref nkast.Aether.Physics2D.Common.Vector2 left, float right, out nkast.Aether.Physics2D.Common.Vector2 result) { } + public static void Dot(ref nkast.Aether.Physics2D.Common.Vector2 left, ref nkast.Aether.Physics2D.Common.Vector2 right, out float result) { } + public static void Max(ref nkast.Aether.Physics2D.Common.Vector2 v1, ref nkast.Aether.Physics2D.Common.Vector2 v2, out nkast.Aether.Physics2D.Common.Vector2 result) { } + public static void Min(ref nkast.Aether.Physics2D.Common.Vector2 v1, ref nkast.Aether.Physics2D.Common.Vector2 v2, out nkast.Aether.Physics2D.Common.Vector2 result) { } + public static void Multiply(ref nkast.Aether.Physics2D.Common.Vector2 left, float right, out nkast.Aether.Physics2D.Common.Vector2 result) { } + public static void Multiply(ref nkast.Aether.Physics2D.Common.Vector2 left, ref nkast.Aether.Physics2D.Common.Vector2 right, out nkast.Aether.Physics2D.Common.Vector2 result) { } + public static void Subtract(ref nkast.Aether.Physics2D.Common.Vector2 left, ref nkast.Aether.Physics2D.Common.Vector2 right, out nkast.Aether.Physics2D.Common.Vector2 result) { } + public static bool operator !=(nkast.Aether.Physics2D.Common.Vector2 left, nkast.Aether.Physics2D.Common.Vector2 right) { } + public static nkast.Aether.Physics2D.Common.Vector2 operator *(float left, nkast.Aether.Physics2D.Common.Vector2 right) { } + public static nkast.Aether.Physics2D.Common.Vector2 operator *(nkast.Aether.Physics2D.Common.Vector2 left, float right) { } + public static nkast.Aether.Physics2D.Common.Vector2 operator *(nkast.Aether.Physics2D.Common.Vector2 left, nkast.Aether.Physics2D.Common.Vector2 right) { } + public static nkast.Aether.Physics2D.Common.Vector2 operator +(nkast.Aether.Physics2D.Common.Vector2 left, nkast.Aether.Physics2D.Common.Vector2 right) { } + public static nkast.Aether.Physics2D.Common.Vector2 operator -(nkast.Aether.Physics2D.Common.Vector2 right) { } + public static nkast.Aether.Physics2D.Common.Vector2 operator -(nkast.Aether.Physics2D.Common.Vector2 left, nkast.Aether.Physics2D.Common.Vector2 right) { } + public static nkast.Aether.Physics2D.Common.Vector2 operator /(nkast.Aether.Physics2D.Common.Vector2 left, float right) { } + public static bool operator ==(nkast.Aether.Physics2D.Common.Vector2 left, nkast.Aether.Physics2D.Common.Vector2 right) { } + } + public struct Vector3 : System.IEquatable + { + public float X; + public float Y; + public float Z; + public Vector3(float xyz) { } + public Vector3(float x, float y, float z) { } + public static nkast.Aether.Physics2D.Common.Vector3 One { get; } + public static nkast.Aether.Physics2D.Common.Vector3 Zero { get; } + public bool Equals(nkast.Aether.Physics2D.Common.Vector3 other) { } + public override bool Equals(object obj) { } + public override int GetHashCode() { } + public override string ToString() { } + public static bool operator !=(nkast.Aether.Physics2D.Common.Vector3 left, nkast.Aether.Physics2D.Common.Vector3 right) { } + public static nkast.Aether.Physics2D.Common.Vector3 operator *(float left, nkast.Aether.Physics2D.Common.Vector3 right) { } + public static nkast.Aether.Physics2D.Common.Vector3 operator *(nkast.Aether.Physics2D.Common.Vector3 left, float right) { } + public static nkast.Aether.Physics2D.Common.Vector3 operator *(nkast.Aether.Physics2D.Common.Vector3 left, nkast.Aether.Physics2D.Common.Vector3 right) { } + public static nkast.Aether.Physics2D.Common.Vector3 operator +(nkast.Aether.Physics2D.Common.Vector3 left, nkast.Aether.Physics2D.Common.Vector3 right) { } + public static nkast.Aether.Physics2D.Common.Vector3 operator -(nkast.Aether.Physics2D.Common.Vector3 right) { } + public static nkast.Aether.Physics2D.Common.Vector3 operator -(nkast.Aether.Physics2D.Common.Vector3 left, nkast.Aether.Physics2D.Common.Vector3 right) { } + public static nkast.Aether.Physics2D.Common.Vector3 operator /(nkast.Aether.Physics2D.Common.Vector3 left, float right) { } + public static bool operator ==(nkast.Aether.Physics2D.Common.Vector3 left, nkast.Aether.Physics2D.Common.Vector3 right) { } + } + [System.Diagnostics.DebuggerDisplay("Count = {Count} Vertices = {ToString()}")] + public class Vertices : System.Collections.Generic.List + { + public Vertices() { } + public Vertices(System.Collections.Generic.IEnumerable vertices) { } + public Vertices(int capacity) { } + public System.Collections.Generic.List Holes { get; set; } + public nkast.Aether.Physics2D.Common.PolygonError CheckPolygon() { } + public void ForceCounterClockWise() { } + public nkast.Aether.Physics2D.Collision.AABB GetAABB() { } + public float GetArea() { } + public nkast.Aether.Physics2D.Common.Vector2 GetCentroid() { } + public float GetSignedArea() { } + public bool IsConvex() { } + public bool IsCounterClockWise() { } + public bool IsSimple() { } + public int NextIndex(int index) { } + public nkast.Aether.Physics2D.Common.Vector2 NextVertex(int index) { } + public int PointInPolygon(ref nkast.Aether.Physics2D.Common.Vector2 point) { } + public bool PointInPolygonAngle(ref nkast.Aether.Physics2D.Common.Vector2 point) { } + public int PreviousIndex(int index) { } + public nkast.Aether.Physics2D.Common.Vector2 PreviousVertex(int index) { } + public void ProjectToAxis(ref nkast.Aether.Physics2D.Common.Vector2 axis, out float min, out float max) { } + public void Rotate(float value) { } + public void Scale(nkast.Aether.Physics2D.Common.Vector2 value) { } + public void Scale(ref nkast.Aether.Physics2D.Common.Vector2 value) { } + public override string ToString() { } + public void Translate(nkast.Aether.Physics2D.Common.Vector2 value) { } + public void Translate(ref nkast.Aether.Physics2D.Common.Vector2 value) { } + } + public static class WorldSerializer + { + public static nkast.Aether.Physics2D.Dynamics.World Deserialize(System.IO.Stream stream) { } + public static void Serialize(nkast.Aether.Physics2D.Dynamics.World world, System.IO.Stream stream) { } + } +} +namespace nkast.Aether.Physics2D.Common.ConvexHull +{ + public static class ChainHull + { + public static nkast.Aether.Physics2D.Common.Vertices GetConvexHull(nkast.Aether.Physics2D.Common.Vertices vertices) { } + } + public static class GiftWrap + { + public static nkast.Aether.Physics2D.Common.Vertices GetConvexHull(nkast.Aether.Physics2D.Common.Vertices vertices) { } + } + public static class Melkman + { + public static nkast.Aether.Physics2D.Common.Vertices GetConvexHull(nkast.Aether.Physics2D.Common.Vertices vertices) { } + } +} +namespace nkast.Aether.Physics2D.Common.Decomposition +{ + public static class Triangulate + { + public static System.Collections.Generic.List ConvexPartition(nkast.Aether.Physics2D.Common.Vertices vertices, nkast.Aether.Physics2D.Common.Decomposition.TriangulationAlgorithm algorithm, bool discardAndFixInvalid = true, float tolerance = 0.001, bool skipSanityChecks = false) { } + } + public enum TriangulationAlgorithm + { + Earclip = 0, + Bayazit = 1, + Flipcode = 2, + Seidel = 3, + SeidelTrapezoids = 4, + Delauny = 5, + } +} +namespace nkast.Aether.Physics2D.Common.PhysicsLogic +{ + public class BreakableBody + { + public System.Collections.Generic.List Parts; + public float Strength; + public BreakableBody(nkast.Aether.Physics2D.Dynamics.World world, System.Collections.Generic.IEnumerable shapes, nkast.Aether.Physics2D.Common.Vector2 position = default, float rotation = 0) { } + public BreakableBody(nkast.Aether.Physics2D.Dynamics.World world, System.Collections.Generic.IEnumerable vertices, float density, nkast.Aether.Physics2D.Common.Vector2 position = default, float rotation = 0) { } + public BreakableBody(nkast.Aether.Physics2D.Dynamics.World world, nkast.Aether.Physics2D.Common.Vertices vertices, float density, nkast.Aether.Physics2D.Common.Vector2 position = default, float rotation = 0) { } + public nkast.Aether.Physics2D.Dynamics.Body MainBody { get; } + public nkast.Aether.Physics2D.Common.PhysicsLogic.BreakableBody.BreakableBodyState State { get; } + public nkast.Aether.Physics2D.Dynamics.World World { get; } + public void Update() { } + public enum BreakableBodyState + { + Unbroken = 0, + ShouldBreak = 1, + Broken = 2, + } + } + [System.Flags] + public enum ControllerCategory + { + None = 0, + Cat01 = 1, + Cat02 = 2, + Cat03 = 4, + Cat04 = 8, + Cat05 = 16, + Cat06 = 32, + Cat07 = 64, + Cat08 = 128, + Cat09 = 256, + Cat10 = 512, + Cat11 = 1024, + Cat12 = 2048, + Cat13 = 4096, + Cat14 = 8192, + Cat15 = 16384, + Cat16 = 32768, + Cat17 = 65536, + Cat18 = 131072, + Cat19 = 262144, + Cat20 = 524288, + Cat21 = 1048576, + Cat22 = 2097152, + Cat23 = 4194304, + Cat24 = 8388608, + Cat25 = 16777216, + Cat26 = 33554432, + Cat27 = 67108864, + Cat28 = 134217728, + Cat29 = 268435456, + Cat30 = 536870912, + Cat31 = 1073741824, + All = 2147483647, + } + public struct ControllerFilter + { + public nkast.Aether.Physics2D.Common.PhysicsLogic.ControllerCategory ControllerCategories; + public ControllerFilter(nkast.Aether.Physics2D.Common.PhysicsLogic.ControllerCategory controllerCategory) { } + public void IgnoreController(nkast.Aether.Physics2D.Common.PhysicsLogic.ControllerCategory category) { } + public bool IsControllerIgnored(nkast.Aether.Physics2D.Common.PhysicsLogic.ControllerCategory category) { } + public void RestoreController(nkast.Aether.Physics2D.Common.PhysicsLogic.ControllerCategory category) { } + } + public abstract class FilterData + { + public nkast.Aether.Physics2D.Dynamics.Category DisabledOnCategories; + public int DisabledOnGroup; + public nkast.Aether.Physics2D.Dynamics.Category EnabledOnCategories; + public int EnabledOnGroup; + protected FilterData() { } + public void AddDisabledCategory(nkast.Aether.Physics2D.Dynamics.Category category) { } + public void AddEnabledCategory(nkast.Aether.Physics2D.Dynamics.Category category) { } + public virtual bool IsActiveOn(nkast.Aether.Physics2D.Dynamics.Body body) { } + public bool IsInDisabledCategory(nkast.Aether.Physics2D.Dynamics.Category category) { } + public bool IsInEnabledInCategory(nkast.Aether.Physics2D.Dynamics.Category category) { } + public void RemoveDisabledCategory(nkast.Aether.Physics2D.Dynamics.Category category) { } + public void RemoveEnabledCategory(nkast.Aether.Physics2D.Dynamics.Category category) { } + } + public abstract class PhysicsLogic : nkast.Aether.Physics2D.Common.PhysicsLogic.FilterData + { + public nkast.Aether.Physics2D.Common.PhysicsLogic.ControllerCategory ControllerCategory; + public PhysicsLogic(nkast.Aether.Physics2D.Dynamics.World world) { } + public nkast.Aether.Physics2D.Dynamics.World World { get; } + public override bool IsActiveOn(nkast.Aether.Physics2D.Dynamics.Body body) { } + } + public sealed class RealExplosion : nkast.Aether.Physics2D.Common.PhysicsLogic.PhysicsLogic + { + public float EdgeRatio; + public bool IgnoreWhenInsideShape; + public float MaxAngle; + public int MaxShapes; + public int MinRays; + public RealExplosion(nkast.Aether.Physics2D.Dynamics.World world) { } + public System.Collections.Generic.Dictionary Activate(nkast.Aether.Physics2D.Common.Vector2 pos, float radius, float maxForce) { } + } + public sealed class SimpleExplosion : nkast.Aether.Physics2D.Common.PhysicsLogic.PhysicsLogic + { + public SimpleExplosion(nkast.Aether.Physics2D.Dynamics.World world) { } + public float Power { get; set; } + public System.Collections.Generic.Dictionary Activate(nkast.Aether.Physics2D.Common.Vector2 pos, float radius, float force, float maxForce = 3.4028235E+38) { } + } +} +namespace nkast.Aether.Physics2D.Common.PolygonManipulation +{ + public static class CuttingTools + { + public static bool Cut(nkast.Aether.Physics2D.Dynamics.World world, nkast.Aether.Physics2D.Common.Vector2 start, nkast.Aether.Physics2D.Common.Vector2 end) { } + public static void SplitShape(nkast.Aether.Physics2D.Dynamics.Fixture fixture, nkast.Aether.Physics2D.Common.Vector2 entryPoint, nkast.Aether.Physics2D.Common.Vector2 exitPoint, out nkast.Aether.Physics2D.Common.Vertices first, out nkast.Aether.Physics2D.Common.Vertices second) { } + } + public enum PolyClipError + { + None = 0, + DegeneratedOutput = 1, + NonSimpleInput = 2, + BrokenResult = 3, + } + public static class SimpleCombiner + { + public static System.Collections.Generic.List PolygonizeTriangles(System.Collections.Generic.List triangles, int maxPolys = 2147483647, float tolerance = 0.001) { } + } + public static class SimplifyTools + { + public static nkast.Aether.Physics2D.Common.Vertices CollinearSimplify(nkast.Aether.Physics2D.Common.Vertices vertices, float collinearityTolerance = 0) { } + public static nkast.Aether.Physics2D.Common.Vertices DouglasPeuckerSimplify(nkast.Aether.Physics2D.Common.Vertices vertices, float distanceTolerance) { } + public static nkast.Aether.Physics2D.Common.Vertices MergeIdenticalPoints(nkast.Aether.Physics2D.Common.Vertices vertices) { } + public static nkast.Aether.Physics2D.Common.Vertices MergeParallelEdges(nkast.Aether.Physics2D.Common.Vertices vertices, float tolerance) { } + public static nkast.Aether.Physics2D.Common.Vertices ReduceByArea(nkast.Aether.Physics2D.Common.Vertices vertices, float areaTolerance) { } + public static nkast.Aether.Physics2D.Common.Vertices ReduceByDistance(nkast.Aether.Physics2D.Common.Vertices vertices, float distance) { } + public static nkast.Aether.Physics2D.Common.Vertices ReduceByNth(nkast.Aether.Physics2D.Common.Vertices vertices, int nth) { } + } + public static class YuPengClipper + { + public static System.Collections.Generic.List Difference(nkast.Aether.Physics2D.Common.Vertices polygon1, nkast.Aether.Physics2D.Common.Vertices polygon2, out nkast.Aether.Physics2D.Common.PolygonManipulation.PolyClipError error) { } + public static System.Collections.Generic.List Intersect(nkast.Aether.Physics2D.Common.Vertices polygon1, nkast.Aether.Physics2D.Common.Vertices polygon2, out nkast.Aether.Physics2D.Common.PolygonManipulation.PolyClipError error) { } + public static System.Collections.Generic.List Union(nkast.Aether.Physics2D.Common.Vertices polygon1, nkast.Aether.Physics2D.Common.Vertices polygon2, out nkast.Aether.Physics2D.Common.PolygonManipulation.PolyClipError error) { } + } +} +namespace nkast.Aether.Physics2D.Common.TextureTools +{ + public static class MarchingSquares + { + public static System.Collections.Generic.List DetectSquares(nkast.Aether.Physics2D.Collision.AABB domain, float cellWidth, float cellHeight, sbyte[] f, int lerpCount, bool combine) { } + } + public class Terrain + { + public int CellSize; + public nkast.Aether.Physics2D.Common.Vector2 Center; + public nkast.Aether.Physics2D.Common.Decomposition.TriangulationAlgorithm Decomposer; + public float Height; + public int Iterations; + public int PointsPerUnit; + public int SubCellSize; + public float Width; + public nkast.Aether.Physics2D.Dynamics.World World; + public Terrain(nkast.Aether.Physics2D.Dynamics.World world, nkast.Aether.Physics2D.Collision.AABB area) { } + public Terrain(nkast.Aether.Physics2D.Dynamics.World world, nkast.Aether.Physics2D.Common.Vector2 position, float width, float height) { } + public void ApplyData(sbyte[] data, nkast.Aether.Physics2D.Common.Vector2 offset = default) { } + public void Initialize() { } + public void ModifyTerrain(nkast.Aether.Physics2D.Common.Vector2 location, sbyte value) { } + public void RegenerateTerrain() { } + } +} +namespace nkast.Aether.Physics2D.Controllers +{ + public sealed class BuoyancyController : nkast.Aether.Physics2D.Controllers.Controller + { + public float AngularDragCoefficient; + public float Density; + public float LinearDragCoefficient; + public nkast.Aether.Physics2D.Common.Vector2 Velocity; + public BuoyancyController(nkast.Aether.Physics2D.Collision.AABB container, float density, float linearDragCoefficient, float rotationalDragCoefficient, nkast.Aether.Physics2D.Common.Vector2 gravity) { } + public nkast.Aether.Physics2D.Collision.AABB Container { get; set; } + public override void Update(float dt) { } + } + public abstract class Controller : nkast.Aether.Physics2D.Common.PhysicsLogic.FilterData + { + public nkast.Aether.Physics2D.Common.PhysicsLogic.ControllerCategory ControllerCategory; + public bool Enabled; + public Controller() { } + public nkast.Aether.Physics2D.Dynamics.World World { get; } + public override bool IsActiveOn(nkast.Aether.Physics2D.Dynamics.Body body) { } + public abstract void Update(float dt); + } + public class GravityController : nkast.Aether.Physics2D.Controllers.Controller + { + public GravityController(float strength) { } + public GravityController(float strength, float maxRadius, float minRadius) { } + public System.Collections.Generic.List Bodies { get; set; } + public nkast.Aether.Physics2D.Controllers.GravityType GravityType { get; set; } + public float MaxRadius { get; set; } + public float MinRadius { get; set; } + public System.Collections.Generic.List Points { get; set; } + public float Strength { get; set; } + public void AddBody(nkast.Aether.Physics2D.Dynamics.Body body) { } + public void AddPoint(nkast.Aether.Physics2D.Common.Vector2 point) { } + public override void Update(float dt) { } + } + public enum GravityType + { + Linear = 0, + DistanceSquared = 1, + } + public class VelocityLimitController : nkast.Aether.Physics2D.Controllers.Controller + { + public bool LimitAngularVelocity; + public bool LimitLinearVelocity; + public VelocityLimitController() { } + public VelocityLimitController(float maxLinearVelocity, float maxAngularVelocity) { } + public float MaxAngularVelocity { get; set; } + public float MaxLinearVelocity { get; set; } + public void AddBody(nkast.Aether.Physics2D.Dynamics.Body body) { } + public void RemoveBody(nkast.Aether.Physics2D.Dynamics.Body body) { } + public override void Update(float dt) { } + } +} +namespace nkast.Aether.Physics2D.Dynamics +{ + public delegate void AfterCollisionEventHandler(nkast.Aether.Physics2D.Dynamics.Fixture sender, nkast.Aether.Physics2D.Dynamics.Fixture other, nkast.Aether.Physics2D.Dynamics.Contacts.Contact contact, nkast.Aether.Physics2D.Dynamics.Contacts.ContactVelocityConstraint impulse); + public delegate bool BeforeCollisionEventHandler(nkast.Aether.Physics2D.Dynamics.Fixture sender, nkast.Aether.Physics2D.Dynamics.Fixture other); + public delegate bool BeginContactDelegate(nkast.Aether.Physics2D.Dynamics.Contacts.Contact contact); + public class Body + { + public nkast.Aether.Physics2D.Common.PhysicsLogic.ControllerFilter ControllerFilter; + public readonly nkast.Aether.Physics2D.Dynamics.FixtureCollection FixtureList; + public object Tag; + public Body() { } + public float AngularDamping { get; set; } + public float AngularVelocity { get; set; } + public bool Awake { get; set; } + public nkast.Aether.Physics2D.Dynamics.BodyType BodyType { get; set; } + public nkast.Aether.Physics2D.Dynamics.Contacts.ContactEdge ContactList { get; } + public bool Enabled { get; set; } + public bool FixedRotation { get; set; } + public bool IgnoreCCD { get; set; } + public bool IgnoreGravity { get; set; } + public float Inertia { get; set; } + public bool IsBullet { get; set; } + [System.Obsolete] + public int IslandIndex { get; } + public nkast.Aether.Physics2D.Dynamics.Joints.JointEdge JointList { get; } + public float LinearDamping { get; set; } + public nkast.Aether.Physics2D.Common.Vector2 LinearVelocity { get; set; } + public nkast.Aether.Physics2D.Common.Vector2 LocalCenter { get; set; } + public float Mass { get; set; } + public nkast.Aether.Physics2D.Common.Vector2 Position { get; set; } + public float Revolutions { get; } + public float Rotation { get; set; } + public bool SleepingAllowed { get; set; } + public nkast.Aether.Physics2D.Dynamics.World World { get; } + public nkast.Aether.Physics2D.Common.Vector2 WorldCenter { get; } + public event nkast.Aether.Physics2D.Dynamics.OnCollisionEventHandler OnCollision; + public event nkast.Aether.Physics2D.Dynamics.OnSeparationEventHandler OnSeparation; + public void Add(nkast.Aether.Physics2D.Dynamics.Fixture fixture) { } + public void ApplyAngularImpulse(float impulse) { } + public void ApplyForce(ref nkast.Aether.Physics2D.Common.Vector2 force) { } + public void ApplyForce(nkast.Aether.Physics2D.Common.Vector2 force) { } + public void ApplyForce(nkast.Aether.Physics2D.Common.Vector2 force, nkast.Aether.Physics2D.Common.Vector2 point) { } + public void ApplyForce(ref nkast.Aether.Physics2D.Common.Vector2 force, ref nkast.Aether.Physics2D.Common.Vector2 point) { } + public void ApplyLinearImpulse(nkast.Aether.Physics2D.Common.Vector2 impulse) { } + public void ApplyLinearImpulse(ref nkast.Aether.Physics2D.Common.Vector2 impulse) { } + public void ApplyLinearImpulse(nkast.Aether.Physics2D.Common.Vector2 impulse, nkast.Aether.Physics2D.Common.Vector2 point) { } + public void ApplyLinearImpulse(ref nkast.Aether.Physics2D.Common.Vector2 impulse, ref nkast.Aether.Physics2D.Common.Vector2 point) { } + public void ApplyTorque(float torque) { } + public nkast.Aether.Physics2D.Dynamics.Body Clone(nkast.Aether.Physics2D.Dynamics.World world = null) { } + public nkast.Aether.Physics2D.Dynamics.Fixture CreateChainShape(nkast.Aether.Physics2D.Common.Vertices vertices) { } + public nkast.Aether.Physics2D.Dynamics.Fixture CreateCircle(float radius, float density) { } + public nkast.Aether.Physics2D.Dynamics.Fixture CreateCircle(float radius, float density, nkast.Aether.Physics2D.Common.Vector2 offset) { } + public System.Collections.Generic.List CreateCompoundPolygon(System.Collections.Generic.List list, float density) { } + public nkast.Aether.Physics2D.Dynamics.Fixture CreateEdge(nkast.Aether.Physics2D.Common.Vector2 start, nkast.Aether.Physics2D.Common.Vector2 end) { } + public nkast.Aether.Physics2D.Dynamics.Fixture CreateEllipse(float xRadius, float yRadius, int edges, float density) { } + public virtual nkast.Aether.Physics2D.Dynamics.Fixture CreateFixture(nkast.Aether.Physics2D.Collision.Shapes.Shape shape) { } + public nkast.Aether.Physics2D.Dynamics.Fixture CreateLineArc(float radians, int sides, float radius, bool closed) { } + public nkast.Aether.Physics2D.Dynamics.Fixture CreateLoopShape(nkast.Aether.Physics2D.Common.Vertices vertices) { } + public nkast.Aether.Physics2D.Dynamics.Fixture CreatePolygon(nkast.Aether.Physics2D.Common.Vertices vertices, float density) { } + public nkast.Aether.Physics2D.Dynamics.Fixture CreateRectangle(float width, float height, float density, nkast.Aether.Physics2D.Common.Vector2 offset) { } + public System.Collections.Generic.List CreateSolidArc(float density, float radians, int sides, float radius) { } + public nkast.Aether.Physics2D.Dynamics.Body DeepClone(nkast.Aether.Physics2D.Dynamics.World world = null) { } + public nkast.Aether.Physics2D.Common.Vector2 GetLinearVelocityFromLocalPoint(nkast.Aether.Physics2D.Common.Vector2 localPoint) { } + public nkast.Aether.Physics2D.Common.Vector2 GetLinearVelocityFromLocalPoint(ref nkast.Aether.Physics2D.Common.Vector2 localPoint) { } + public nkast.Aether.Physics2D.Common.Vector2 GetLinearVelocityFromWorldPoint(nkast.Aether.Physics2D.Common.Vector2 worldPoint) { } + public nkast.Aether.Physics2D.Common.Vector2 GetLinearVelocityFromWorldPoint(ref nkast.Aether.Physics2D.Common.Vector2 worldPoint) { } + public nkast.Aether.Physics2D.Common.Vector2 GetLocalPoint(ref nkast.Aether.Physics2D.Common.Vector2 worldPoint) { } + public nkast.Aether.Physics2D.Common.Vector2 GetLocalPoint(nkast.Aether.Physics2D.Common.Vector2 worldPoint) { } + public nkast.Aether.Physics2D.Common.Vector2 GetLocalVector(ref nkast.Aether.Physics2D.Common.Vector2 worldVector) { } + public nkast.Aether.Physics2D.Common.Vector2 GetLocalVector(nkast.Aether.Physics2D.Common.Vector2 worldVector) { } + public nkast.Aether.Physics2D.Common.Transform GetTransform() { } + public void GetTransform(out nkast.Aether.Physics2D.Common.Transform transform) { } + public nkast.Aether.Physics2D.Common.Vector2 GetWorldPoint(ref nkast.Aether.Physics2D.Common.Vector2 localPoint) { } + public nkast.Aether.Physics2D.Common.Vector2 GetWorldPoint(nkast.Aether.Physics2D.Common.Vector2 localPoint) { } + public nkast.Aether.Physics2D.Common.Vector2 GetWorldVector(ref nkast.Aether.Physics2D.Common.Vector2 localVector) { } + public nkast.Aether.Physics2D.Common.Vector2 GetWorldVector(nkast.Aether.Physics2D.Common.Vector2 localVector) { } + public virtual void Remove(nkast.Aether.Physics2D.Dynamics.Fixture fixture) { } + public void ResetDynamics() { } + public void ResetMassData() { } + public void SetTransform(ref nkast.Aether.Physics2D.Common.Vector2 position, float rotation) { } + public void SetTransform(nkast.Aether.Physics2D.Common.Vector2 position, float rotation) { } + public void SetTransformIgnoreContacts(ref nkast.Aether.Physics2D.Common.Vector2 position, float angle) { } + } + public class BodyCollection : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.IEnumerable + { + public BodyCollection(nkast.Aether.Physics2D.Dynamics.World world) { } + public int Count { get; } + public bool IsReadOnly { get; } + public nkast.Aether.Physics2D.Dynamics.Body this[int index] { get; set; } + public bool Contains(nkast.Aether.Physics2D.Dynamics.Body item) { } + public void CopyTo(nkast.Aether.Physics2D.Dynamics.Body[] array, int arrayIndex) { } + public nkast.Aether.Physics2D.Dynamics.BodyCollection.BodyEnumerator GetEnumerator() { } + public int IndexOf(nkast.Aether.Physics2D.Dynamics.Body item) { } + public struct BodyEnumerator : System.Collections.Generic.IEnumerator, System.Collections.IEnumerator, System.IDisposable + { + public BodyEnumerator(nkast.Aether.Physics2D.Dynamics.BodyCollection collection, System.Collections.Generic.List list) { } + public nkast.Aether.Physics2D.Dynamics.Body Current { get; } + public bool MoveNext() { } + } + } + public delegate void BodyDelegate(nkast.Aether.Physics2D.Dynamics.World sender, nkast.Aether.Physics2D.Dynamics.Body body); + public enum BodyType + { + Static = 0, + Kinematic = 1, + Dynamic = 2, + } + [System.Flags] + public enum Category + { + None = 0, + Cat1 = 1, + Cat2 = 2, + Cat3 = 4, + Cat4 = 8, + Cat5 = 16, + Cat6 = 32, + Cat7 = 64, + Cat8 = 128, + Cat9 = 256, + Cat10 = 512, + Cat11 = 1024, + Cat12 = 2048, + Cat13 = 4096, + Cat14 = 8192, + Cat15 = 16384, + Cat16 = 32768, + Cat17 = 65536, + Cat18 = 131072, + Cat19 = 262144, + Cat20 = 524288, + Cat21 = 1048576, + Cat22 = 2097152, + Cat23 = 4194304, + Cat24 = 8388608, + Cat25 = 16777216, + Cat26 = 33554432, + Cat27 = 67108864, + Cat28 = 134217728, + Cat29 = 268435456, + Cat30 = 536870912, + Cat31 = 1073741824, + All = 2147483647, + } + public delegate bool CollisionFilterDelegate(nkast.Aether.Physics2D.Dynamics.Fixture fixtureA, nkast.Aether.Physics2D.Dynamics.Fixture fixtureB); + public class ContactManager + { + public nkast.Aether.Physics2D.Dynamics.BeginContactDelegate BeginContact; + public readonly nkast.Aether.Physics2D.Collision.IBroadPhase BroadPhase; + public int CollideMultithreadThreshold; + public nkast.Aether.Physics2D.Dynamics.CollisionFilterDelegate ContactFilter; + public readonly nkast.Aether.Physics2D.Dynamics.Contacts.ContactListHead ContactList; + public nkast.Aether.Physics2D.Dynamics.EndContactDelegate EndContact; + public nkast.Aether.Physics2D.Collision.BroadphaseDelegate OnBroadphaseCollision; + public int PositionConstraintsMultithreadThreshold; + public nkast.Aether.Physics2D.Dynamics.PostSolveDelegate PostSolve; + public nkast.Aether.Physics2D.Dynamics.PreSolveDelegate PreSolve; + public int VelocityConstraintsMultithreadThreshold; + public int ContactCount { get; } + } + public class ControllerCollection : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.IEnumerable + { + public ControllerCollection(nkast.Aether.Physics2D.Dynamics.World world) { } + public int Count { get; } + public bool IsReadOnly { get; } + public nkast.Aether.Physics2D.Controllers.Controller this[int index] { get; set; } + public bool Contains(nkast.Aether.Physics2D.Controllers.Controller item) { } + public void CopyTo(nkast.Aether.Physics2D.Controllers.Controller[] array, int arrayIndex) { } + public nkast.Aether.Physics2D.Dynamics.ControllerCollection.ControllerEnumerator GetEnumerator() { } + public int IndexOf(nkast.Aether.Physics2D.Controllers.Controller item) { } + public struct ControllerEnumerator : System.Collections.Generic.IEnumerator, System.Collections.IEnumerator, System.IDisposable + { + public ControllerEnumerator(nkast.Aether.Physics2D.Dynamics.ControllerCollection collection, System.Collections.Generic.List list) { } + public nkast.Aether.Physics2D.Controllers.Controller Current { get; } + public bool MoveNext() { } + } + } + public delegate void ControllerDelegate(nkast.Aether.Physics2D.Dynamics.World sender, nkast.Aether.Physics2D.Controllers.Controller controller); + public delegate void EndContactDelegate(nkast.Aether.Physics2D.Dynamics.Contacts.Contact contact); + public class Fixture + { + public nkast.Aether.Physics2D.Dynamics.AfterCollisionEventHandler AfterCollision; + public nkast.Aether.Physics2D.Dynamics.BeforeCollisionEventHandler BeforeCollision; + public nkast.Aether.Physics2D.Dynamics.OnCollisionEventHandler OnCollision; + public nkast.Aether.Physics2D.Dynamics.OnSeparationEventHandler OnSeparation; + public object Tag; + public Fixture(nkast.Aether.Physics2D.Collision.Shapes.Shape shape) { } + public nkast.Aether.Physics2D.Dynamics.Body Body { get; } + public nkast.Aether.Physics2D.Dynamics.Category CollidesWith { get; set; } + public nkast.Aether.Physics2D.Dynamics.Category CollisionCategories { get; set; } + public short CollisionGroup { get; set; } + public float Friction { get; set; } + public bool IsSensor { get; set; } + public nkast.Aether.Physics2D.Dynamics.FixtureProxy[] Proxies { get; } + public int ProxyCount { get; } + public float Restitution { get; set; } + public nkast.Aether.Physics2D.Collision.Shapes.Shape Shape { get; } + public nkast.Aether.Physics2D.Dynamics.Fixture CloneOnto(nkast.Aether.Physics2D.Dynamics.Body body) { } + public void GetAABB(out nkast.Aether.Physics2D.Collision.AABB aabb, int childIndex) { } + public bool RayCast(out nkast.Aether.Physics2D.Collision.RayCastOutput output, ref nkast.Aether.Physics2D.Collision.RayCastInput input, int childIndex) { } + public bool TestPoint(ref nkast.Aether.Physics2D.Common.Vector2 point) { } + } + public class FixtureCollection : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.IEnumerable + { + public FixtureCollection(nkast.Aether.Physics2D.Dynamics.Body body) { } + public int Count { get; } + public bool IsReadOnly { get; } + public nkast.Aether.Physics2D.Dynamics.Fixture this[int index] { get; set; } + public bool Contains(nkast.Aether.Physics2D.Dynamics.Fixture item) { } + public void CopyTo(nkast.Aether.Physics2D.Dynamics.Fixture[] array, int arrayIndex) { } + public nkast.Aether.Physics2D.Dynamics.FixtureCollection.FixtureEnumerator GetEnumerator() { } + public int IndexOf(nkast.Aether.Physics2D.Dynamics.Fixture item) { } + public struct FixtureEnumerator : System.Collections.Generic.IEnumerator, System.Collections.IEnumerator, System.IDisposable + { + public FixtureEnumerator(nkast.Aether.Physics2D.Dynamics.FixtureCollection collection, System.Collections.Generic.List list) { } + public nkast.Aether.Physics2D.Dynamics.Fixture Current { get; } + public bool MoveNext() { } + } + } + public delegate void FixtureDelegate(nkast.Aether.Physics2D.Dynamics.World sender, nkast.Aether.Physics2D.Dynamics.Body body, nkast.Aether.Physics2D.Dynamics.Fixture fixture); + public struct FixtureProxy + { + public nkast.Aether.Physics2D.Collision.AABB AABB; + public int ChildIndex; + public nkast.Aether.Physics2D.Dynamics.Fixture Fixture; + public int ProxyId; + } + public class Island + { + public nkast.Aether.Physics2D.Dynamics.Body[] Bodies; + public int BodyCapacity; + public int BodyCount; + public int ContactCapacity; + public int ContactCount; + public int JointCapacity; + public int JointCount; + public System.TimeSpan JointUpdateTime; + public Island() { } + public void Add(nkast.Aether.Physics2D.Dynamics.Body body) { } + public void Add(nkast.Aether.Physics2D.Dynamics.Contacts.Contact contact) { } + public void Add(nkast.Aether.Physics2D.Dynamics.Joints.Joint joint) { } + public void Clear() { } + public void Reset(int bodyCapacity, int contactCapacity, int jointCapacity, nkast.Aether.Physics2D.Dynamics.ContactManager contactManager) { } + } + public class JointCollection : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.IEnumerable + { + public JointCollection(nkast.Aether.Physics2D.Dynamics.World world) { } + public int Count { get; } + public bool IsReadOnly { get; } + public nkast.Aether.Physics2D.Dynamics.Joints.Joint this[int index] { get; set; } + public bool Contains(nkast.Aether.Physics2D.Dynamics.Joints.Joint item) { } + public void CopyTo(nkast.Aether.Physics2D.Dynamics.Joints.Joint[] array, int arrayIndex) { } + public nkast.Aether.Physics2D.Dynamics.JointCollection.JointEnumerator GetEnumerator() { } + public int IndexOf(nkast.Aether.Physics2D.Dynamics.Joints.Joint item) { } + public struct JointEnumerator : System.Collections.Generic.IEnumerator, System.Collections.IEnumerator, System.IDisposable + { + public JointEnumerator(nkast.Aether.Physics2D.Dynamics.JointCollection collection, System.Collections.Generic.List list) { } + public nkast.Aether.Physics2D.Dynamics.Joints.Joint Current { get; } + public bool MoveNext() { } + } + } + public delegate void JointDelegate(nkast.Aether.Physics2D.Dynamics.World sender, nkast.Aether.Physics2D.Dynamics.Joints.Joint joint); + public delegate bool OnCollisionEventHandler(nkast.Aether.Physics2D.Dynamics.Fixture sender, nkast.Aether.Physics2D.Dynamics.Fixture other, nkast.Aether.Physics2D.Dynamics.Contacts.Contact contact); + public delegate void OnSeparationEventHandler(nkast.Aether.Physics2D.Dynamics.Fixture sender, nkast.Aether.Physics2D.Dynamics.Fixture other, nkast.Aether.Physics2D.Dynamics.Contacts.Contact contact); + public delegate void PostSolveDelegate(nkast.Aether.Physics2D.Dynamics.Contacts.Contact contact, nkast.Aether.Physics2D.Dynamics.Contacts.ContactVelocityConstraint impulse); + public delegate void PreSolveDelegate(nkast.Aether.Physics2D.Dynamics.Contacts.Contact contact, ref nkast.Aether.Physics2D.Collision.Manifold oldManifold); + public delegate bool QueryReportFixtureDelegate(nkast.Aether.Physics2D.Dynamics.Fixture fixture); + public delegate float RayCastReportFixtureDelegate(nkast.Aether.Physics2D.Dynamics.Fixture fixture, nkast.Aether.Physics2D.Common.Vector2 point, nkast.Aether.Physics2D.Common.Vector2 normal, float fraction); + public struct SolverIterations + { + public bool AutoClearForces; + public int PositionIterations; + public int TOIPositionIterations; + public int TOIVelocityIterations; + public int VelocityIterations; + } + public class World + { + public nkast.Aether.Physics2D.Dynamics.BodyDelegate BodyAdded; + public readonly nkast.Aether.Physics2D.Dynamics.BodyCollection BodyList; + public nkast.Aether.Physics2D.Dynamics.BodyDelegate BodyRemoved; + public readonly nkast.Aether.Physics2D.Dynamics.ContactManager ContactManager; + public nkast.Aether.Physics2D.Dynamics.ControllerDelegate ControllerAdded; + public readonly nkast.Aether.Physics2D.Dynamics.ControllerCollection ControllerList; + public nkast.Aether.Physics2D.Dynamics.ControllerDelegate ControllerRemoved; + public nkast.Aether.Physics2D.Dynamics.FixtureDelegate FixtureAdded; + public nkast.Aether.Physics2D.Dynamics.FixtureDelegate FixtureRemoved; + public nkast.Aether.Physics2D.Dynamics.JointDelegate JointAdded; + public readonly nkast.Aether.Physics2D.Dynamics.JointCollection JointList; + public nkast.Aether.Physics2D.Dynamics.JointDelegate JointRemoved; + public object Tag; + public World() { } + public World(nkast.Aether.Physics2D.Collision.IBroadPhase broadPhase) { } + public World(nkast.Aether.Physics2D.Common.Vector2 gravity) { } + public System.TimeSpan AddRemoveTime { get; } + public int ContactCount { get; } + public nkast.Aether.Physics2D.Dynamics.Contacts.ContactListHead ContactList { get; } + public System.TimeSpan ContactsUpdateTime { get; } + public System.TimeSpan ContinuousPhysicsTime { get; } + public System.TimeSpan ControllersUpdateTime { get; } + public bool Enabled { get; set; } + public nkast.Aether.Physics2D.Common.Vector2 Gravity { get; set; } + public bool IsLocked { get; } + public nkast.Aether.Physics2D.Dynamics.Island Island { get; } + public System.TimeSpan NewContactsTime { get; } + public int ProxyCount { get; } + public System.TimeSpan SolveUpdateTime { get; } + public System.TimeSpan UpdateTime { get; } + public void Add(nkast.Aether.Physics2D.Controllers.Controller controller) { } + public virtual void Add(nkast.Aether.Physics2D.Dynamics.Body body) { } + public void Add(nkast.Aether.Physics2D.Dynamics.Joints.Joint joint) { } + public void Clear() { } + public void ClearForces() { } + public virtual nkast.Aether.Physics2D.Dynamics.Body CreateBody(nkast.Aether.Physics2D.Common.Vector2 position = default, float rotation = 0, nkast.Aether.Physics2D.Dynamics.BodyType bodyType = 0) { } + public nkast.Aether.Physics2D.Dynamics.Body CreateCapsule(float height, float endRadius, float density, nkast.Aether.Physics2D.Common.Vector2 position = default, float rotation = 0, nkast.Aether.Physics2D.Dynamics.BodyType bodyType = 0) { } + public nkast.Aether.Physics2D.Dynamics.Body CreateCapsule(float height, float topRadius, int topEdges, float bottomRadius, int bottomEdges, float density, nkast.Aether.Physics2D.Common.Vector2 position = default, float rotation = 0, nkast.Aether.Physics2D.Dynamics.BodyType bodyType = 0) { } + public nkast.Aether.Physics2D.Common.Path CreateChain(nkast.Aether.Physics2D.Common.Vector2 start, nkast.Aether.Physics2D.Common.Vector2 end, float linkWidth, float linkHeight, int numberOfLinks, float linkDensity, bool attachRopeJoint) { } + public nkast.Aether.Physics2D.Dynamics.Body CreateChainShape(nkast.Aether.Physics2D.Common.Vertices vertices, nkast.Aether.Physics2D.Common.Vector2 position = default) { } + public nkast.Aether.Physics2D.Dynamics.Body CreateCircle(float radius, float density, nkast.Aether.Physics2D.Common.Vector2 position = default, nkast.Aether.Physics2D.Dynamics.BodyType bodyType = 0) { } + public nkast.Aether.Physics2D.Dynamics.Body CreateCompoundPolygon(System.Collections.Generic.List list, float density, nkast.Aether.Physics2D.Common.Vector2 position = default, float rotation = 0, nkast.Aether.Physics2D.Dynamics.BodyType bodyType = 0) { } + public nkast.Aether.Physics2D.Dynamics.Body CreateEdge(nkast.Aether.Physics2D.Common.Vector2 start, nkast.Aether.Physics2D.Common.Vector2 end) { } + public nkast.Aether.Physics2D.Dynamics.Body CreateEllipse(float xRadius, float yRadius, int edges, float density, nkast.Aether.Physics2D.Common.Vector2 position = default, float rotation = 0, nkast.Aether.Physics2D.Dynamics.BodyType bodyType = 0) { } + public nkast.Aether.Physics2D.Dynamics.Body CreateGear(float radius, int numberOfTeeth, float tipPercentage, float toothHeight, float density, nkast.Aether.Physics2D.Common.Vector2 position = default, float rotation = 0, nkast.Aether.Physics2D.Dynamics.BodyType bodyType = 0) { } + public nkast.Aether.Physics2D.Dynamics.Body CreateLineArc(float radians, int sides, float radius, bool closed = false, nkast.Aether.Physics2D.Common.Vector2 position = default, float rotation = 0, nkast.Aether.Physics2D.Dynamics.BodyType bodyType = 0) { } + public nkast.Aether.Physics2D.Dynamics.Body CreateLoopShape(nkast.Aether.Physics2D.Common.Vertices vertices, nkast.Aether.Physics2D.Common.Vector2 position = default) { } + public nkast.Aether.Physics2D.Dynamics.Body CreatePolygon(nkast.Aether.Physics2D.Common.Vertices vertices, float density, nkast.Aether.Physics2D.Common.Vector2 position = default, float rotation = 0, nkast.Aether.Physics2D.Dynamics.BodyType bodyType = 0) { } + public nkast.Aether.Physics2D.Dynamics.Body CreateRectangle(float width, float height, float density, nkast.Aether.Physics2D.Common.Vector2 position = default, float rotation = 0, nkast.Aether.Physics2D.Dynamics.BodyType bodyType = 0) { } + public nkast.Aether.Physics2D.Dynamics.Body CreateRoundedRectangle(float width, float height, float xRadius, float yRadius, int segments, float density, nkast.Aether.Physics2D.Common.Vector2 position = default, float rotation = 0, nkast.Aether.Physics2D.Dynamics.BodyType bodyType = 0) { } + public nkast.Aether.Physics2D.Dynamics.Body CreateSolidArc(float density, float radians, int sides, float radius, nkast.Aether.Physics2D.Common.Vector2 position = default, float rotation = 0, nkast.Aether.Physics2D.Dynamics.BodyType bodyType = 0) { } + public void QueryAABB(nkast.Aether.Physics2D.Dynamics.QueryReportFixtureDelegate callback, nkast.Aether.Physics2D.Collision.AABB aabb) { } + public void QueryAABB(nkast.Aether.Physics2D.Dynamics.QueryReportFixtureDelegate callback, ref nkast.Aether.Physics2D.Collision.AABB aabb) { } + public void RayCast(nkast.Aether.Physics2D.Dynamics.RayCastReportFixtureDelegate callback, nkast.Aether.Physics2D.Common.Vector2 point1, nkast.Aether.Physics2D.Common.Vector2 point2) { } + public void Remove(nkast.Aether.Physics2D.Controllers.Controller controller) { } + public virtual void Remove(nkast.Aether.Physics2D.Dynamics.Body body) { } + public void Remove(nkast.Aether.Physics2D.Dynamics.Joints.Joint joint) { } + public void ShiftOrigin(nkast.Aether.Physics2D.Common.Vector2 newOrigin) { } + public void Step(System.TimeSpan dt) { } + public void Step(float dt) { } + public void Step(System.TimeSpan dt, ref nkast.Aether.Physics2D.Dynamics.SolverIterations iterations) { } + public void Step(float dt, ref nkast.Aether.Physics2D.Dynamics.SolverIterations iterations) { } + public nkast.Aether.Physics2D.Dynamics.Fixture TestPoint(nkast.Aether.Physics2D.Common.Vector2 point) { } + } +} +namespace nkast.Aether.Physics2D.Dynamics.Contacts +{ + public class Contact + { + public nkast.Aether.Physics2D.Collision.Manifold Manifold; + protected Contact(nkast.Aether.Physics2D.Dynamics.Fixture fA, int indexA, nkast.Aether.Physics2D.Dynamics.Fixture fB, int indexB) { } + public int ChildIndexA { get; } + public int ChildIndexB { get; } + public bool Enabled { get; set; } + public nkast.Aether.Physics2D.Dynamics.Fixture FixtureA { get; } + public nkast.Aether.Physics2D.Dynamics.Fixture FixtureB { get; } + public float Friction { get; set; } + public bool IsTouching { get; set; } + public nkast.Aether.Physics2D.Dynamics.Contacts.Contact Next { get; } + public nkast.Aether.Physics2D.Dynamics.Contacts.Contact Prev { get; } + public float Restitution { get; set; } + public float TangentSpeed { get; set; } + public void GetWorldManifold(out nkast.Aether.Physics2D.Common.Vector2 normal, out nkast.Aether.Physics2D.Common.FixedArray2 points) { } + public void ResetFriction() { } + public void ResetRestitution() { } + } + public sealed class ContactEdge + { + public ContactEdge() { } + public nkast.Aether.Physics2D.Dynamics.Contacts.Contact Contact { get; } + public nkast.Aether.Physics2D.Dynamics.Contacts.ContactEdge Next { get; } + public nkast.Aether.Physics2D.Dynamics.Body Other { get; } + public nkast.Aether.Physics2D.Dynamics.Contacts.ContactEdge Prev { get; } + } + public class ContactListHead : nkast.Aether.Physics2D.Dynamics.Contacts.Contact, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable { } + public sealed class ContactPositionConstraint + { + public int indexA; + public int indexB; + public float invIA; + public float invIB; + public float invMassA; + public float invMassB; + public nkast.Aether.Physics2D.Common.Vector2 localCenterA; + public nkast.Aether.Physics2D.Common.Vector2 localCenterB; + public nkast.Aether.Physics2D.Common.Vector2 localNormal; + public nkast.Aether.Physics2D.Common.Vector2 localPoint; + public nkast.Aether.Physics2D.Common.Vector2[] localPoints; + public int pointCount; + public float radiusA; + public float radiusB; + public nkast.Aether.Physics2D.Collision.ManifoldType type; + public ContactPositionConstraint() { } + } + public class ContactSolver + { + public nkast.Aether.Physics2D.Dynamics.Contacts.Contact[] _contacts; + public int _count; + public nkast.Aether.Physics2D.Dynamics.Contacts.ContactPositionConstraint[] _positionConstraints; + public nkast.Aether.Physics2D.Dynamics.Contacts.ContactVelocityConstraint[] _velocityConstraints; + public ContactSolver() { } + public void InitializeVelocityConstraints() { } + public bool SolvePositionConstraints() { } + public bool SolveTOIPositionConstraints(int toiIndexA, int toiIndexB) { } + public void SolveVelocityConstraints() { } + public void StoreImpulses() { } + public void WarmStart() { } + public static class WorldManifold + { + public static void Initialize(ref nkast.Aether.Physics2D.Collision.Manifold manifold, ref nkast.Aether.Physics2D.Common.Transform xfA, float radiusA, ref nkast.Aether.Physics2D.Common.Transform xfB, float radiusB, out nkast.Aether.Physics2D.Common.Vector2 normal, out nkast.Aether.Physics2D.Common.FixedArray2 points) { } + } + } + public sealed class ContactVelocityConstraint + { + public nkast.Aether.Physics2D.Common.Mat22 K; + public int contactIndex; + public float friction; + public int indexA; + public int indexB; + public float invIA; + public float invIB; + public float invMassA; + public float invMassB; + public nkast.Aether.Physics2D.Common.Vector2 normal; + public nkast.Aether.Physics2D.Common.Mat22 normalMass; + public int pointCount; + public nkast.Aether.Physics2D.Dynamics.Contacts.VelocityConstraintPoint[] points; + public float restitution; + public float tangentSpeed; + public ContactVelocityConstraint() { } + } + public sealed class VelocityConstraintPoint + { + public float normalImpulse; + public float normalMass; + public nkast.Aether.Physics2D.Common.Vector2 rA; + public nkast.Aether.Physics2D.Common.Vector2 rB; + public float tangentImpulse; + public float tangentMass; + public float velocityBias; + public VelocityConstraintPoint() { } + } +} +namespace nkast.Aether.Physics2D.Dynamics.Joints +{ + public class AngleJoint : nkast.Aether.Physics2D.Dynamics.Joints.Joint + { + public AngleJoint(nkast.Aether.Physics2D.Dynamics.Body bodyA, nkast.Aether.Physics2D.Dynamics.Body bodyB) { } + public float BiasFactor { get; set; } + public float MaxImpulse { get; set; } + public float Softness { get; set; } + public float TargetAngle { get; set; } + public override nkast.Aether.Physics2D.Common.Vector2 WorldAnchorA { get; set; } + public override nkast.Aether.Physics2D.Common.Vector2 WorldAnchorB { get; set; } + public override nkast.Aether.Physics2D.Common.Vector2 GetReactionForce(float invDt) { } + public override float GetReactionTorque(float invDt) { } + } + public class DistanceJoint : nkast.Aether.Physics2D.Dynamics.Joints.Joint + { + public DistanceJoint(nkast.Aether.Physics2D.Dynamics.Body bodyA, nkast.Aether.Physics2D.Dynamics.Body bodyB, nkast.Aether.Physics2D.Common.Vector2 anchorA, nkast.Aether.Physics2D.Common.Vector2 anchorB, bool useWorldCoordinates = false) { } + public float DampingRatio { get; set; } + public float Frequency { get; set; } + public float Length { get; set; } + public nkast.Aether.Physics2D.Common.Vector2 LocalAnchorA { get; set; } + public nkast.Aether.Physics2D.Common.Vector2 LocalAnchorB { get; set; } + public override sealed nkast.Aether.Physics2D.Common.Vector2 WorldAnchorA { get; set; } + public override sealed nkast.Aether.Physics2D.Common.Vector2 WorldAnchorB { get; set; } + public override nkast.Aether.Physics2D.Common.Vector2 GetReactionForce(float invDt) { } + public override float GetReactionTorque(float invDt) { } + } + public class FixedMouseJoint : nkast.Aether.Physics2D.Dynamics.Joints.Joint + { + public FixedMouseJoint(nkast.Aether.Physics2D.Dynamics.Body body, nkast.Aether.Physics2D.Common.Vector2 worldAnchor) { } + public float DampingRatio { get; set; } + public float Frequency { get; set; } + public nkast.Aether.Physics2D.Common.Vector2 LocalAnchorA { get; set; } + public float MaxForce { get; set; } + public override nkast.Aether.Physics2D.Common.Vector2 WorldAnchorA { get; set; } + public override nkast.Aether.Physics2D.Common.Vector2 WorldAnchorB { get; set; } + public override nkast.Aether.Physics2D.Common.Vector2 GetReactionForce(float invDt) { } + public override float GetReactionTorque(float invDt) { } + } + public class FrictionJoint : nkast.Aether.Physics2D.Dynamics.Joints.Joint + { + public FrictionJoint(nkast.Aether.Physics2D.Dynamics.Body bodyA, nkast.Aether.Physics2D.Dynamics.Body bodyB, nkast.Aether.Physics2D.Common.Vector2 anchor, bool useWorldCoordinates = false) { } + public nkast.Aether.Physics2D.Common.Vector2 LocalAnchorA { get; set; } + public nkast.Aether.Physics2D.Common.Vector2 LocalAnchorB { get; set; } + public float MaxForce { get; set; } + public float MaxTorque { get; set; } + public override nkast.Aether.Physics2D.Common.Vector2 WorldAnchorA { get; set; } + public override nkast.Aether.Physics2D.Common.Vector2 WorldAnchorB { get; set; } + public override nkast.Aether.Physics2D.Common.Vector2 GetReactionForce(float invDt) { } + public override float GetReactionTorque(float invDt) { } + } + public class GearJoint : nkast.Aether.Physics2D.Dynamics.Joints.Joint + { + public GearJoint(nkast.Aether.Physics2D.Dynamics.Body bodyA, nkast.Aether.Physics2D.Dynamics.Body bodyB, nkast.Aether.Physics2D.Dynamics.Joints.Joint jointA, nkast.Aether.Physics2D.Dynamics.Joints.Joint jointB, float ratio = 1) { } + public nkast.Aether.Physics2D.Dynamics.Joints.Joint JointA { get; } + public nkast.Aether.Physics2D.Dynamics.Joints.Joint JointB { get; } + public float Ratio { get; set; } + public override nkast.Aether.Physics2D.Common.Vector2 WorldAnchorA { get; set; } + public override nkast.Aether.Physics2D.Common.Vector2 WorldAnchorB { get; set; } + public override nkast.Aether.Physics2D.Common.Vector2 GetReactionForce(float invDt) { } + public override float GetReactionTorque(float invDt) { } + } + public abstract class Joint + { + public bool Enabled; + public object Tag; + protected Joint() { } + protected Joint(nkast.Aether.Physics2D.Dynamics.Body body) { } + protected Joint(nkast.Aether.Physics2D.Dynamics.Body bodyA, nkast.Aether.Physics2D.Dynamics.Body bodyB) { } + public nkast.Aether.Physics2D.Dynamics.Body BodyA { get; } + public nkast.Aether.Physics2D.Dynamics.Body BodyB { get; } + public float Breakpoint { get; set; } + public bool CollideConnected { get; set; } + public nkast.Aether.Physics2D.Dynamics.Joints.JointType JointType { get; protected set; } + public nkast.Aether.Physics2D.Dynamics.World World { get; } + public abstract nkast.Aether.Physics2D.Common.Vector2 WorldAnchorA { get; set; } + public abstract nkast.Aether.Physics2D.Common.Vector2 WorldAnchorB { get; set; } + public event System.Action Broke; + public abstract nkast.Aether.Physics2D.Common.Vector2 GetReactionForce(float invDt); + public abstract float GetReactionTorque(float invDt); + public bool IsFixedType() { } + protected void WakeBodies() { } + } + public sealed class JointEdge + { + public nkast.Aether.Physics2D.Dynamics.Joints.Joint Joint; + public nkast.Aether.Physics2D.Dynamics.Joints.JointEdge Next; + public nkast.Aether.Physics2D.Dynamics.Body Other; + public nkast.Aether.Physics2D.Dynamics.Joints.JointEdge Prev; + public JointEdge() { } + } + public static class JointFactory + { + public static nkast.Aether.Physics2D.Dynamics.Joints.AngleJoint CreateAngleJoint(nkast.Aether.Physics2D.Dynamics.World world, nkast.Aether.Physics2D.Dynamics.Body bodyA, nkast.Aether.Physics2D.Dynamics.Body bodyB) { } + public static nkast.Aether.Physics2D.Dynamics.Joints.DistanceJoint CreateDistanceJoint(nkast.Aether.Physics2D.Dynamics.World world, nkast.Aether.Physics2D.Dynamics.Body bodyA, nkast.Aether.Physics2D.Dynamics.Body bodyB) { } + public static nkast.Aether.Physics2D.Dynamics.Joints.DistanceJoint CreateDistanceJoint(nkast.Aether.Physics2D.Dynamics.World world, nkast.Aether.Physics2D.Dynamics.Body bodyA, nkast.Aether.Physics2D.Dynamics.Body bodyB, nkast.Aether.Physics2D.Common.Vector2 anchorA, nkast.Aether.Physics2D.Common.Vector2 anchorB, bool useWorldCoordinates = false) { } + public static nkast.Aether.Physics2D.Dynamics.Joints.FixedMouseJoint CreateFixedMouseJoint(nkast.Aether.Physics2D.Dynamics.World world, nkast.Aether.Physics2D.Dynamics.Body body, nkast.Aether.Physics2D.Common.Vector2 worldAnchor) { } + public static nkast.Aether.Physics2D.Dynamics.Joints.FrictionJoint CreateFrictionJoint(nkast.Aether.Physics2D.Dynamics.World world, nkast.Aether.Physics2D.Dynamics.Body bodyA, nkast.Aether.Physics2D.Dynamics.Body bodyB) { } + public static nkast.Aether.Physics2D.Dynamics.Joints.FrictionJoint CreateFrictionJoint(nkast.Aether.Physics2D.Dynamics.World world, nkast.Aether.Physics2D.Dynamics.Body bodyA, nkast.Aether.Physics2D.Dynamics.Body bodyB, nkast.Aether.Physics2D.Common.Vector2 anchor, bool useWorldCoordinates = false) { } + public static nkast.Aether.Physics2D.Dynamics.Joints.GearJoint CreateGearJoint(nkast.Aether.Physics2D.Dynamics.World world, nkast.Aether.Physics2D.Dynamics.Body bodyA, nkast.Aether.Physics2D.Dynamics.Body bodyB, nkast.Aether.Physics2D.Dynamics.Joints.Joint jointA, nkast.Aether.Physics2D.Dynamics.Joints.Joint jointB, float ratio) { } + public static nkast.Aether.Physics2D.Dynamics.Joints.MotorJoint CreateMotorJoint(nkast.Aether.Physics2D.Dynamics.World world, nkast.Aether.Physics2D.Dynamics.Body bodyA, nkast.Aether.Physics2D.Dynamics.Body bodyB, bool useWorldCoordinates = false) { } + public static nkast.Aether.Physics2D.Dynamics.Joints.PrismaticJoint CreatePrismaticJoint(nkast.Aether.Physics2D.Dynamics.World world, nkast.Aether.Physics2D.Dynamics.Body bodyA, nkast.Aether.Physics2D.Dynamics.Body bodyB, nkast.Aether.Physics2D.Common.Vector2 anchor, nkast.Aether.Physics2D.Common.Vector2 axis, bool useWorldCoordinates = false) { } + public static nkast.Aether.Physics2D.Dynamics.Joints.PulleyJoint CreatePulleyJoint(nkast.Aether.Physics2D.Dynamics.World world, nkast.Aether.Physics2D.Dynamics.Body bodyA, nkast.Aether.Physics2D.Dynamics.Body bodyB, nkast.Aether.Physics2D.Common.Vector2 anchorA, nkast.Aether.Physics2D.Common.Vector2 anchorB, nkast.Aether.Physics2D.Common.Vector2 worldAnchorA, nkast.Aether.Physics2D.Common.Vector2 worldAnchorB, float ratio, bool useWorldCoordinates = false) { } + public static nkast.Aether.Physics2D.Dynamics.Joints.RevoluteJoint CreateRevoluteJoint(nkast.Aether.Physics2D.Dynamics.World world, nkast.Aether.Physics2D.Dynamics.Body bodyA, nkast.Aether.Physics2D.Dynamics.Body bodyB, nkast.Aether.Physics2D.Common.Vector2 anchor) { } + public static nkast.Aether.Physics2D.Dynamics.Joints.RevoluteJoint CreateRevoluteJoint(nkast.Aether.Physics2D.Dynamics.World world, nkast.Aether.Physics2D.Dynamics.Body bodyA, nkast.Aether.Physics2D.Dynamics.Body bodyB, nkast.Aether.Physics2D.Common.Vector2 anchorA, nkast.Aether.Physics2D.Common.Vector2 anchorB, bool useWorldCoordinates = false) { } + public static nkast.Aether.Physics2D.Dynamics.Joints.RopeJoint CreateRopeJoint(nkast.Aether.Physics2D.Dynamics.World world, nkast.Aether.Physics2D.Dynamics.Body bodyA, nkast.Aether.Physics2D.Dynamics.Body bodyB, nkast.Aether.Physics2D.Common.Vector2 anchorA, nkast.Aether.Physics2D.Common.Vector2 anchorB, bool useWorldCoordinates = false) { } + public static nkast.Aether.Physics2D.Dynamics.Joints.WeldJoint CreateWeldJoint(nkast.Aether.Physics2D.Dynamics.World world, nkast.Aether.Physics2D.Dynamics.Body bodyA, nkast.Aether.Physics2D.Dynamics.Body bodyB, nkast.Aether.Physics2D.Common.Vector2 anchorA, nkast.Aether.Physics2D.Common.Vector2 anchorB, bool useWorldCoordinates = false) { } + public static nkast.Aether.Physics2D.Dynamics.Joints.WheelJoint CreateWheelJoint(nkast.Aether.Physics2D.Dynamics.World world, nkast.Aether.Physics2D.Dynamics.Body bodyA, nkast.Aether.Physics2D.Dynamics.Body bodyB, nkast.Aether.Physics2D.Common.Vector2 axis) { } + public static nkast.Aether.Physics2D.Dynamics.Joints.WheelJoint CreateWheelJoint(nkast.Aether.Physics2D.Dynamics.World world, nkast.Aether.Physics2D.Dynamics.Body bodyA, nkast.Aether.Physics2D.Dynamics.Body bodyB, nkast.Aether.Physics2D.Common.Vector2 anchor, nkast.Aether.Physics2D.Common.Vector2 axis, bool useWorldCoordinates = false) { } + } + public enum JointType + { + Unknown = 0, + Revolute = 1, + Prismatic = 2, + Distance = 3, + Pulley = 4, + Gear = 5, + Wheel = 6, + Weld = 7, + Friction = 8, + Rope = 9, + Motor = 10, + Angle = 11, + FixedMouse = 12, + FixedRevolute = 13, + FixedDistance = 14, + FixedLine = 15, + FixedPrismatic = 16, + FixedAngle = 17, + FixedFriction = 18, + } + public enum LimitState + { + Inactive = 0, + AtLower = 1, + AtUpper = 2, + Equal = 3, + } + public class MotorJoint : nkast.Aether.Physics2D.Dynamics.Joints.Joint + { + public MotorJoint(nkast.Aether.Physics2D.Dynamics.Body bodyA, nkast.Aether.Physics2D.Dynamics.Body bodyB, bool useWorldCoordinates = false) { } + public float AngularOffset { get; set; } + public nkast.Aether.Physics2D.Common.Vector2 LinearOffset { get; set; } + public float MaxForce { get; set; } + public float MaxTorque { get; set; } + public override nkast.Aether.Physics2D.Common.Vector2 WorldAnchorA { get; set; } + public override nkast.Aether.Physics2D.Common.Vector2 WorldAnchorB { get; set; } + public override nkast.Aether.Physics2D.Common.Vector2 GetReactionForce(float invDt) { } + public override float GetReactionTorque(float invDt) { } + } + public class PrismaticJoint : nkast.Aether.Physics2D.Dynamics.Joints.Joint + { + public PrismaticJoint(nkast.Aether.Physics2D.Dynamics.Body bodyA, nkast.Aether.Physics2D.Dynamics.Body bodyB, nkast.Aether.Physics2D.Common.Vector2 anchor, nkast.Aether.Physics2D.Common.Vector2 axis, bool useWorldCoordinates = false) { } + public PrismaticJoint(nkast.Aether.Physics2D.Dynamics.Body bodyA, nkast.Aether.Physics2D.Dynamics.Body bodyB, nkast.Aether.Physics2D.Common.Vector2 anchorA, nkast.Aether.Physics2D.Common.Vector2 anchorB, nkast.Aether.Physics2D.Common.Vector2 axis, bool useWorldCoordinates = false) { } + public nkast.Aether.Physics2D.Common.Vector2 Axis { get; set; } + public float JointSpeed { get; } + public float JointTranslation { get; } + public bool LimitEnabled { get; set; } + public nkast.Aether.Physics2D.Common.Vector2 LocalAnchorA { get; set; } + public nkast.Aether.Physics2D.Common.Vector2 LocalAnchorB { get; set; } + public nkast.Aether.Physics2D.Common.Vector2 LocalXAxis { get; } + public float LowerLimit { get; set; } + public float MaxMotorForce { get; set; } + public bool MotorEnabled { get; set; } + public float MotorImpulse { get; set; } + public float MotorSpeed { get; set; } + public float ReferenceAngle { get; set; } + public float UpperLimit { get; set; } + public override nkast.Aether.Physics2D.Common.Vector2 WorldAnchorA { get; set; } + public override nkast.Aether.Physics2D.Common.Vector2 WorldAnchorB { get; set; } + public float GetMotorForce(float invDt) { } + public override nkast.Aether.Physics2D.Common.Vector2 GetReactionForce(float invDt) { } + public override float GetReactionTorque(float invDt) { } + public void SetLimits(float lower, float upper) { } + } + public class PulleyJoint : nkast.Aether.Physics2D.Dynamics.Joints.Joint + { + public PulleyJoint(nkast.Aether.Physics2D.Dynamics.Body bodyA, nkast.Aether.Physics2D.Dynamics.Body bodyB, nkast.Aether.Physics2D.Common.Vector2 anchorA, nkast.Aether.Physics2D.Common.Vector2 anchorB, nkast.Aether.Physics2D.Common.Vector2 worldAnchorA, nkast.Aether.Physics2D.Common.Vector2 worldAnchorB, float ratio, bool useWorldCoordinates = false) { } + public float CurrentLengthA { get; } + public float CurrentLengthB { get; } + public float LengthA { get; set; } + public float LengthB { get; set; } + public nkast.Aether.Physics2D.Common.Vector2 LocalAnchorA { get; set; } + public nkast.Aether.Physics2D.Common.Vector2 LocalAnchorB { get; set; } + public float Ratio { get; set; } + public override sealed nkast.Aether.Physics2D.Common.Vector2 WorldAnchorA { get; set; } + public override sealed nkast.Aether.Physics2D.Common.Vector2 WorldAnchorB { get; set; } + public override nkast.Aether.Physics2D.Common.Vector2 GetReactionForce(float invDt) { } + public override float GetReactionTorque(float invDt) { } + } + public class RevoluteJoint : nkast.Aether.Physics2D.Dynamics.Joints.Joint + { + public RevoluteJoint(nkast.Aether.Physics2D.Dynamics.Body bodyA, nkast.Aether.Physics2D.Dynamics.Body bodyB, nkast.Aether.Physics2D.Common.Vector2 anchor, bool useWorldCoordinates = false) { } + public RevoluteJoint(nkast.Aether.Physics2D.Dynamics.Body bodyA, nkast.Aether.Physics2D.Dynamics.Body bodyB, nkast.Aether.Physics2D.Common.Vector2 anchorA, nkast.Aether.Physics2D.Common.Vector2 anchorB, bool useWorldCoordinates = false) { } + public float JointAngle { get; } + public float JointSpeed { get; } + public bool LimitEnabled { get; set; } + public nkast.Aether.Physics2D.Common.Vector2 LocalAnchorA { get; set; } + public nkast.Aether.Physics2D.Common.Vector2 LocalAnchorB { get; set; } + public float LowerLimit { get; set; } + public float MaxMotorTorque { get; set; } + public bool MotorEnabled { get; set; } + public float MotorImpulse { get; set; } + public float MotorSpeed { get; set; } + public float ReferenceAngle { get; set; } + public float UpperLimit { get; set; } + public override nkast.Aether.Physics2D.Common.Vector2 WorldAnchorA { get; set; } + public override nkast.Aether.Physics2D.Common.Vector2 WorldAnchorB { get; set; } + public float GetMotorTorque(float invDt) { } + public override nkast.Aether.Physics2D.Common.Vector2 GetReactionForce(float invDt) { } + public override float GetReactionTorque(float invDt) { } + public void SetLimits(float lower, float upper) { } + } + public class RopeJoint : nkast.Aether.Physics2D.Dynamics.Joints.Joint + { + public RopeJoint(nkast.Aether.Physics2D.Dynamics.Body bodyA, nkast.Aether.Physics2D.Dynamics.Body bodyB, nkast.Aether.Physics2D.Common.Vector2 anchorA, nkast.Aether.Physics2D.Common.Vector2 anchorB, bool useWorldCoordinates = false) { } + public nkast.Aether.Physics2D.Common.Vector2 LocalAnchorA { get; set; } + public nkast.Aether.Physics2D.Common.Vector2 LocalAnchorB { get; set; } + public float MaxLength { get; set; } + public nkast.Aether.Physics2D.Dynamics.Joints.LimitState State { get; } + public override sealed nkast.Aether.Physics2D.Common.Vector2 WorldAnchorA { get; set; } + public override sealed nkast.Aether.Physics2D.Common.Vector2 WorldAnchorB { get; set; } + public override nkast.Aether.Physics2D.Common.Vector2 GetReactionForce(float invDt) { } + public override float GetReactionTorque(float invDt) { } + } + public class WeldJoint : nkast.Aether.Physics2D.Dynamics.Joints.Joint + { + public WeldJoint(nkast.Aether.Physics2D.Dynamics.Body bodyA, nkast.Aether.Physics2D.Dynamics.Body bodyB, nkast.Aether.Physics2D.Common.Vector2 anchorA, nkast.Aether.Physics2D.Common.Vector2 anchorB, bool useWorldCoordinates = false) { } + public float DampingRatio { get; set; } + public float FrequencyHz { get; set; } + public nkast.Aether.Physics2D.Common.Vector2 LocalAnchorA { get; set; } + public nkast.Aether.Physics2D.Common.Vector2 LocalAnchorB { get; set; } + public float ReferenceAngle { get; set; } + public override nkast.Aether.Physics2D.Common.Vector2 WorldAnchorA { get; set; } + public override nkast.Aether.Physics2D.Common.Vector2 WorldAnchorB { get; set; } + public override nkast.Aether.Physics2D.Common.Vector2 GetReactionForce(float invDt) { } + public override float GetReactionTorque(float invDt) { } + } + public class WheelJoint : nkast.Aether.Physics2D.Dynamics.Joints.Joint + { + public WheelJoint(nkast.Aether.Physics2D.Dynamics.Body bodyA, nkast.Aether.Physics2D.Dynamics.Body bodyB, nkast.Aether.Physics2D.Common.Vector2 anchor, nkast.Aether.Physics2D.Common.Vector2 axis, bool useWorldCoordinates = false) { } + public nkast.Aether.Physics2D.Common.Vector2 Axis { get; set; } + public float DampingRatio { get; set; } + public float Frequency { get; set; } + public float JointSpeed { get; } + public float JointTranslation { get; } + public nkast.Aether.Physics2D.Common.Vector2 LocalAnchorA { get; set; } + public nkast.Aether.Physics2D.Common.Vector2 LocalAnchorB { get; set; } + public nkast.Aether.Physics2D.Common.Vector2 LocalXAxis { get; } + public float MaxMotorTorque { get; set; } + public bool MotorEnabled { get; set; } + public float MotorSpeed { get; set; } + public override nkast.Aether.Physics2D.Common.Vector2 WorldAnchorA { get; set; } + public override nkast.Aether.Physics2D.Common.Vector2 WorldAnchorB { get; set; } + public float GetMotorTorque(float invDt) { } + public override nkast.Aether.Physics2D.Common.Vector2 GetReactionForce(float invDt) { } + public override float GetReactionTorque(float invDt) { } + } +} +namespace nkast.Aether.Physics2D +{ + public static class Settings + { + public const float AABBExtension = 0.1F; + public const float AABBMultiplier = 2F; + public const float AngularSleepTolerance = 0.03490659F; + public const float AngularSlop = 0.03490659F; + public const bool AutoClearForces = true; + public const float Baumgarte = 0.2F; + public const bool EnableDiagnostics = true; + public const float Epsilon = 1.1920929E-07F; + public const float LinearSleepTolerance = 0.01F; + public const float LinearSlop = 0.005F; + public const float MaxAngularCorrection = 0.13962635F; + public const float MaxFloat = 3.4028235E+38F; + public const int MaxGJKIterations = 20; + public const float MaxLinearCorrection = 0.2F; + public const int MaxManifoldPoints = 2; + public const float MaxRotation = 1.5707964F; + public const float MaxRotationSquared = 2.4674013F; + public const int MaxSubSteps = 8; + public const int MaxTOIContacts = 32; + public const float MaxTranslation = 2F; + public const float MaxTranslationSquared = 4F; + public const float PolygonRadius = 0.01F; + public const float TimeToSleep = 0.5F; + public const float VelocityThreshold = 1F; + public static bool AllowSleep; + public static bool ContinuousPhysics; + public static int MaxPolygonVertices; + public static int PositionIterations; + public static int TOIPositionIterations; + public static int TOIVelocityIterations; + public static bool UseConvexHullPolygons; + public static int VelocityIterations; + public static float MixFriction(float friction1, float friction2) { } + public static float MixRestitution(float restitution1, float restitution2) { } + } +} diff --git a/Simulacion/Aether.cs b/Simulacion/Aether.cs index 8a08e6f..b982ecf 100644 --- a/Simulacion/Aether.cs +++ b/Simulacion/Aether.cs @@ -553,11 +553,11 @@ namespace CtrEditor.Simulacion Body.OnSeparation += HandleOnSeparation; Body.Tag = this; // Importante para la identificación durante la colisión // Configurar la fricción - Body.SetFriction(0.2f); + //Body.SetFriction(0.2f); // Configurar amortiguamiento Body.LinearDamping = 3f; // Ajustar para controlar la reducción de la velocidad lineal Body.AngularDamping = 1f; // Ajustar para controlar la reducción de la velocidad angular - Body.SetRestitution(0f); // Baja restitución para menos rebote + //Body.SetRestitution(0f); // Baja restitución para menos rebote Body.SleepingAllowed = false; Body.IsBullet = true; } diff --git a/Simulacion/Fluids/1/FluidDefinition.cs b/Simulacion/Fluids/1/FluidDefinition.cs new file mode 100644 index 0000000..745c6ef --- /dev/null +++ b/Simulacion/Fluids/1/FluidDefinition.cs @@ -0,0 +1,121 @@ +/* Original source Farseer Physics Engine: + * Copyright (c) 2014 Ian Qvist, http://farseerphysics.codeplex.com + * Microsoft Permissive License (Ms-PL) v1.1 + */ + +using nkast.Aether.Physics2D.Common; + +namespace tainicom.Aether.Physics2D.Fluids +{ + /// + /// Fluid parameters, see pvfs.pdf for a detailed explanation + /// + public struct FluidDefinition + { + /// + /// Distance of influence between the particles + /// + public float InfluenceRadius; + + /// + /// Density of the fluid + /// + public float DensityRest; + + /// + /// Stiffness of the fluid (when particles are far) + /// + public float Stiffness; + + /// + /// Stiffness of the fluid (when particles are near) + /// Set by Check() + /// + public float StiffnessNear; + + /// + /// Toggles viscosity forces + /// + public bool UseViscosity; + + /// + /// See pvfs.pdf for more information + /// + public float ViscositySigma; + + /// + /// See pvfs.pdf for more information + /// + public float ViscosityBeta; + + /// + /// Toggles plasticity computation (springs etc.) + /// + public bool UsePlasticity; + + /// + /// Plasticity, amount of memory of the shape + /// See pvfs.pdf for more information + /// + public float Plasticity; + + /// + /// K of the springs used for plasticity + /// + public float KSpring; + + /// + /// Amount of change of the rest length of the springs (when compressed) + /// + public float YieldRatioCompress; + + /// + /// Amount of change of the rest length of the springs (when stretched) + /// + public float YieldRatioStretch; + + public static FluidDefinition Default + { + get + { + FluidDefinition def = new FluidDefinition + { + InfluenceRadius = 1.0f, + DensityRest = 10.0f, + Stiffness = 10.0f, + StiffnessNear = 0.0f, // Set by Check() + + UseViscosity = false, + ViscositySigma = 10.0f, + ViscosityBeta = 0.0f, + + UsePlasticity = false, + Plasticity = 0.3f, + KSpring = 2.0f, + YieldRatioCompress = 0.1f, + YieldRatioStretch = 0.1f + }; + + def.Check(); + + return def; + } + } + + public void Check() + { + InfluenceRadius = MathUtils.Clamp(InfluenceRadius, 0.1f, 10.0f); + DensityRest = MathUtils.Clamp(DensityRest, 1.0f, 100.0f); + Stiffness = MathUtils.Clamp(Stiffness, 0.1f, 10.0f); + StiffnessNear = Stiffness * 100.0f; // See pvfs.pdf + + ViscositySigma = Math.Max(ViscositySigma, 0.0f); + ViscosityBeta = Math.Max(ViscosityBeta, 0.0f); + + Plasticity = Math.Max(Plasticity, 0.0f); + KSpring = Math.Max(KSpring, 0.0f); + YieldRatioCompress = Math.Max(YieldRatioCompress, 0.0f); + YieldRatioStretch = Math.Max(YieldRatioStretch, 0.0f); + } + } +} \ No newline at end of file diff --git a/Simulacion/Fluids/1/FluidParticle.cs b/Simulacion/Fluids/1/FluidParticle.cs new file mode 100644 index 0000000..395ed4e --- /dev/null +++ b/Simulacion/Fluids/1/FluidParticle.cs @@ -0,0 +1,80 @@ +/* Original source Farseer Physics Engine: + * Copyright (c) 2014 Ian Qvist, http://farseerphysics.codeplex.com + * Microsoft Permissive License (Ms-PL) v1.1 + */ + +using System.Collections.Generic; +using nkast.Aether.Physics2D.Common; + +namespace tainicom.Aether.Physics2D.Fluids +{ + public class FluidParticle + { + public Vector2 Position; + public Vector2 PreviousPosition; + + public Vector2 Velocity; + public Vector2 Acceleration; + + internal FluidParticle(Vector2 position) + { + Neighbours = new List(); + IsActive = true; + MoveTo(position); + + Damping = 0.0f; + Mass = 1.0f; + } + + public bool IsActive { get; set; } + + public List Neighbours { get; private set; } + + // For gameplay purposes + public float Density { get; internal set; } + public float Pressure { get; internal set; } + + // Other properties + public int Index { get; internal set; } + + // Physics properties + public float Damping { get; set; } + public float Mass { get; set; } + + public void MoveTo(Vector2 p) + { + Position = p; + PreviousPosition = p; + + Velocity = Vector2.Zero; + Acceleration = Vector2.Zero; + } + + public void ApplyForce(ref Vector2 force) + { + Acceleration += force * Mass; + } + + public void ApplyImpulse(ref Vector2 impulse) + { + Velocity += impulse; + } + + public void Update(float deltaTime) + { + Velocity += Acceleration * deltaTime; + + Vector2 delta = (1.0f - Damping) * Velocity * deltaTime; + + PreviousPosition = Position; + Position += delta; + + Acceleration = Vector2.Zero; + } + + public void UpdateVelocity(float deltaTime) + { + Velocity = (Position - PreviousPosition) / deltaTime; + } + } +} diff --git a/Simulacion/Fluids/1/FluidSystem1.cs b/Simulacion/Fluids/1/FluidSystem1.cs new file mode 100644 index 0000000..9d6bc2c --- /dev/null +++ b/Simulacion/Fluids/1/FluidSystem1.cs @@ -0,0 +1,413 @@ +/* Original source Farseer Physics Engine: + * Copyright (c) 2014 Ian Qvist, http://farseerphysics.codeplex.com + * Microsoft Permissive License (Ms-PL) v1.1 + */ + +using System; +using System.Collections.Generic; +using nkast.Aether.Physics2D.Common; + +namespace tainicom.Aether.Physics2D.Fluids +{ + public class FluidSystem1 + { + private float _influenceRadiusSquared; + private HashGrid _hashGrid = new HashGrid(); + private Dictionary _springs = new Dictionary(); + private List _springsToRemove = new List(); + private Vector2 _totalForce; + + public FluidSystem1(Vector2 gravity) + { + Gravity = gravity; + Particles = new List(); + DefaultDefinition(); + } + + public FluidDefinition Definition { get; private set; } + public List Particles { get; private set; } + public int ParticlesCount { get { return Particles.Count; } } + public Vector2 Gravity { get; set; } + + public void DefaultDefinition() + { + SetDefinition(FluidDefinition.Default); + } + + public void SetDefinition(FluidDefinition def) + { + Definition = def; + Definition.Check(); + _influenceRadiusSquared = Definition.InfluenceRadius * Definition.InfluenceRadius; + } + + public FluidParticle AddParticle(Vector2 position) + { + FluidParticle particle = new FluidParticle(position) { Index = Particles.Count }; + Particles.Add(particle); + return particle; + } + + public void Clear() + { + //TODO + } + + public void ApplyForce(Vector2 f) + { + _totalForce += f; + } + + private void ApplyForces() + { + Vector2 f = Gravity + _totalForce; + + for (int i = 0; i < Particles.Count; ++i) + { + Particles[i].ApplyForce(ref f); + } + + _totalForce = Vector2.Zero; + } + + private void ApplyViscosity(FluidParticle p, float timeStep) + { + for (int i = 0; i < p.Neighbours.Count; ++i) + { + FluidParticle neighbour = p.Neighbours[i]; + + if (p.Index >= neighbour.Index) + { + continue; + } + + float q; + Vector2.DistanceSquared(ref p.Position, ref neighbour.Position, out q); + + if (q > _influenceRadiusSquared) + { + continue; + } + + Vector2 direction; + Vector2.Subtract(ref neighbour.Position, ref p.Position, out direction); + + if (direction.LengthSquared() < float.Epsilon) + { + continue; + } + + direction.Normalize(); + + Vector2 deltaVelocity; + Vector2.Subtract(ref p.Velocity, ref neighbour.Velocity, out deltaVelocity); + + float u; + Vector2.Dot(ref deltaVelocity, ref direction, out u); + + if (u > 0.0f) + { + q = 1.0f - (float)Math.Sqrt(q) / Definition.InfluenceRadius; + + float impulseFactor = 0.5f * timeStep * q * (u * (Definition.ViscositySigma + Definition.ViscosityBeta * u)); + + Vector2 impulse; + + Vector2.Multiply(ref direction, -impulseFactor, out impulse); + p.ApplyImpulse(ref impulse); + + Vector2.Multiply(ref direction, impulseFactor, out impulse); + neighbour.ApplyImpulse(ref impulse); + } + } + } + + private const int MaxNeighbors = 25; + //private int _len2; + //private int _j; + //private float _q; + //private float _qq; + + //private Vector2 _rij; + //private float _d; + //private Vector2 _dx; + private float _density; + private float _densityNear; + private float _pressure; + private float _pressureNear; + private float[] _distanceCache = new float[MaxNeighbors]; + + //private void DoubleDensityRelaxation1(FluidParticle p, float timeStep) + //{ + // _density = 0; + // _densityNear = 0; + + // _len2 = p.Neighbours.Count; + // if (_len2 > MaxNeighbors) + // _len2 = MaxNeighbors; + + // for (_j = 0; _j < _len2; _j++) + // { + // _q = Vector2.DistanceSquared(p.Position, p.Neighbours[_j].Position); + // _distanceCache[_j] = _q; + // if (_q < _influenceRadiusSquared && _q != 0) + // { + // _q = (float)Math.Sqrt(_q); + // _q /= Definition.InfluenceRadius; + // _qq = ((1 - _q) * (1 - _q)); + // _density += _qq; + // _densityNear += _qq * (1 - _q); + // } + // } + + // _pressure = Definition.Stiffness * (_density - Definition.DensityRest); + // _pressureNear = Definition.StiffnessNear * _densityNear; + + // _dx = Vector2.Zero; + + // for (_j = 0; _j < _len2; _j++) + // { + // _q = _distanceCache[_j]; + // if (_q < _influenceRadiusSquared && _q != 0) + // { + // _q = (float)Math.Sqrt(_q); + // _rij = p.Neighbours[_j].Position; + // _rij -= p.Position; + // _rij *= 1 / _q; + // _q /= _influenceRadiusSquared; + + // _d = ((timeStep * timeStep) * (_pressure * (1 - _q) + _pressureNear * (1 - _q) * (1 - _q))); + // _rij *= _d * 0.5f; + // p.Neighbours[_j].Position += _rij; + // _dx -= _rij; + // } + // } + // p.Position += _dx; + //} + + private void DoubleDensityRelaxation(FluidParticle particle, float deltaTime2) + { + _density = 0.0f; + _densityNear = 0.0f; + + int neightborCount = particle.Neighbours.Count; + + if (neightborCount > MaxNeighbors) + neightborCount = MaxNeighbors; + + for (int i = 0; i < neightborCount; ++i) + { + FluidParticle neighbour = particle.Neighbours[i]; + + if (particle.Index == neighbour.Index) + continue; + + float q; + Vector2.DistanceSquared(ref particle.Position, ref neighbour.Position, out q); + _distanceCache[i] = q; + + if (q > _influenceRadiusSquared) + continue; + + q = 1.0f - (float)Math.Sqrt(q) / Definition.InfluenceRadius; + + float densityDelta = q * q; + _density += densityDelta; + _densityNear += densityDelta * q; + } + + _pressure = Definition.Stiffness * (_density - Definition.DensityRest); + _pressureNear = Definition.StiffnessNear * _densityNear; + + // For gameplay purposes + particle.Density = _density + _densityNear; + particle.Pressure = _pressure + _pressureNear; + + Vector2 delta = Vector2.Zero; + + for (int i = 0; i < neightborCount; ++i) + { + FluidParticle neighbour = particle.Neighbours[i]; + + if (particle.Index == neighbour.Index) + continue; + + float q = _distanceCache[i]; + + if (q > _influenceRadiusSquared) + continue; + + q = 1.0f - (float)Math.Sqrt(q) / Definition.InfluenceRadius; + + float dispFactor = deltaTime2 * (q * (_pressure + _pressureNear * q)); + + Vector2 direction; + Vector2.Subtract(ref neighbour.Position, ref particle.Position, out direction); + + if (direction.LengthSquared() < float.Epsilon) + continue; + + direction.Normalize(); + + Vector2 disp; + + Vector2.Multiply(ref direction, dispFactor, out disp); + Vector2.Add(ref neighbour.Position, ref disp, out neighbour.Position); + + Vector2.Multiply(ref direction, -dispFactor, out disp); + Vector2.Add(ref delta, ref disp, out delta); + } + + Vector2.Add(ref particle.Position, ref delta, out particle.Position); + } + + private void CreateSprings(FluidParticle p) + { + for (int i = 0; i < p.Neighbours.Count; ++i) + { + FluidParticle neighbour = p.Neighbours[i]; + + if (p.Index >= neighbour.Index) + continue; + + float q; + Vector2.DistanceSquared(ref p.Position, ref neighbour.Position, out q); + + if (q > _influenceRadiusSquared) + continue; + + SpringHash hash = new SpringHash { P0 = p, P1 = neighbour }; + + if (!_springs.ContainsKey(hash)) + { + //TODO: Use pool? + Spring spring = new Spring(p, neighbour) { RestLength = (float)Math.Sqrt(q) }; + _springs.Add(hash, spring); + } + } + } + + private void AdjustSprings(float timeStep) + { + foreach (var pair in _springs) + { + Spring spring = pair.Value; + + spring.Update(timeStep, Definition.KSpring, Definition.InfluenceRadius); + + if (spring.Active) + { + float L = spring.RestLength; + float distance; + Vector2.Distance(ref spring.P0.Position, ref spring.P1.Position, out distance); + + if (distance > (L + (Definition.YieldRatioStretch * L))) + { + spring.RestLength += timeStep * Definition.Plasticity * (distance - L - (Definition.YieldRatioStretch * L)); + } + else if (distance < (L - (Definition.YieldRatioCompress * L))) + { + spring.RestLength -= timeStep * Definition.Plasticity * (L - (Definition.YieldRatioCompress * L) - distance); + } + } + else + { + _springsToRemove.Add(pair.Key); + } + } + + for (int i = 0; i < _springsToRemove.Count; ++i) + { + _springs.Remove(_springsToRemove[i]); + } + } + + private void ComputeNeighbours() + { + _hashGrid.GridSize = Definition.InfluenceRadius; + _hashGrid.Clear(); + + for (int i = 0; i < Particles.Count; ++i) + { + FluidParticle p = Particles[i]; + + if (p.IsActive) + { + _hashGrid.Add(p); + } + } + + for (int i = 0; i < Particles.Count; ++i) + { + FluidParticle p = Particles[i]; + p.Neighbours.Clear(); + _hashGrid.Find(ref p.Position, p.Neighbours); + } + } + + public void Update(float deltaTime) + { + if (deltaTime == 0) + return; + + float deltaTime2 = 0.5f * deltaTime * deltaTime; + + ComputeNeighbours(); + ApplyForces(); + + if (Definition.UseViscosity) + { + for (int i = 0; i < Particles.Count; ++i) + { + FluidParticle p = Particles[i]; + if (p.IsActive) + { + ApplyViscosity(p, deltaTime); + } + } + } + + for (int i = 0; i < Particles.Count; ++i) + { + FluidParticle p = Particles[i]; + if (p.IsActive) + { + p.Update(deltaTime); + } + } + + for (int i = 0; i < Particles.Count; ++i) + { + FluidParticle p = Particles[i]; + if (p.IsActive) + { + DoubleDensityRelaxation(p, deltaTime2); + } + } + + if (Definition.UsePlasticity) + { + for (int i = 0; i < Particles.Count; ++i) + { + FluidParticle p = Particles[i]; + if (p.IsActive) + { + CreateSprings(p); + } + } + } + + AdjustSprings(deltaTime); + + UpdateVelocities(deltaTime); + } + + internal void UpdateVelocities(float timeStep) + { + for (int i = 0; i < Particles.Count; ++i) + { + Particles[i].UpdateVelocity(timeStep); + } + } + } +} diff --git a/Simulacion/Fluids/1/HashGrid.cs b/Simulacion/Fluids/1/HashGrid.cs new file mode 100644 index 0000000..64dcd8a --- /dev/null +++ b/Simulacion/Fluids/1/HashGrid.cs @@ -0,0 +1,95 @@ +/* Original source Farseer Physics Engine: + * Copyright (c) 2014 Ian Qvist, http://farseerphysics.codeplex.com + * Microsoft Permissive License (Ms-PL) v1.1 + */ + +using System; +using System.Collections.Generic; +using nkast.Aether.Physics2D.Common; + +namespace tainicom.Aether.Physics2D.Fluids +{ + /// + /// Grid used by particle system to keep track of neightbor particles. + /// + public class HashGrid + { + private Dictionary> _hash = new Dictionary>(); + private Stack> _bucketPool = new Stack>(); + + public HashGrid() + { + GridSize = 1.0f; + } + + public float GridSize { get; set; } + + private static ulong HashKey(int x, int y) + { + return ((ulong)x * 2185031351ul) ^ ((ulong)y * 4232417593ul); + } + + private ulong HashKey(Vector2 position) + { + return HashKey( + (int)Math.Floor(position.X / GridSize), + (int)Math.Floor(position.Y / GridSize) + ); + } + + public void Clear() + { + foreach (KeyValuePair> pair in _hash) + { + pair.Value.Clear(); + _bucketPool.Push(pair.Value); + } + _hash.Clear(); + } + + public void Add(FluidParticle particle) + { + ulong key = HashKey(particle.Position); + List bucket; + if (!_hash.TryGetValue(key, out bucket)) + { + if (_bucketPool.Count > 0) + { + bucket = _bucketPool.Pop(); + } + else + { + bucket = new List(); + } + _hash.Add(key, bucket); + } + bucket.Add(particle); + } + + public void Find(ref Vector2 position, List neighbours) + { + int ix = (int)Math.Floor(position.X / GridSize); + int iy = (int)Math.Floor(position.Y / GridSize); + + // Check all 9 neighbouring cells + for (int x = ix - 1; x <= ix + 1; ++x) + { + for (int y = iy - 1; y <= iy + 1; ++y) + { + ulong key = HashKey(x, y); + List bucket; + if (_hash.TryGetValue(key, out bucket)) + { + for (int i = 0; i < bucket.Count; ++i) + { + if (bucket[i] != null) + { + neighbours.Add(bucket[i]); + } + } + } + } + } + } + } +} diff --git a/Simulacion/Fluids/1/Spring.cs b/Simulacion/Fluids/1/Spring.cs new file mode 100644 index 0000000..76625ae --- /dev/null +++ b/Simulacion/Fluids/1/Spring.cs @@ -0,0 +1,57 @@ +/* Original source Farseer Physics Engine: + * Copyright (c) 2014 Ian Qvist, http://farseerphysics.codeplex.com + * Microsoft Permissive License (Ms-PL) v1.1 + */ + +using nkast.Aether.Physics2D.Common; + +namespace tainicom.Aether.Physics2D.Fluids +{ + //TODO: Could be struct? + + public class Spring + { + public FluidParticle P0; + public FluidParticle P1; + + public Spring(FluidParticle p0, FluidParticle p1) + { + Active = true; + P0 = p0; + P1 = p1; + } + + public bool Active { get; set; } + public float RestLength { get; set; } + + public void Update(float timeStep, float kSpring, float influenceRadius) + { + if (!Active) + return; + + Vector2 dir = P1.Position - P0.Position; + float distance = dir.Length(); + dir.Normalize(); + + // This is to avoid imploding simulation with really springy fluids + if (distance < 0.5f * influenceRadius) + { + Active = false; + return; + } + if (RestLength > influenceRadius) + { + Active = false; + return; + } + + //Algorithm 3 + float displacement = timeStep * timeStep * kSpring * (1.0f - RestLength / influenceRadius) * (RestLength - distance) * 0.5f; + + dir *= displacement; + + P0.Position -= dir; + P1.Position += dir; + } + } +} diff --git a/Simulacion/Fluids/1/SpringHash.cs b/Simulacion/Fluids/1/SpringHash.cs new file mode 100644 index 0000000..49c9529 --- /dev/null +++ b/Simulacion/Fluids/1/SpringHash.cs @@ -0,0 +1,26 @@ +/* Original source Farseer Physics Engine: + * Copyright (c) 2014 Ian Qvist, http://farseerphysics.codeplex.com + * Microsoft Permissive License (Ms-PL) v1.1 + */ + +using System.Collections.Generic; + +namespace tainicom.Aether.Physics2D.Fluids +{ + public class SpringHash : IEqualityComparer + { + public FluidParticle P0; + public FluidParticle P1; + + public bool Equals(SpringHash lhs, SpringHash rhs) + { + return (lhs.P0.Index == rhs.P0.Index && lhs.P1.Index == rhs.P1.Index) + || (lhs.P0.Index == rhs.P1.Index && lhs.P1.Index == rhs.P0.Index); + } + + public int GetHashCode(SpringHash s) + { + return (s.P0.Index * 73856093) ^ (s.P1.Index * 19349663) ^ (s.P0.Index * 19349663) ^ (s.P1.Index * 73856093); + } + } +} \ No newline at end of file diff --git a/Simulacion/Fluids/2/FluidSystem2.cs b/Simulacion/Fluids/2/FluidSystem2.cs new file mode 100644 index 0000000..288ed89 --- /dev/null +++ b/Simulacion/Fluids/2/FluidSystem2.cs @@ -0,0 +1,445 @@ +/* Original source Farseer Physics Engine: + * Copyright (c) 2014 Ian Qvist, http://farseerphysics.codeplex.com + * Microsoft Permissive License (Ms-PL) v1.1 + */ + +using System; +using System.Collections.Generic; +using nkast.Aether.Physics2D.Common; + +namespace tainicom.Aether.Physics2D.Fluids +{ + public class FluidSystem2 + { + public const int MaxNeighbors = 25; + public const int CellSize = 1; + + // Most of these can be tuned at runtime with F1-F9 and keys 1-9 (no numpad) + public const float InfluenceRadius = 20.0f; + public const float InfluenceRadiusSquared = InfluenceRadius * InfluenceRadius; + public const float Stiffness = 0.504f; + public const float StiffnessFarNearRatio = 10.0f; + public const float StiffnessNear = Stiffness * StiffnessFarNearRatio; + public const float ViscositySigma = 0.0f; + public const float ViscosityBeta = 0.3f; + public const float DensityRest = 10.0f; + public const float KSpring = 0.3f; + public const float RestLength = 5.0f; + public const float RestLengthSquared = RestLength * RestLength; + public const float YieldRatioStretch = 0.5f; + public const float YieldRatioCompress = 0.5f; + public const float Plasticity = 0.5f; + public const int VelocityCap = 150; + public const float DeformationFactor = 0f; + public const float CollisionForce = 0.3f; + + private bool _isElasticityInitialized; + private bool _elasticityEnabled; + private bool _isPlasticityInitialized; + private bool _plasticityEnabled; + + private float _deltaTime2; + private Vector2 _dx = new Vector2(0.0f, 0.0f); + private const int Wpadding = 20; + private const int Hpadding = 20; + + public SpatialTable Particles; + + // Temp variables + private Vector2 _rij = new Vector2(0.0f, 0.0f); + private Vector2 _tempVect = new Vector2(0.0f, 0.0f); + + private Dictionary> _springPresenceTable; + private List _springs; + private List _tempParticles; + + private int _worldWidth; + private int _worldHeight; + + public int ParticlesCount { get { return Particles.Count; } } + + public FluidSystem2(Vector2 gravity, int maxParticleLimit, int worldWidth, int worldHeight) + { + _worldHeight = worldHeight; + _worldWidth = worldWidth; + Particles = new SpatialTable(worldWidth, worldHeight, CellSize); + MaxParticleLimit = maxParticleLimit; + Gravity = gravity; + } + + public Vector2 Gravity { get; set; } + public int MaxParticleLimit { get; private set; } + + public bool ElasticityEnabled + { + get { return _elasticityEnabled; } + set + { + if (!_isElasticityInitialized) + InitializeElasticity(); + + _elasticityEnabled = value; + } + } + + public bool PlasticityEnabled + { + get { return _plasticityEnabled; } + set + { + if (!_isPlasticityInitialized) + InitializePlasticity(); + + _plasticityEnabled = value; + } + } + + private void UpdateParticleVelocity(float deltaTime) + { + for(int i = 0; i < Particles.Count; i++) + { + Particle particle = Particles[i]; + particle.PreviousPosition = particle.Position; + particle.Position = new Vector2(particle.Position.X + (deltaTime * particle.Velocity.X), particle.Position.Y + (deltaTime * particle.Velocity.Y)); + } + } + + private void WallCollision(Particle pi) + { + float x = 0; + float y = 0; + + if (pi.Position.X > (_worldWidth / 2 - Wpadding)) + x -= (pi.Position.X - (_worldWidth / 2 - Wpadding)) / CollisionForce; + else if (pi.Position.X < (-_worldWidth / 2 + Wpadding)) + x += ((-_worldWidth / 2 + Wpadding) - pi.Position.X) / CollisionForce; + + if (pi.Position.Y > (_worldHeight - Hpadding)) + y -= (pi.Position.Y - (_worldHeight - Hpadding)) / CollisionForce; + else if (pi.Position.Y < Hpadding) + y += (Hpadding - pi.Position.Y) / CollisionForce; + + pi.Velocity.X += x; + pi.Velocity.Y += y; + } + + private void CapVelocity(Vector2 v) + { + if (v.X > VelocityCap) + v.X = VelocityCap; + else if (v.X < -VelocityCap) + v.X = -VelocityCap; + + if (v.Y > VelocityCap) + v.Y = VelocityCap; + else if (v.Y < -VelocityCap) + v.Y = -VelocityCap; + } + + private void InitializePlasticity() + { + _isPlasticityInitialized = true; + + _springs.Clear(); + float q; + foreach (Particle pa in Particles) + { + foreach (Particle pb in Particles) + { + if (pa.GetHashCode() == pb.GetHashCode()) + continue; + + Vector2.Distance(ref pa.Position, ref pb.Position, out q); + Vector2.Subtract(ref pb.Position, ref pa.Position, out _rij); + _rij /= q; + + if (q < RestLength) + { + _springs.Add(new Spring2(pa, pb, q)); + } + } + pa.Velocity = Vector2.Zero; + } + } + + private void CalculatePlasticity(float deltaTime) + { + foreach (Spring2 spring in _springs) + { + spring.Update(); + + if (spring.CurrentDistance == 0) + continue; + + Vector2.Subtract(ref spring.PB.Position, ref spring.PA.Position, out _rij); + _rij /= spring.CurrentDistance; + float D = deltaTime * KSpring * (spring.RestLength - spring.CurrentDistance); + _rij *= (D * 0.5f); + spring.PA.Position = new Vector2(spring.PA.Position.X - _rij.X, spring.PA.Position.Y - _rij.Y); + spring.PB.Position = new Vector2(spring.PB.Position.X + _rij.X, spring.PB.Position.Y + _rij.Y); + } + } + + private void InitializeElasticity() + { + _isElasticityInitialized = true; + + foreach (Particle particle in Particles) + { + _springPresenceTable.Add(particle.GetHashCode(), new List(MaxParticleLimit)); + particle.Velocity = Vector2.Zero; + } + } + + private void CalculateElasticity(float deltaTime) + { + float sqDist; + for (int i = 0; i < Particles.Count; i++) + { + Particle pa = Particles[i]; + + if (Particles.CountNearBy(pa) <= 1) + continue; + + _tempParticles = Particles.GetNearby(pa); + int len2 = _tempParticles.Count; + + if (len2 > MaxNeighbors) + len2 = MaxNeighbors; + + for (int j = 0; j < len2; j++) + { + Particle pb = Particles[j]; + Vector2.DistanceSquared(ref pa.Position, ref pb.Position, out sqDist); + if (sqDist > RestLengthSquared) + continue; + if (pa.GetHashCode() == pb.GetHashCode()) + continue; + if (!_springPresenceTable[pa.GetHashCode()].Contains(pb.GetHashCode())) + { + _springs.Add(new Spring2(pa, pb, RestLength)); + _springPresenceTable[pa.GetHashCode()].Add(pb.GetHashCode()); + } + } + } + + for (int i = _springs.Count - 1; i >= 0; i--) + { + Spring2 spring = _springs[i]; + spring.Update(); + + // Stretch + if (spring.CurrentDistance > (spring.RestLength + DeformationFactor)) + { + spring.RestLength += deltaTime * Plasticity * (spring.CurrentDistance - spring.RestLength - (YieldRatioStretch * spring.RestLength)); + } + // Compress + else if (spring.CurrentDistance < (spring.RestLength - DeformationFactor)) + { + spring.RestLength -= deltaTime * Plasticity * (spring.RestLength - (YieldRatioCompress * spring.RestLength) - spring.CurrentDistance); + } + // Remove springs with restLength longer than REST_LENGTH + if (spring.RestLength > RestLength) + { + _springs.RemoveAt(i); + _springPresenceTable[spring.PA.GetHashCode()].Remove(spring.PB.GetHashCode()); + } + else + { + if (spring.CurrentDistance == 0) + continue; + + Vector2.Subtract(ref spring.PB.Position, ref spring.PA.Position, out _rij); + _rij /= spring.CurrentDistance; + float D = deltaTime * KSpring * (spring.RestLength - spring.CurrentDistance); + _rij *= (D * 0.5f); + spring.PA.Position = new Vector2(spring.PA.Position.X - _rij.X, spring.PA.Position.Y - _rij.Y); + spring.PB.Position = new Vector2(spring.PB.Position.X + _rij.X, spring.PB.Position.Y + _rij.Y); + } + } + } + + private void ApplyGravity(Particle particle) + { + particle.Velocity = new Vector2(particle.Velocity.X + Gravity.X, particle.Velocity.Y + Gravity.Y); + } + + private void ApplyViscosity(float deltaTime) + { + float u, q; + for (int i = 0; i < Particles.Count; i++) + { + Particle particle = Particles[i]; + + _tempParticles = Particles.GetNearby(particle); + + int len2 = _tempParticles.Count; + if (len2 > MaxNeighbors) + len2 = MaxNeighbors; + + for (int j = 0; j < len2; j++) + { + Particle tempParticle = _tempParticles[j]; + + Vector2.DistanceSquared(ref particle.Position, ref tempParticle.Position, out q); + if ((q < InfluenceRadiusSquared) && (q != 0)) + { + q = (float)Math.Sqrt(q); + Vector2.Subtract(ref tempParticle.Position, ref particle.Position, out _rij); + Vector2.Divide(ref _rij, q, out _rij); + + Vector2.Subtract(ref particle.Velocity, ref tempParticle.Velocity, out _tempVect); + Vector2.Dot(ref _tempVect, ref _rij, out u); + if (u <= 0.0f) + continue; + + q /= InfluenceRadius; + + float I = (deltaTime * (1 - q) * (ViscositySigma * u + ViscosityBeta * u * u)); + Vector2.Multiply(ref _rij, (I * 0.5f), out _rij); + Vector2.Subtract(ref particle.Velocity, ref _rij, out _tempVect); + particle.Velocity = _tempVect; + _tempVect = tempParticle.Velocity; + _tempVect += _rij; + tempParticle.Velocity = _tempVect; + } + } + } + } + + private void DoubleDensityRelaxation() + { + float q; + for (int i = 0; i < Particles.Count; i++) + { + Particle particle = Particles[i]; + particle.Density = 0; + particle.NearDensity = 0; + + _tempParticles = Particles.GetNearby(particle); + + int len2 = _tempParticles.Count; + if (len2 > MaxNeighbors) + len2 = MaxNeighbors; + + for (int j = 0; j < len2; j++) + { + Particle tempParticle = _tempParticles[j]; + + Vector2.DistanceSquared(ref particle.Position, ref tempParticle.Position, out q); + if (q < InfluenceRadiusSquared && q != 0) + { + q = (float)Math.Sqrt(q); + q /= InfluenceRadius; + float qq = ((1 - q) * (1 - q)); + particle.Density += qq; + particle.NearDensity += qq * (1 - q); + } + } + + particle.Pressure = (Stiffness * (particle.Density - DensityRest)); + particle.NearPressure = (StiffnessNear * particle.NearDensity); + _dx = Vector2.Zero; + + for (int j = 0; j < len2; j++) + { + Particle tempParticle = _tempParticles[j]; + + Vector2.DistanceSquared(ref particle.Position, ref tempParticle.Position, out q); + if ((q < InfluenceRadiusSquared) && (q != 0)) + { + q = (float)Math.Sqrt(q); + Vector2.Subtract(ref tempParticle.Position, ref particle.Position, out _rij); + Vector2.Divide(ref _rij, q, out _rij); + q /= InfluenceRadius; + + float D = (_deltaTime2 * (particle.Pressure * (1 - q) + particle.NearPressure * (1 - q) * (1 - q))); + Vector2.Multiply(ref _rij, (D * 0.5f), out _rij); + tempParticle.Position = new Vector2(tempParticle.Position.X + _rij.X, tempParticle.Position.Y + _rij.Y); + Vector2.Subtract(ref _dx, ref _rij, out _dx); + } + } + particle.Position = particle.Position + _dx; + } + } + + public void Update(float deltaTime) + { + if (deltaTime == 0) + return; + + _deltaTime2 = deltaTime * deltaTime; + + ApplyViscosity(deltaTime); + + //Update velocity + UpdateParticleVelocity(deltaTime); + + Particles.Rehash(); + + if (_elasticityEnabled) + CalculateElasticity(deltaTime); + + if (_plasticityEnabled) + CalculatePlasticity(deltaTime); + + DoubleDensityRelaxation(); + + for(int i = 0; i < Particles.Count; i++) + { + Particle particle = Particles[i]; + particle.Velocity = new Vector2((particle.Position.X - particle.PreviousPosition.X) / deltaTime, (particle.Position.Y - particle.PreviousPosition.Y) / deltaTime); + ApplyGravity(particle); + WallCollision(particle); + CapVelocity(particle.Velocity); + } + } + + public void AddParticle(Vector2 position) + { + Particles.Add(new Particle(position.X, position.Y)); + } + + } + + public class Particle + { + public float Density; + public float NearDensity; + public float NearPressure; + public Vector2 Position = new Vector2(0, 0); + public float Pressure; + public Vector2 PreviousPosition = new Vector2(0, 0); + public Vector2 Velocity = new Vector2(0, 0); + + public Particle(float posX, float posY) + { + Position = new Vector2(posX, posY); + } + } + + public class Spring2 + { + public float CurrentDistance; + public Particle PA; + public Particle PB; + public float RestLength; + + public Spring2(Particle pa, Particle pb, float restLength) + { + PA = pa; + PB = pb; + RestLength = restLength; + } + + public void Update() + { + Vector2.Distance(ref PA.Position, ref PB.Position, out CurrentDistance); + } + + public bool Contains(Particle p) + { + return (PA.GetHashCode() == p.GetHashCode() || PB.GetHashCode() == p.GetHashCode()); + } + } +} \ No newline at end of file diff --git a/Simulacion/Fluids/2/SpartialTable.cs b/Simulacion/Fluids/2/SpartialTable.cs new file mode 100644 index 0000000..e8ac716 --- /dev/null +++ b/Simulacion/Fluids/2/SpartialTable.cs @@ -0,0 +1,179 @@ +/* Original source Farseer Physics Engine: + * Copyright (c) 2014 Ian Qvist, http://farseerphysics.codeplex.com + * Microsoft Permissive License (Ms-PL) v1.1 + */ + +using System.Collections; +using System.Collections.Generic; + +namespace tainicom.Aether.Physics2D.Fluids +{ + public class SpatialTable : IEnumerable + { + // default nearby table size + private const int DefaultNearbySize = 50; + private List _table; + private List _voidList = new List(1); + private List[][] _nearby; + bool _initialized; + + private int _row; + private int _column; + private int _cellSize; + + public SpatialTable(int column, int row, int cellSize) + { + _row = row; + _cellSize = cellSize; + _column = column; + } + + public void Initialize() + { + _table = new List((_row * _column) / 2); + _nearby = new List[_column][]; + + for (int i = 0; i < _column; ++i) + { + _nearby[i] = new List[_row]; + + for (int j = 0; j < _row; ++j) + { + _nearby[i][j] = new List(DefaultNearbySize); + } + } + _initialized = true; + } + + /// + /// Append value to the table and identify its position in the space. + /// Don't need to rehash table after append operation. + /// + public void Add(Particle value) + { + if (!_initialized) + Initialize(); + + AddInterRadius(value); + _table.Add(value); + } + + public Particle this[int i] + { + get { return _table[i]; } + set { _table[i] = value; } + } + + public void Remove(Particle value) + { + _table.Remove(value); + } + + public void Clear() + { + for (int i = 0; i < _column; ++i) + { + for (int j = 0; j < _row; ++j) + { + _nearby[i][j].Clear(); + _nearby[i][j] = null; + } + } + _table.Clear(); + } + + public int Count + { + get { return (_table == null)? 0 : _table.Count; } + } + + public List GetNearby(Particle value) + { + int x = posX(value); + int y = posY(value); + + if (!InRange(x, y)) + return _voidList; + + return _nearby[x][y]; + } + + private int posX(Particle value) + { + return (int)((value.Position.X + (_column / 2) + 0.3f) / _cellSize); + } + + private int posY(Particle value) + { + return (int)((value.Position.Y + 0.3f) / _cellSize); + } + + public int CountNearBy(Particle value) + { + return GetNearby(value).Count; + } + + /// + /// Updates the spatial relationships of objects. Rehash function + /// needed if elements change their position in the space. + /// + public void Rehash() + { + if (_table == null || _table.Count == 0) + return; + + for (int i = 0; i < _column; i++) + { + for (int j = 0; j < _row; j++) + { + if (_nearby[i][j] != null) + _nearby[i][j].Clear(); + } + } + + foreach (Particle particle in _table) + { + AddInterRadius(particle); + } + } + + /// + /// Add element to its position and neighbor cells. + /// + /// + private void AddInterRadius(Particle value) + { + for (int i = -1; i < 2; ++i) + { + for (int j = -1; j < 2; ++j) + { + int x = posX(value) + i; + int y = posY(value) + j; + if (InRange(x, y)) + _nearby[x][y].Add(value); + } + } + } + + /// + /// Check if a position is out of the spatial range + /// + /// + /// + /// true if position is in range. + private bool InRange(float x, float y) + { + return (x > 0 && x < _column && y > 0 && y < _row); + } + + public IEnumerator GetEnumerator() + { + return _table.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +}