Well, it looks like I realize that I can speed up the method of calculating the farthest color away using coordinates of vertices of resulting voronoi. Here’s my issue, the current approach I have involves using distance to calculate the farthest color. That means a 3D box, and if I have large 3D box, then the calculation can be slow, and that’s just limited to spectrum of 3, where my problem can be spectrum of 1-7. My solution is making a list of coordinates of vertices generated by the voronoi algorithm. But, how do I approach that problem in context of G’MIC?
For dimensions n higher than 3, it is not possible indeed to store your vectors in a n-dimensional array. In that case, you are forced to use another data structure to store/search your vectors.
To find minimal (or maximal) distance, you may be interested by “K-D trees” or “Cover Trees”.
If your number of points are not that high though, you may just do a classical search by computing the distance from all the items in the list, and keep the higher (assuming you can do this in parallel, this can be the simplest thing to do, and still be fast enough).
It is, actually. rep_cartesian_product can allow you to generate a 1D array of n-sized channels which represent a a n-dimension box. $ rep_cartesian_product 5,5,5,5,5
creates a image of size 5 to the power of 5 with 5 channels, and every coordinates, and you can stimulate I/J here too. That’s a 5D box.
The problem is more generating voronoi and higher dimension than 2. I don’t know how that works. 2d explanation is figurable.
OK, but you’ll probably run out of memory quickly
A 5D box that is 100x100x100x100x100 already takes 37 Gb of RAM. And this is still a tiny resolution along each axis.
Ok, I think I found my solution. Remember that I had coded in indexing as in index command within math parser? I could adapt that same technique to find the farthest point in conjunction with +rep_cartesian_product. This can work with 1D+ dimension. Works in 6D too. No voronoi is needed.
EDIT:
See this solution for n-dimensions.
5,1,1,3,v(10)
+rep_cartesian_product {vector(#s#-1,11)}
mirror. c
+index. ..,0,1 -[-2,-1]
sqr.
compose_channels.
+ sqrt.
resize. 11,11,11,1,-1
This works by calculating the norm of vectors of differences throughout all possible coordinates within rep_cartesian_product. The resize part is the proof that rep_cartesian_product approach works. I can retrieve the coordinate farthest away in any dimensions with xM and rep_cartesian_product_index2list.
I applied this via gmic-community. Slower, but it is what it is. Still works for higher dimension (4D+) whereas the earlier solution is restricted to 1-3 though I only allowed 3 before.