[orx-noise] Add ShapeProvider.uniform() and List<Triangle>.uniform()

This commit is contained in:
Edwin Jakobs
2024-05-22 13:04:06 +02:00
parent 86ae5f70de
commit 37ca4f3a5d
2 changed files with 31 additions and 0 deletions

View File

@@ -25,6 +25,12 @@ fun ShapeProvider.uniform(distanceToEdge: Double = 0.0, random: Random = Random.
}
}
/**
* Generate [sampleCount] uniformly distributed points inside the area of [ShapeProvider]
*/
fun ShapeProvider.uniform(sampleCount: Int) : List<Vector2> = shape.triangulation.uniform(sampleCount)
/**
* Returns a list of pairs in which the first component is a radius and the
* second component a list of [Vector2] positions of items with that radius.