+static DWORD compute_sphere_test_index_data(FLOAT radius, UINT slices, UINT stacks)
I haven't really thought this through yet, but would it perhaps be simpler to calculate the faces a vertex is part of, instead of the other way around?
Please find attached the relevant data.
I do not see a way from this data to generate the faces a vertex is part of that would be simpler than what I am doing for indices.
However, if you have any suggestions, I would very much appreciate them.
Thank you as always for your careful review of my patches.
Misha
2010/7/23 Misha Koshelev misha680@gmail.com:
Please find attached the relevant data.
I do not see a way from this data to generate the faces a vertex is part of that would be simpler than what I am doing for indices.
Well, if you look at e.g. the data for slices 6, stacks 7, there indices are certainly very regular:
vertex 0: [0 (0) 1 (0) 2 (0) 3 (0) 4 (0) 5 (0)]
vertex 1: [5 (1) 0 (2)] [16 (1) 17 (0) 6 (0)] vertex 2: [0 (1) 1 (2)] [ 6 (1) 7 (0) 8 (0)] vertex 3: [1 (1) 2 (2)] [ 8 (1) 9 (0) 10 (0)] vertex 4: [2 (1) 3 (2)] [10 (1) 11 (0) 12 (0)] vertex 5: [3 (1) 4 (2)] [12 (1) 13 (0) 14 (0)] vertex 6: [4 (1) 5 (2)] [14 (1) 15 (0) 16 (0)]
vertex 7: [17 (1) 6 (2) 7 (2)] [28 (1) 29 (0) 18 (0)] vertex 8: [ 7 (1) 8 (2) 9 (2)] [18 (1) 19 (0) 20 (0)] vertex 9: [ 9 (1) 10 (2) 11 (2)] [20 (1) 21 (0) 22 (0)] vertex 10: [11 (1) 12 (2) 13 (2)] [22 (1) 23 (0) 24 (0)] vertex 11: [13 (1) 14 (2) 15 (2)] [24 (1) 25 (0) 26 (0)] vertex 12: [15 (1) 16 (2) 17 (2)] [26 (1) 27 (0) 28 (0)]
[...]
vertex 25: [53 (1) 42 (2) 43 (2)] [64 (1) 65 (0) 54 (0)] vertex 26: [43 (1) 44 (2) 45 (2)] [54 (1) 55 (0) 56 (0)] vertex 27: [45 (1) 46 (2) 47 (2)] [56 (1) 57 (0) 58 (0)] vertex 28: [47 (1) 48 (2) 49 (2)] [58 (1) 59 (0) 60 (0)] vertex 29: [49 (1) 50 (2) 51 (2)] [60 (1) 61 (0) 62 (0)] vertex 30: [51 (1) 52 (2) 53 (2)] [62 (1) 63 (0) 64 (0)]
vertex 31: [65 (1) 54 (2) 55 (2)] [71 (1) 66 (0)] vertex 32: [55 (1) 56 (2) 57 (2)] [66 (1) 67 (0)] vertex 33: [57 (1) 58 (2) 59 (2)] [67 (1) 68 (0)] vertex 34: [59 (1) 60 (2) 61 (2)] [68 (1) 69 (0)] vertex 35: [61 (1) 62 (2) 63 (2)] [69 (1) 70 (0)] vertex 36: [63 (1) 64 (2) 65 (2)] [70 (1) 71 (0)]
vertex 37: [66 (2) 67 (2) 68 (2) 69 (2) 70 (2) 71 (2)]
Note that since these are rings, you should be looking at e.g. the "5 (1)" index for vertex 1 as "-1 % slices (1)", etc.