Generating links between zones within the sector using elimination algorithm with connectedness testing Improved sample elimination API - now accepts simple density function! Ported MIConvexHull library to single precision, Unity.Mathematics math Removed old galaxy generator (new code is much better!)
30 lines
545 B
C#
30 lines
545 B
C#
using System.Collections;
|
|
using MIConvexHull;
|
|
using Unity.Mathematics;
|
|
using static Unity.Mathematics.math;
|
|
|
|
public class Vertex3 : IVertex
|
|
{
|
|
public float[] Position => new[] {StoredPosition.x, StoredPosition.y};
|
|
|
|
public float3 StoredPosition;
|
|
|
|
public Vertex3(float x, float y, float z)
|
|
{
|
|
StoredPosition = float3(x, y, z);
|
|
}
|
|
|
|
public Vertex3(float3 pos)
|
|
{
|
|
StoredPosition = pos;
|
|
}
|
|
|
|
public float3 ToFloat3() {
|
|
return StoredPosition;
|
|
}
|
|
|
|
public float Distance(Vertex3 v)
|
|
{
|
|
return length(StoredPosition-v.StoredPosition);
|
|
}
|
|
}
|