2021-03-11 01:36:08 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections;
|
|
|
|
|
|
using MIConvexHull;
|
2026-09-14 17:39:12 +02:00
|
|
|
|
using CultMath;
|
|
|
|
|
|
using static CultMath.math;
|
2021-03-11 01:36:08 +00:00
|
|
|
|
|
|
|
|
|
|
public class Vertex2 : IVertex
|
|
|
|
|
|
{
|
|
|
|
|
|
public float[] Position => new[] {StoredPosition.x, StoredPosition.y};
|
|
|
|
|
|
|
|
|
|
|
|
public float2 StoredPosition;
|
|
|
|
|
|
|
|
|
|
|
|
public float x { get { return StoredPosition.x; } }
|
|
|
|
|
|
public float y { get { return StoredPosition.y; } }
|
|
|
|
|
|
|
|
|
|
|
|
public Vertex2(float x, float y)
|
|
|
|
|
|
{
|
|
|
|
|
|
StoredPosition = float2(x, y);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Vertex2(float2 pos)
|
|
|
|
|
|
{
|
|
|
|
|
|
StoredPosition = pos;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public float2 ToFloat2() {
|
|
|
|
|
|
return StoredPosition;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public float Distance(Vertex2 v)
|
|
|
|
|
|
{
|
|
|
|
|
|
return length(StoredPosition-v.StoredPosition);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|