Blender  V2.93
bmo_primitive.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
23 #include "MEM_guardedalloc.h"
24 
25 #include "BLI_math.h"
26 
27 #include "BKE_customdata.h"
28 
29 #include "DNA_meshdata_types.h"
30 
31 #include "bmesh.h"
33 
34 /* ************************ primitives ******************* */
35 
36 static const float icovert[12][3] = {
37  {0.0f, 0.0f, -200.0f},
38  {144.72f, -105.144f, -89.443f},
39  {-55.277f, -170.128, -89.443f},
40  {-178.885f, 0.0f, -89.443f},
41  {-55.277f, 170.128f, -89.443f},
42  {144.72f, 105.144f, -89.443f},
43  {55.277f, -170.128f, 89.443f},
44  {-144.72f, -105.144f, 89.443f},
45  {-144.72f, 105.144f, 89.443f},
46  {55.277f, 170.128f, 89.443f},
47  {178.885f, 0.0f, 89.443f},
48  {0.0f, 0.0f, 200.0f},
49 };
50 
51 static const short icoface[20][3] = {
52  {0, 1, 2}, {1, 0, 5}, {0, 2, 3}, {0, 3, 4}, {0, 4, 5}, {1, 5, 10}, {2, 1, 6},
53  {3, 2, 7}, {4, 3, 8}, {5, 4, 9}, {1, 10, 6}, {2, 6, 7}, {3, 7, 8}, {4, 8, 9},
54  {5, 9, 10}, {6, 10, 11}, {7, 6, 11}, {8, 7, 11}, {9, 8, 11}, {10, 9, 11},
55 };
56 
57 static const float icouvs[60][2] = {
58  {0.181819f, 0.000000f}, {0.272728f, 0.157461f}, {0.090910f, 0.157461f}, {0.272728f, 0.157461f},
59  {0.363637f, 0.000000f}, {0.454546f, 0.157461f}, {0.909091f, 0.000000f}, {1.000000f, 0.157461f},
60  {0.818182f, 0.157461f}, {0.727273f, 0.000000f}, {0.818182f, 0.157461f}, {0.636364f, 0.157461f},
61  {0.545455f, 0.000000f}, {0.636364f, 0.157461f}, {0.454546f, 0.157461f}, {0.272728f, 0.157461f},
62  {0.454546f, 0.157461f}, {0.363637f, 0.314921f}, {0.090910f, 0.157461f}, {0.272728f, 0.157461f},
63  {0.181819f, 0.314921f}, {0.818182f, 0.157461f}, {1.000000f, 0.157461f}, {0.909091f, 0.314921f},
64  {0.636364f, 0.157461f}, {0.818182f, 0.157461f}, {0.727273f, 0.314921f}, {0.454546f, 0.157461f},
65  {0.636364f, 0.157461f}, {0.545455f, 0.314921f}, {0.272728f, 0.157461f}, {0.363637f, 0.314921f},
66  {0.181819f, 0.314921f}, {0.090910f, 0.157461f}, {0.181819f, 0.314921f}, {0.000000f, 0.314921f},
67  {0.818182f, 0.157461f}, {0.909091f, 0.314921f}, {0.727273f, 0.314921f}, {0.636364f, 0.157461f},
68  {0.727273f, 0.314921f}, {0.545455f, 0.314921f}, {0.454546f, 0.157461f}, {0.545455f, 0.314921f},
69  {0.363637f, 0.314921f}, {0.181819f, 0.314921f}, {0.363637f, 0.314921f}, {0.272728f, 0.472382f},
70  {0.000000f, 0.314921f}, {0.181819f, 0.314921f}, {0.090910f, 0.472382f}, {0.727273f, 0.314921f},
71  {0.909091f, 0.314921f}, {0.818182f, 0.472382f}, {0.545455f, 0.314921f}, {0.727273f, 0.314921f},
72  {0.636364f, 0.472382f}, {0.363637f, 0.314921f}, {0.545455f, 0.314921f}, {0.454546f, 0.472382f},
73 };
74 
75 static const int monkeyo = 4;
76 static const int monkeynv = 271;
77 static const int monkeynf = 250;
78 static const signed char monkeyv[271][3] = {
79  {-71, 21, 98}, {-63, 12, 88}, {-57, 7, 74}, {-82, -3, 79}, {-82, 4, 92},
80  {-82, 17, 100}, {-92, 21, 102}, {-101, 12, 95}, {-107, 7, 83}, {-117, 31, 84},
81  {-109, 31, 95}, {-96, 31, 102}, {-92, 42, 102}, {-101, 50, 95}, {-107, 56, 83},
82  {-82, 66, 79}, {-82, 58, 92}, {-82, 46, 100}, {-71, 42, 98}, {-63, 50, 88},
83  {-57, 56, 74}, {-47, 31, 72}, {-55, 31, 86}, {-67, 31, 97}, {-66, 31, 99},
84  {-70, 43, 100}, {-82, 48, 103}, {-93, 43, 105}, {-98, 31, 105}, {-93, 20, 105},
85  {-82, 31, 106}, {-82, 15, 103}, {-70, 20, 100}, {-127, 55, 95}, {-127, 45, 105},
86  {-127, -87, 94}, {-127, -41, 100}, {-127, -24, 102}, {-127, -99, 92}, {-127, 52, 77},
87  {-127, 73, 73}, {-127, 115, -70}, {-127, 72, -109}, {-127, 9, -106}, {-127, -49, -45},
88  {-101, -24, 72}, {-87, -56, 73}, {-82, -89, 73}, {-80, -114, 68}, {-85, -121, 67},
89  {-104, -124, 71}, {-127, -126, 74}, {-71, -18, 68}, {-46, -5, 69}, {-21, 19, 57},
90  {-17, 55, 76}, {-36, 62, 80}, {-64, 77, 88}, {-86, 97, 94}, {-107, 92, 97},
91  {-119, 63, 96}, {-106, 53, 99}, {-111, 39, 98}, {-101, 12, 95}, {-79, 2, 90},
92  {-64, 8, 86}, {-47, 24, 83}, {-45, 38, 83}, {-50, 48, 85}, {-72, 56, 92},
93  {-95, 60, 97}, {-127, -98, 94}, {-113, -92, 94}, {-112, -107, 91}, {-119, -113, 89},
94  {-127, -114, 88}, {-127, -25, 96}, {-127, -18, 95}, {-114, -19, 95}, {-111, -29, 96},
95  {-116, -37, 95}, {-76, -6, 86}, {-48, 7, 80}, {-34, 26, 77}, {-32, 48, 84},
96  {-39, 53, 93}, {-71, 70, 102}, {-87, 82, 107}, {-101, 79, 109}, {-114, 55, 108},
97  {-111, -13, 104}, {-100, -57, 91}, {-95, -90, 88}, {-93, -105, 85}, {-97, -117, 81},
98  {-106, -119, 81}, {-127, -121, 82}, {-127, 6, 93}, {-127, 27, 98}, {-85, 61, 95},
99  {-106, 18, 96}, {-110, 27, 97}, {-112, -88, 94}, {-117, -57, 96}, {-127, -57, 96},
100  {-127, -42, 95}, {-115, -35, 100}, {-110, -29, 102}, {-113, -17, 100}, {-122, -16, 100},
101  {-127, -26, 106}, {-121, -19, 104}, {-115, -20, 104}, {-113, -29, 106}, {-117, -32, 103},
102  {-127, -37, 103}, {-94, -40, 71}, {-106, -31, 91}, {-104, -40, 91}, {-97, -32, 71},
103  {-127, -112, 88}, {-121, -111, 88}, {-115, -105, 91}, {-115, -95, 93}, {-127, -100, 84},
104  {-115, -96, 85}, {-115, -104, 82}, {-121, -109, 81}, {-127, -110, 81}, {-105, 28, 100},
105  {-103, 20, 99}, {-84, 55, 97}, {-92, 54, 99}, {-73, 51, 99}, {-55, 45, 89},
106  {-52, 37, 88}, {-53, 25, 87}, {-66, 13, 92}, {-79, 8, 95}, {-98, 14, 100},
107  {-104, 38, 100}, {-100, 48, 100}, {-97, 46, 97}, {-102, 38, 97}, {-96, 16, 97},
108  {-79, 11, 93}, {-68, 15, 90}, {-57, 27, 86}, {-56, 36, 86}, {-59, 43, 87},
109  {-74, 50, 96}, {-91, 51, 98}, {-84, 52, 96}, {-101, 22, 96}, {-102, 29, 96},
110  {-113, 59, 78}, {-102, 85, 79}, {-84, 88, 76}, {-65, 71, 71}, {-40, 58, 63},
111  {-25, 52, 59}, {-28, 21, 48}, {-50, 0, 53}, {-71, -12, 60}, {-127, 115, 37},
112  {-127, 126, -10}, {-127, -25, -86}, {-127, -59, 24}, {-127, -125, 59}, {-127, -103, 44},
113  {-127, -73, 41}, {-127, -62, 36}, {-18, 30, 7}, {-17, 41, -6}, {-28, 34, -56},
114  {-68, 56, -90}, {-33, -6, 9}, {-51, -16, -21}, {-45, -1, -55}, {-84, 7, -85},
115  {-97, -45, 52}, {-104, -53, 33}, {-90, -91, 49}, {-95, -64, 50}, {-85, -117, 51},
116  {-109, -97, 47}, {-111, -69, 46}, {-106, -121, 56}, {-99, -36, 55}, {-100, -29, 60},
117  {-101, -22, 64}, {-100, -50, 21}, {-89, -40, -34}, {-83, -19, -69}, {-69, 111, -49},
118  {-69, 119, -9}, {-69, 109, 30}, {-68, 67, 55}, {-34, 52, 43}, {-46, 58, 36},
119  {-45, 90, 7}, {-25, 72, 16}, {-25, 79, -15}, {-45, 96, -25}, {-45, 87, -57},
120  {-25, 69, -46}, {-48, 42, -75}, {-65, 3, -70}, {-22, 42, -26}, {-75, -22, 19},
121  {-72, -25, -27}, {-13, 52, -30}, {-28, -18, -16}, {6, -13, -42}, {37, 7, -55},
122  {46, 41, -54}, {31, 65, -54}, {4, 61, -40}, {3, 53, -37}, {25, 56, -50},
123  {35, 37, -52}, {28, 10, -52}, {5, -5, -39}, {-21, -9, -17}, {-9, 46, -28},
124  {-6, 39, -37}, {-14, -3, -27}, {6, 0, -47}, {25, 12, -57}, {31, 32, -57},
125  {23, 46, -56}, {4, 44, -46}, {-19, 37, -27}, {-20, 22, -35}, {-30, 12, -35},
126  {-22, 11, -35}, {-19, 2, -35}, {-23, -2, -35}, {-34, 0, -9}, {-35, -3, -22},
127  {-35, 5, -24}, {-25, 26, -27}, {-13, 31, -34}, {-13, 30, -41}, {-23, -2, -41},
128  {-18, 2, -41}, {-21, 10, -41}, {-29, 12, -41}, {-19, 22, -41}, {6, 42, -53},
129  {25, 44, -62}, {34, 31, -63}, {28, 11, -62}, {7, 0, -54}, {-14, -2, -34},
130  {-5, 37, -44}, {-13, 14, -42}, {-7, 8, -43}, {1, 16, -47}, {-4, 22, -45},
131  {3, 30, -48}, {8, 24, -49}, {15, 27, -50}, {12, 35, -50}, {4, 56, -62},
132  {33, 60, -70}, {48, 38, -64}, {41, 7, -68}, {6, -11, -63}, {-26, -16, -42},
133  {-17, 49, -49},
134 };
135 
136 static signed char monkeyf[250][4] = {
137  {27, 4, 5, 26}, {25, 4, 5, 24}, {3, 6, 5, 4},
138  {1, 6, 5, 2}, {5, 6, 7, 4}, {3, 6, 7, 2},
139  {5, 8, 7, 6}, {3, 8, 7, 4}, {7, 8, 9, 6},
140  {5, 8, 9, 4}, {7, 10, 9, 8}, {5, 10, 9, 6},
141  {9, 10, 11, 8}, {7, 10, 11, 6}, {9, 12, 11, 10},
142  {7, 12, 11, 8}, {11, 6, 13, 12}, {5, 4, 13, 12},
143  {3, -2, 13, 12}, {-3, -4, 13, 12}, {-5, -10, 13, 12},
144  {-11, -12, 14, 12}, {-13, -18, 14, 13}, {-19, 4, 5, 13},
145  {10, 12, 4, 4}, {10, 11, 9, 9}, {8, 7, 9, 9},
146  {7, 5, 6, 6}, {6, 3, 4, 4}, {5, 1, 2, 2},
147  {4, -1, 0, 0}, {3, -3, -2, -2}, {22, 67, 68, 23},
148  {20, 65, 66, 21}, {18, 63, 64, 19}, {16, 61, 62, 17},
149  {14, 59, 60, 15}, {12, 19, 48, 57}, {18, 19, 48, 47},
150  {18, 19, 48, 47}, {18, 19, 48, 47}, {18, 19, 48, 47},
151  {18, 19, 48, 47}, {18, 19, 48, 47}, {18, 19, 48, 47},
152  {18, 19, 48, 47}, {18, -9, -8, 47}, {18, 27, 45, 46},
153  {26, 55, 43, 44}, {24, 41, 42, 54}, {22, 39, 40, 23},
154  {20, 37, 38, 21}, {18, 35, 36, 19}, {16, 33, 34, 17},
155  {14, 31, 32, 15}, {12, 39, 30, 13}, {11, 48, 45, 38},
156  {8, 36, -19, 9}, {8, -20, 44, 47}, {42, 45, 46, 43},
157  {18, 19, 40, 39}, {16, 17, 38, 37}, {14, 15, 36, 35},
158  {32, 44, 43, 33}, {12, 33, 32, 42}, {19, 44, 43, 42},
159  {40, 41, 42, -27}, {8, 9, 39, -28}, {15, 43, 42, 16},
160  {13, 43, 42, 14}, {11, 43, 42, 12}, {9, -30, 42, 10},
161  {37, 12, 38, -32}, {-33, 37, 45, 46}, {-33, 40, 41, 39},
162  {38, 40, 41, 37}, {36, 40, 41, 35}, {34, 40, 41, 33},
163  {36, 39, 38, 37}, {35, 40, 39, 38}, {1, 2, 14, 21},
164  {1, 2, 40, 13}, {1, 2, 40, 39}, {1, 24, 12, 39},
165  {-34, 36, 38, 11}, {35, 38, 36, 37}, {-37, 8, 35, 37},
166  {-11, -12, -45, 40}, {-11, -12, 39, 38}, {-11, -12, 37, 36},
167  {-11, -12, 35, 34}, {33, 34, 40, 41}, {33, 34, 38, 39},
168  {33, 34, 36, 37}, {33, -52, 34, 35}, {33, 37, 36, 34},
169  {33, 35, 34, 34}, {8, 7, 37, 36}, {-32, 7, 35, 46},
170  {-34, -33, 45, 46}, {4, -33, 43, 34}, {-34, -33, 41, 42},
171  {-34, -33, 39, 40}, {-34, -33, 37, 38}, {-34, -33, 35, 36},
172  {-34, -33, 33, 34}, {-34, -33, 31, 32}, {-34, -4, 28, 30},
173  {-5, -34, 28, 27}, {-35, -44, 36, 27}, {26, 35, 36, 45},
174  {24, 25, 44, 45}, {25, 23, 44, 42}, {25, 24, 41, 40},
175  {25, 24, 39, 38}, {25, 24, 37, 36}, {25, 24, 35, 34},
176  {25, 24, 33, 32}, {25, 24, 31, 30}, {15, 24, 29, 38},
177  {25, 24, 27, 26}, {23, 12, 37, 26}, {11, 12, 35, 36},
178  {-86, -59, 36, -80}, {-60, -61, 36, 35}, {-62, -63, 36, 35},
179  {-64, -65, 36, 35}, {-66, -67, 36, 35}, {-68, -69, 36, 35},
180  {-70, -71, 36, 35}, {-72, -73, 36, 35}, {-74, -75, 36, 35},
181  {42, 43, 53, 58}, {40, 41, 57, 56}, {38, 39, 55, 57},
182  {-81, -80, 37, 56}, {-83, -82, 55, 52}, {-85, -84, 51, 49},
183  {-87, -86, 48, 49}, {47, 50, 51, 48}, {46, 48, 51, 49},
184  {43, 46, 49, 44}, {-92, -91, 45, 42}, {-23, 49, 50, -20},
185  {-94, 40, 48, -24}, {-96, -22, 48, 49}, {-97, 48, 21, -90},
186  {-100, 36, 50, 23}, {22, 49, 48, -100}, {-101, 47, 46, 22},
187  {21, 45, 35, 25}, {33, 34, 44, 41}, {13, 14, 28, 24},
188  {-107, 26, 30, -106}, {14, 46, 45, 15}, {14, 44, 43, -110},
189  {-111, 42, 23, -110}, {6, 7, 45, 46}, {45, 44, 47, 46},
190  {45, 46, 47, 48}, {47, 46, 49, 48}, {17, 49, 47, 48},
191  {17, 36, 46, 48}, {35, 36, 44, 45}, {35, 36, 40, 43},
192  {35, 36, 38, 39}, {-4, -3, 37, 35}, {-123, 34, 33, 1},
193  {-9, -8, -7, -6}, {-10, -7, 32, -125}, {-127, -11, -126, -126},
194  {-7, -6, 5, 31}, {4, 5, 33, 30}, {4, 39, 33, 32},
195  {4, 35, 32, 38}, {20, 21, 39, 38}, {4, 37, 38, 5},
196  {-11, -10, 36, 3}, {-11, 15, 14, 35}, {13, 16, 34, 34},
197  {-13, 14, 13, 13}, {-3, 1, 30, 29}, {-3, 28, 29, 1},
198  {-2, 31, 28, -1}, {12, 13, 27, 30}, {-2, 26, 12, 12},
199  {35, 29, 42, 36}, {34, 35, 36, 33}, {32, 35, 36, 31},
200  {30, 35, 36, 29}, {28, 35, 36, 27}, {26, 35, 36, 25},
201  {34, 39, 38, 35}, {32, 39, 38, 33}, {30, 39, 38, 31},
202  {28, 39, 38, 29}, {26, 39, 38, 27}, {25, 31, 32, 38},
203  {-18, -17, 45, 44}, {-18, 17, 28, 44}, {-24, -20, 42, -23},
204  {11, 35, 27, 14}, {25, 28, 39, 41}, {37, 41, 40, 38},
205  {34, 40, 36, 35}, {32, 40, 39, 33}, {30, 39, 31, 40},
206  {21, 29, 39, 22}, {-31, 37, 28, 4}, {-32, 33, 35, 36},
207  {32, 33, 34, 34}, {18, 35, 36, 48}, {34, 25, 40, 35},
208  {24, 25, 38, 39}, {24, 25, 36, 37}, {24, 25, 34, 35},
209  {24, 25, 32, 33}, {24, 13, 41, 31}, {17, 11, 41, 35},
210  {15, 16, 34, 35}, {13, 14, 34, 35}, {11, 12, 34, 35},
211  {9, 10, 34, 35}, {7, 8, 34, 35}, {26, 25, 37, 36},
212  {35, 36, 37, 38}, {37, 36, 39, 38}, {37, 38, 39, 40},
213  {25, 31, 36, 39}, {18, 34, 35, 30}, {17, 22, 30, 33},
214  {19, 29, 21, 20}, {16, 26, 29, 17}, {24, 29, 28, 25},
215  {22, 31, 28, 23}, {20, 31, 30, 21}, {18, 31, 30, 19},
216  {16, 30, 17, 17}, {-21, -22, 35, 34}, {-21, -22, 33, 32},
217  {-21, -22, 31, 30}, {-21, -22, 29, 28}, {-21, -22, 27, 26},
218  {-28, -22, 25, 31}, {24, 28, 29, 30}, {23, 24, 26, 27},
219  {23, 24, 25, 25}, {-69, -35, -32, 27}, {-70, 26, 25, -66},
220  {-68, -67, 24, -33},
221 };
222 
223 static const float monkeyuvs[] = {
224  0.890955f, 0.590063f, 0.870622f, 0.589649f, 0.860081f, 0.560115f, 0.904571f, 0.559404f,
225  0.856226f, 0.850547f, 0.868067f, 0.821510f, 0.888398f, 0.821999f, 0.900640f, 0.853232f,
226  0.904571f, 0.559404f, 0.860081f, 0.560115f, 0.853018f, 0.521562f, 0.920166f, 0.524546f,
227  0.847458f, 0.888748f, 0.856226f, 0.850547f, 0.900640f, 0.853232f, 0.914672f, 0.888748f,
228  0.860081f, 0.560115f, 0.828900f, 0.590771f, 0.798481f, 0.569535f, 0.853018f, 0.521562f,
229  0.795104f, 0.838402f, 0.826436f, 0.818537f, 0.856226f, 0.850547f, 0.847458f, 0.888748f,
230  0.870622f, 0.589649f, 0.854402f, 0.604754f, 0.828900f, 0.590771f, 0.860081f, 0.560115f,
231  0.826436f, 0.818537f, 0.852534f, 0.805700f, 0.868067f, 0.821510f, 0.856226f, 0.850547f,
232  0.854402f, 0.604754f, 0.854107f, 0.625459f, 0.828171f, 0.633354f, 0.828900f, 0.590771f,
233  0.827598f, 0.775964f, 0.853157f, 0.785002f, 0.852534f, 0.805700f, 0.826436f, 0.818537f,
234  0.828900f, 0.590771f, 0.828171f, 0.633354f, 0.791018f, 0.645443f, 0.798481f, 0.569535f,
235  0.791018f, 0.762238f, 0.827598f, 0.775964f, 0.826436f, 0.818537f, 0.795104f, 0.838402f,
236  0.828171f, 0.633354f, 0.855181f, 0.668527f, 0.842358f, 0.702491f, 0.791018f, 0.645443f,
237  0.844839f, 0.707525f, 0.856142f, 0.742025f, 0.827598f, 0.775964f, 0.791018f, 0.762238f,
238  0.854107f, 0.625459f, 0.867508f, 0.642291f, 0.855181f, 0.668527f, 0.828171f, 0.633354f,
239  0.856142f, 0.742025f, 0.867293f, 0.768782f, 0.853157f, 0.785002f, 0.827598f, 0.775964f,
240  0.867508f, 0.642291f, 0.890474f, 0.641909f, 0.900375f, 0.666964f, 0.855181f, 0.668527f,
241  0.901223f, 0.745592f, 0.890219f, 0.770183f, 0.867293f, 0.768782f, 0.856142f, 0.742025f,
242  0.855181f, 0.668527f, 0.900375f, 0.666964f, 0.918898f, 0.699697f, 0.842358f, 0.702491f,
243  0.921180f, 0.713713f, 0.901223f, 0.745592f, 0.856142f, 0.742025f, 0.844839f, 0.707525f,
244  0.900375f, 0.666964f, 0.931889f, 0.636832f, 0.968392f, 0.645333f, 0.918898f, 0.699697f,
245  0.968213f, 0.770220f, 0.931368f, 0.777093f, 0.901223f, 0.745592f, 0.921180f, 0.713713f,
246  0.890474f, 0.641909f, 0.905882f, 0.627902f, 0.931889f, 0.636832f, 0.900375f, 0.666964f,
247  0.931368f, 0.777093f, 0.904990f, 0.784860f, 0.890219f, 0.770183f, 0.901223f, 0.745592f,
248  0.905882f, 0.627902f, 0.906232f, 0.605742f, 0.933717f, 0.593037f, 0.931889f, 0.636832f,
249  0.931250f, 0.820926f, 0.904357f, 0.807013f, 0.904990f, 0.784860f, 0.931368f, 0.777093f,
250  0.931889f, 0.636832f, 0.933717f, 0.593037f, 0.968392f, 0.573812f, 0.968392f, 0.645333f,
251  0.965038f, 0.841671f, 0.931250f, 0.820926f, 0.931368f, 0.777093f, 0.968213f, 0.770220f,
252  0.933717f, 0.593037f, 0.904571f, 0.559404f, 0.920166f, 0.524546f, 0.968392f, 0.573812f,
253  0.914672f, 0.888748f, 0.900640f, 0.853232f, 0.931250f, 0.820926f, 0.965038f, 0.841671f,
254  0.906232f, 0.605742f, 0.890955f, 0.590063f, 0.904571f, 0.559404f, 0.933717f, 0.593037f,
255  0.900640f, 0.853232f, 0.888398f, 0.821999f, 0.904357f, 0.807013f, 0.931250f, 0.820926f,
256  0.890955f, 0.590063f, 0.906232f, 0.605742f, 0.902359f, 0.607909f, 0.889591f, 0.593275f,
257  0.900583f, 0.804677f, 0.904357f, 0.807013f, 0.888398f, 0.821999f, 0.887178f, 0.818729f,
258  0.906232f, 0.605742f, 0.905882f, 0.627902f, 0.899781f, 0.626257f, 0.902359f, 0.607909f,
259  0.898822f, 0.786233f, 0.904990f, 0.784860f, 0.904357f, 0.807013f, 0.900583f, 0.804677f,
260  0.905882f, 0.627902f, 0.890474f, 0.641909f, 0.887842f, 0.636527f, 0.899781f, 0.626257f,
261  0.887351f, 0.775442f, 0.890219f, 0.770183f, 0.904990f, 0.784860f, 0.898822f, 0.786233f,
262  0.890474f, 0.641909f, 0.867508f, 0.642291f, 0.870908f, 0.635245f, 0.887842f, 0.636527f,
263  0.870376f, 0.775972f, 0.867293f, 0.768782f, 0.890219f, 0.770183f, 0.887351f, 0.775442f,
264  0.867508f, 0.642291f, 0.854107f, 0.625459f, 0.859881f, 0.623942f, 0.870908f, 0.635245f,
265  0.858859f, 0.786774f, 0.853157f, 0.785002f, 0.867293f, 0.768782f, 0.870376f, 0.775972f,
266  0.854107f, 0.625459f, 0.854402f, 0.604754f, 0.859664f, 0.608186f, 0.859881f, 0.623942f,
267  0.857942f, 0.802505f, 0.852534f, 0.805700f, 0.853157f, 0.785002f, 0.858859f, 0.786774f,
268  0.854402f, 0.604754f, 0.870622f, 0.589649f, 0.871664f, 0.593961f, 0.859664f, 0.608186f,
269  0.869299f, 0.817249f, 0.868067f, 0.821510f, 0.852534f, 0.805700f, 0.857942f, 0.802505f,
270  0.870622f, 0.589649f, 0.890955f, 0.590063f, 0.889591f, 0.593275f, 0.871664f, 0.593961f,
271  0.887178f, 0.818729f, 0.888398f, 0.821999f, 0.868067f, 0.821510f, 0.869299f, 0.817249f,
272  0.879400f, 0.616512f, 0.871664f, 0.593961f, 0.889591f, 0.593275f, 0.887178f, 0.818729f,
273  0.869299f, 0.817249f, 0.878029f, 0.795063f, 0.859664f, 0.608186f, 0.871664f, 0.593961f,
274  0.879400f, 0.616512f, 0.878029f, 0.795063f, 0.869299f, 0.817249f, 0.857942f, 0.802505f,
275  0.879400f, 0.616512f, 0.859881f, 0.623942f, 0.859664f, 0.608186f, 0.857942f, 0.802505f,
276  0.858859f, 0.786774f, 0.878029f, 0.795063f, 0.879400f, 0.616512f, 0.870908f, 0.635245f,
277  0.859881f, 0.623942f, 0.858859f, 0.786774f, 0.870376f, 0.775972f, 0.878029f, 0.795063f,
278  0.879400f, 0.616512f, 0.887842f, 0.636527f, 0.870908f, 0.635245f, 0.870376f, 0.775972f,
279  0.887351f, 0.775442f, 0.878029f, 0.795063f, 0.879400f, 0.616512f, 0.899781f, 0.626257f,
280  0.887842f, 0.636527f, 0.887351f, 0.775442f, 0.898822f, 0.786233f, 0.878029f, 0.795063f,
281  0.879400f, 0.616512f, 0.902359f, 0.607909f, 0.899781f, 0.626257f, 0.898822f, 0.786233f,
282  0.900583f, 0.804677f, 0.878029f, 0.795063f, 0.879400f, 0.616512f, 0.889591f, 0.593275f,
283  0.902359f, 0.607909f, 0.900583f, 0.804677f, 0.887178f, 0.818729f, 0.878029f, 0.795063f,
284  0.540260f, 0.053805f, 0.536419f, 0.062072f, 0.518925f, 0.059681f, 0.518916f, 0.050294f,
285  0.518925f, 0.059681f, 0.501452f, 0.062043f, 0.497626f, 0.053770f, 0.518916f, 0.050294f,
286  0.551930f, 0.058338f, 0.542788f, 0.064089f, 0.536419f, 0.062072f, 0.540260f, 0.053805f,
287  0.501452f, 0.062043f, 0.495083f, 0.064047f, 0.485955f, 0.058273f, 0.497626f, 0.053770f,
288  0.555073f, 0.061900f, 0.546290f, 0.072669f, 0.542788f, 0.064089f, 0.551930f, 0.058338f,
289  0.495083f, 0.064047f, 0.491565f, 0.072625f, 0.482805f, 0.061829f, 0.485955f, 0.058273f,
290  0.563812f, 0.076586f, 0.548333f, 0.084893f, 0.546290f, 0.072669f, 0.555073f, 0.061900f,
291  0.491565f, 0.072625f, 0.489507f, 0.084858f, 0.474014f, 0.076511f, 0.482805f, 0.061829f,
292  0.583135f, 0.108495f, 0.555621f, 0.121749f, 0.548333f, 0.084893f, 0.563812f, 0.076586f,
293  0.489507f, 0.084858f, 0.482177f, 0.121781f, 0.454527f, 0.108481f, 0.474014f, 0.076511f,
294  0.605512f, 0.165134f, 0.647395f, 0.200502f, 0.621513f, 0.227818f, 0.553118f, 0.209599f,
295  0.416514f, 0.229490f, 0.389677f, 0.201890f, 0.432024f, 0.165644f, 0.485339f, 0.210053f,
296  0.647395f, 0.200502f, 0.676379f, 0.233241f, 0.664761f, 0.253225f, 0.621513f, 0.227818f,
297  0.372747f, 0.256357f, 0.360308f, 0.235899f, 0.389677f, 0.201890f, 0.416514f, 0.229490f,
298  0.676379f, 0.233241f, 0.715342f, 0.265392f, 0.683908f, 0.279995f, 0.664761f, 0.253225f,
299  0.353696f, 0.284606f, 0.320452f, 0.270303f, 0.360308f, 0.235899f, 0.372747f, 0.256357f,
300  0.715342f, 0.265392f, 0.707254f, 0.310054f, 0.687515f, 0.311539f, 0.683908f, 0.279995f,
301  0.351187f, 0.317440f, 0.330721f, 0.316853f, 0.320452f, 0.270303f, 0.353696f, 0.284606f,
302  0.707254f, 0.310054f, 0.697446f, 0.332673f, 0.676824f, 0.323937f, 0.687515f, 0.311539f,
303  0.362723f, 0.329722f, 0.341964f, 0.339667f, 0.330721f, 0.316853f, 0.351187f, 0.317440f,
304  0.697446f, 0.332673f, 0.662817f, 0.372521f, 0.639050f, 0.357330f, 0.676824f, 0.323937f,
305  0.402772f, 0.362131f, 0.379297f, 0.378686f, 0.341964f, 0.339667f, 0.362723f, 0.329722f,
306  0.662817f, 0.372521f, 0.626842f, 0.395792f, 0.618316f, 0.375151f, 0.639050f, 0.357330f,
307  0.424583f, 0.379267f, 0.416915f, 0.400552f, 0.379297f, 0.378686f, 0.402772f, 0.362131f,
308  0.626842f, 0.395792f, 0.604826f, 0.397804f, 0.600808f, 0.377857f, 0.618316f, 0.375151f,
309  0.442396f, 0.381222f, 0.439252f, 0.401540f, 0.416915f, 0.400552f, 0.424583f, 0.379267f,
310  0.604826f, 0.397804f, 0.553095f, 0.390512f, 0.559674f, 0.357011f, 0.600808f, 0.377857f,
311  0.482938f, 0.358497f, 0.490934f, 0.391862f, 0.439252f, 0.401540f, 0.442396f, 0.381222f,
312  0.553095f, 0.390512f, 0.521923f, 0.386009f, 0.521086f, 0.343868f, 0.559674f, 0.357011f,
313  0.521086f, 0.343868f, 0.521923f, 0.386009f, 0.490934f, 0.391862f, 0.482938f, 0.358497f,
314  0.577279f, 0.340156f, 0.599845f, 0.344815f, 0.600808f, 0.377857f, 0.559674f, 0.357011f,
315  0.442396f, 0.381222f, 0.441977f, 0.347815f, 0.464579f, 0.342230f, 0.482938f, 0.358497f,
316  0.599845f, 0.344815f, 0.615546f, 0.342005f, 0.618316f, 0.375151f, 0.600808f, 0.377857f,
317  0.424583f, 0.379267f, 0.425972f, 0.345582f, 0.441977f, 0.347815f, 0.442396f, 0.381222f,
318  0.634472f, 0.332311f, 0.639050f, 0.357330f, 0.618316f, 0.375151f, 0.615546f, 0.342005f,
319  0.424583f, 0.379267f, 0.402772f, 0.362131f, 0.406362f, 0.336480f, 0.425972f, 0.345582f,
320  0.662406f, 0.312804f, 0.676824f, 0.323937f, 0.639050f, 0.357330f, 0.634472f, 0.332311f,
321  0.402772f, 0.362131f, 0.362723f, 0.329722f, 0.377061f, 0.317685f, 0.406362f, 0.336480f,
322  0.668440f, 0.297958f, 0.687515f, 0.311539f, 0.676824f, 0.323937f, 0.662406f, 0.312804f,
323  0.362723f, 0.329722f, 0.351187f, 0.317440f, 0.370304f, 0.302644f, 0.377061f, 0.317685f,
324  0.664101f, 0.277872f, 0.683908f, 0.279995f, 0.687515f, 0.311539f, 0.668440f, 0.297958f,
325  0.351187f, 0.317440f, 0.353696f, 0.284606f, 0.374100f, 0.281778f, 0.370304f, 0.302644f,
326  0.639236f, 0.253047f, 0.664761f, 0.253225f, 0.683908f, 0.279995f, 0.664101f, 0.277872f,
327  0.353696f, 0.284606f, 0.372747f, 0.256357f, 0.398938f, 0.255633f, 0.374100f, 0.281778f,
328  0.613992f, 0.242662f, 0.621513f, 0.227818f, 0.664761f, 0.253225f, 0.639236f, 0.253047f,
329  0.372747f, 0.256357f, 0.416514f, 0.229490f, 0.424464f, 0.244473f, 0.398938f, 0.255633f,
330  0.572941f, 0.258564f, 0.553118f, 0.209599f, 0.621513f, 0.227818f, 0.613992f, 0.242662f,
331  0.416514f, 0.229490f, 0.485339f, 0.210053f, 0.466409f, 0.259709f, 0.424464f, 0.244473f,
332  0.572941f, 0.258564f, 0.563905f, 0.272007f, 0.519760f, 0.248864f, 0.553118f, 0.209599f,
333  0.519760f, 0.248864f, 0.475886f, 0.273078f, 0.466409f, 0.259709f, 0.485339f, 0.210053f,
334  0.577279f, 0.340156f, 0.559674f, 0.357011f, 0.521086f, 0.343868f, 0.558527f, 0.316594f,
335  0.521086f, 0.343868f, 0.482938f, 0.358497f, 0.464579f, 0.342230f, 0.482619f, 0.317843f,
336  0.558527f, 0.316594f, 0.521086f, 0.343868f, 0.520277f, 0.294764f, 0.556923f, 0.291214f,
337  0.520277f, 0.294764f, 0.521086f, 0.343868f, 0.482619f, 0.317843f, 0.483433f, 0.292249f,
338  0.519760f, 0.248864f, 0.563905f, 0.272007f, 0.556923f, 0.291214f, 0.520277f, 0.294764f,
339  0.483433f, 0.292249f, 0.475886f, 0.273078f, 0.519760f, 0.248864f, 0.520277f, 0.294764f,
340  0.525483f, 0.068967f, 0.518928f, 0.067899f, 0.518925f, 0.059681f, 0.536419f, 0.062072f,
341  0.518925f, 0.059681f, 0.518928f, 0.067899f, 0.512375f, 0.068956f, 0.501452f, 0.062043f,
342  0.531231f, 0.073829f, 0.525483f, 0.068967f, 0.536419f, 0.062072f, 0.542788f, 0.064089f,
343  0.501452f, 0.062043f, 0.512375f, 0.068956f, 0.506626f, 0.073811f, 0.495083f, 0.064047f,
344  0.531019f, 0.087431f, 0.531231f, 0.073829f, 0.542788f, 0.064089f, 0.546290f, 0.072669f,
345  0.495083f, 0.064047f, 0.506626f, 0.073811f, 0.506827f, 0.087416f, 0.491565f, 0.072625f,
346  0.555621f, 0.121749f, 0.532042f, 0.127713f, 0.532669f, 0.090920f, 0.548333f, 0.084893f,
347  0.505177f, 0.090908f, 0.505828f, 0.127728f, 0.482177f, 0.121781f, 0.489507f, 0.084858f,
348  0.531019f, 0.087431f, 0.546290f, 0.072669f, 0.548333f, 0.084893f, 0.532669f, 0.090920f,
349  0.489507f, 0.084858f, 0.491565f, 0.072625f, 0.506827f, 0.087416f, 0.505177f, 0.090908f,
350  0.538112f, 0.158382f, 0.518981f, 0.151749f, 0.518941f, 0.128358f, 0.532042f, 0.127713f,
351  0.518941f, 0.128358f, 0.518981f, 0.151749f, 0.499851f, 0.158434f, 0.505828f, 0.127728f,
352  0.532669f, 0.090920f, 0.532042f, 0.127713f, 0.518941f, 0.128358f, 0.518925f, 0.093952f,
353  0.518941f, 0.128358f, 0.505828f, 0.127728f, 0.505177f, 0.090908f, 0.518925f, 0.093952f,
354  0.518927f, 0.085180f, 0.531019f, 0.087431f, 0.532669f, 0.090920f, 0.518925f, 0.093952f,
355  0.505177f, 0.090908f, 0.506827f, 0.087416f, 0.518927f, 0.085180f, 0.518925f, 0.093952f,
356  0.548362f, 0.173560f, 0.537959f, 0.175966f, 0.535214f, 0.166808f, 0.538112f, 0.158382f,
357  0.502799f, 0.166857f, 0.500100f, 0.176033f, 0.489683f, 0.173693f, 0.499851f, 0.158434f,
358  0.544281f, 0.193366f, 0.537248f, 0.187577f, 0.537959f, 0.175966f, 0.548362f, 0.173560f,
359  0.500100f, 0.176033f, 0.500890f, 0.187571f, 0.493996f, 0.193428f, 0.489683f, 0.173693f,
360  0.519841f, 0.200843f, 0.528757f, 0.191785f, 0.537248f, 0.187577f, 0.544281f, 0.193366f,
361  0.500890f, 0.187571f, 0.509219f, 0.191626f, 0.519841f, 0.200843f, 0.493996f, 0.193428f,
362  0.517577f, 0.190607f, 0.519132f, 0.185382f, 0.528757f, 0.191785f, 0.519841f, 0.200843f,
363  0.509219f, 0.191626f, 0.519132f, 0.185382f, 0.517577f, 0.190607f, 0.519841f, 0.200843f,
364  0.518981f, 0.151749f, 0.538112f, 0.158382f, 0.535214f, 0.166808f, 0.518998f, 0.159028f,
365  0.502799f, 0.166857f, 0.499851f, 0.158434f, 0.518981f, 0.151749f, 0.518998f, 0.159028f,
366  0.518998f, 0.159028f, 0.535214f, 0.166808f, 0.531131f, 0.171631f, 0.519016f, 0.165599f,
367  0.506910f, 0.171667f, 0.502799f, 0.166857f, 0.518998f, 0.159028f, 0.519016f, 0.165599f,
368  0.519132f, 0.185382f, 0.519099f, 0.179457f, 0.528222f, 0.186316f, 0.528757f, 0.191785f,
369  0.509787f, 0.186260f, 0.519099f, 0.179457f, 0.519132f, 0.185382f, 0.509219f, 0.191626f,
370  0.528757f, 0.191785f, 0.528222f, 0.186316f, 0.533528f, 0.184215f, 0.537248f, 0.187577f,
371  0.504547f, 0.184206f, 0.509787f, 0.186260f, 0.509219f, 0.191626f, 0.500890f, 0.187571f,
372  0.537248f, 0.187577f, 0.533528f, 0.184215f, 0.533449f, 0.176739f, 0.537959f, 0.175966f,
373  0.504604f, 0.176791f, 0.504547f, 0.184206f, 0.500890f, 0.187571f, 0.500100f, 0.176033f,
374  0.537959f, 0.175966f, 0.533449f, 0.176739f, 0.531131f, 0.171631f, 0.535214f, 0.166808f,
375  0.506910f, 0.171667f, 0.504604f, 0.176791f, 0.500100f, 0.176033f, 0.502799f, 0.166857f,
376  0.519099f, 0.179457f, 0.533449f, 0.176739f, 0.533528f, 0.184215f, 0.528222f, 0.186316f,
377  0.504547f, 0.184206f, 0.504604f, 0.176791f, 0.519099f, 0.179457f, 0.509787f, 0.186260f,
378  0.519099f, 0.179457f, 0.519016f, 0.165599f, 0.531131f, 0.171631f, 0.533449f, 0.176739f,
379  0.506910f, 0.171667f, 0.519016f, 0.165599f, 0.519099f, 0.179457f, 0.504604f, 0.176791f,
380  0.519841f, 0.200843f, 0.544281f, 0.193366f, 0.553118f, 0.209599f, 0.519760f, 0.248864f,
381  0.485339f, 0.210053f, 0.493996f, 0.193428f, 0.519841f, 0.200843f, 0.519760f, 0.248864f,
382  0.544281f, 0.193366f, 0.548362f, 0.173560f, 0.561572f, 0.167779f, 0.553118f, 0.209599f,
383  0.476363f, 0.167996f, 0.489683f, 0.173693f, 0.493996f, 0.193428f, 0.485339f, 0.210053f,
384  0.548362f, 0.173560f, 0.538112f, 0.158382f, 0.559475f, 0.149319f, 0.561572f, 0.167779f,
385  0.478371f, 0.149447f, 0.499851f, 0.158434f, 0.489683f, 0.173693f, 0.476363f, 0.167996f,
386  0.538112f, 0.158382f, 0.532042f, 0.127713f, 0.555621f, 0.121749f, 0.559475f, 0.149319f,
387  0.482177f, 0.121781f, 0.505828f, 0.127728f, 0.499851f, 0.158434f, 0.478371f, 0.149447f,
388  0.583135f, 0.108495f, 0.596138f, 0.133426f, 0.559475f, 0.149319f, 0.555621f, 0.121749f,
389  0.478371f, 0.149447f, 0.441395f, 0.133592f, 0.454527f, 0.108481f, 0.482177f, 0.121781f,
390  0.596138f, 0.133426f, 0.601169f, 0.147885f, 0.561572f, 0.167779f, 0.559475f, 0.149319f,
391  0.476363f, 0.167996f, 0.436337f, 0.148194f, 0.441395f, 0.133592f, 0.478371f, 0.149447f,
392  0.605512f, 0.165134f, 0.553118f, 0.209599f, 0.561572f, 0.167779f, 0.601169f, 0.147885f,
393  0.476363f, 0.167996f, 0.485339f, 0.210053f, 0.432024f, 0.165644f, 0.436337f, 0.148194f,
394  0.531019f, 0.087431f, 0.518927f, 0.085180f, 0.518925f, 0.083865f, 0.528933f, 0.084957f,
395  0.518925f, 0.083865f, 0.518927f, 0.085180f, 0.506827f, 0.087416f, 0.508915f, 0.084945f,
396  0.531231f, 0.073829f, 0.531019f, 0.087431f, 0.528933f, 0.084957f, 0.529036f, 0.075429f,
397  0.508915f, 0.084945f, 0.506827f, 0.087416f, 0.506626f, 0.073811f, 0.508820f, 0.075415f,
398  0.525483f, 0.068967f, 0.531231f, 0.073829f, 0.529036f, 0.075429f, 0.523751f, 0.070508f,
399  0.508820f, 0.075415f, 0.506626f, 0.073811f, 0.512375f, 0.068956f, 0.514106f, 0.070501f,
400  0.518928f, 0.067899f, 0.525483f, 0.068967f, 0.523751f, 0.070508f, 0.518929f, 0.069468f,
401  0.514106f, 0.070501f, 0.512375f, 0.068956f, 0.518928f, 0.067899f, 0.518929f, 0.069468f,
402  0.518929f, 0.069468f, 0.523751f, 0.070508f, 0.521560f, 0.074970f, 0.518928f, 0.074259f,
403  0.516297f, 0.074966f, 0.514106f, 0.070501f, 0.518929f, 0.069468f, 0.518928f, 0.074259f,
404  0.523751f, 0.070508f, 0.529036f, 0.075429f, 0.524236f, 0.076691f, 0.521560f, 0.074970f,
405  0.513619f, 0.076684f, 0.508820f, 0.075415f, 0.514106f, 0.070501f, 0.516297f, 0.074966f,
406  0.529036f, 0.075429f, 0.528933f, 0.084957f, 0.524601f, 0.079886f, 0.524236f, 0.076691f,
407  0.513252f, 0.079879f, 0.508915f, 0.084945f, 0.508820f, 0.075415f, 0.513619f, 0.076684f,
408  0.528933f, 0.084957f, 0.518925f, 0.083865f, 0.518926f, 0.079331f, 0.524601f, 0.079886f,
409  0.518926f, 0.079331f, 0.518925f, 0.083865f, 0.508915f, 0.084945f, 0.513252f, 0.079879f,
410  0.518926f, 0.079331f, 0.518928f, 0.074259f, 0.521560f, 0.074970f, 0.524601f, 0.079886f,
411  0.516297f, 0.074966f, 0.518928f, 0.074259f, 0.518926f, 0.079331f, 0.513252f, 0.079879f,
412  0.524601f, 0.079886f, 0.521560f, 0.074970f, 0.524236f, 0.076691f, 0.513619f, 0.076684f,
413  0.516297f, 0.074966f, 0.513252f, 0.079879f, 0.556923f, 0.291214f, 0.563905f, 0.272007f,
414  0.571787f, 0.277295f, 0.568351f, 0.292904f, 0.468070f, 0.278617f, 0.475886f, 0.273078f,
415  0.483433f, 0.292249f, 0.471978f, 0.294282f, 0.558527f, 0.316594f, 0.556923f, 0.291214f,
416  0.568351f, 0.292904f, 0.573085f, 0.311386f, 0.471978f, 0.294282f, 0.483433f, 0.292249f,
417  0.482619f, 0.317843f, 0.467790f, 0.313081f, 0.577279f, 0.340156f, 0.558527f, 0.316594f,
418  0.573085f, 0.311386f, 0.584855f, 0.327708f, 0.467790f, 0.313081f, 0.482619f, 0.317843f,
419  0.464579f, 0.342230f, 0.456477f, 0.329961f, 0.563905f, 0.272007f, 0.572941f, 0.258564f,
420  0.580734f, 0.266620f, 0.571787f, 0.277295f, 0.458737f, 0.268049f, 0.466409f, 0.259709f,
421  0.475886f, 0.273078f, 0.468070f, 0.278617f, 0.572941f, 0.258564f, 0.613992f, 0.242662f,
422  0.611720f, 0.255725f, 0.580734f, 0.266620f, 0.427062f, 0.257728f, 0.424464f, 0.244473f,
423  0.466409f, 0.259709f, 0.458737f, 0.268049f, 0.613992f, 0.242662f, 0.639236f, 0.253047f,
424  0.632494f, 0.262853f, 0.611720f, 0.255725f, 0.406068f, 0.265508f, 0.398938f, 0.255633f,
425  0.424464f, 0.244473f, 0.427062f, 0.257728f, 0.639236f, 0.253047f, 0.664101f, 0.277872f,
426  0.653658f, 0.279971f, 0.632494f, 0.262853f, 0.384904f, 0.283634f, 0.374100f, 0.281778f,
427  0.398938f, 0.255633f, 0.406068f, 0.265508f, 0.664101f, 0.277872f, 0.668440f, 0.297958f,
428  0.656064f, 0.297636f, 0.653658f, 0.279971f, 0.383015f, 0.301864f, 0.370304f, 0.302644f,
429  0.374100f, 0.281778f, 0.384904f, 0.283634f, 0.668440f, 0.297958f, 0.662406f, 0.312804f,
430  0.652752f, 0.310186f, 0.656064f, 0.297636f, 0.386858f, 0.314615f, 0.377061f, 0.317685f,
431  0.370304f, 0.302644f, 0.383015f, 0.301864f, 0.662406f, 0.312804f, 0.634472f, 0.332311f,
432  0.629040f, 0.323864f, 0.652752f, 0.310186f, 0.411556f, 0.327673f, 0.406362f, 0.336480f,
433  0.377061f, 0.317685f, 0.386858f, 0.314615f, 0.634472f, 0.332311f, 0.615546f, 0.342005f,
434  0.614408f, 0.331972f, 0.629040f, 0.323864f, 0.426727f, 0.335361f, 0.425972f, 0.345582f,
435  0.406362f, 0.336480f, 0.411556f, 0.327673f, 0.615546f, 0.342005f, 0.599845f, 0.344815f,
436  0.601033f, 0.333624f, 0.614408f, 0.331972f, 0.440344f, 0.336537f, 0.441977f, 0.347815f,
437  0.425972f, 0.345582f, 0.426727f, 0.335361f, 0.599845f, 0.344815f, 0.577279f, 0.340156f,
438  0.584855f, 0.327708f, 0.601033f, 0.333624f, 0.456477f, 0.329961f, 0.464579f, 0.342230f,
439  0.441977f, 0.347815f, 0.440344f, 0.336537f, 0.601033f, 0.333624f, 0.584855f, 0.327708f,
440  0.590644f, 0.321516f, 0.601799f, 0.328453f, 0.450408f, 0.323919f, 0.456477f, 0.329961f,
441  0.440344f, 0.336537f, 0.439372f, 0.331331f, 0.614408f, 0.331972f, 0.601033f, 0.333624f,
442  0.601799f, 0.328453f, 0.613335f, 0.327083f, 0.439372f, 0.331331f, 0.440344f, 0.336537f,
443  0.426727f, 0.335361f, 0.427623f, 0.330358f, 0.629040f, 0.323864f, 0.614408f, 0.331972f,
444  0.613335f, 0.327083f, 0.626851f, 0.320513f, 0.427623f, 0.330358f, 0.426727f, 0.335361f,
445  0.411556f, 0.327673f, 0.413648f, 0.324175f, 0.652752f, 0.310186f, 0.629040f, 0.323864f,
446  0.626851f, 0.320513f, 0.646248f, 0.306421f, 0.413648f, 0.324175f, 0.411556f, 0.327673f,
447  0.386858f, 0.314615f, 0.393381f, 0.310510f, 0.656064f, 0.297636f, 0.652752f, 0.310186f,
448  0.646248f, 0.306421f, 0.649541f, 0.296225f, 0.393381f, 0.310510f, 0.386858f, 0.314615f,
449  0.383015f, 0.301864f, 0.389662f, 0.300183f, 0.653658f, 0.279971f, 0.656064f, 0.297636f,
450  0.649541f, 0.296225f, 0.647785f, 0.283486f, 0.389662f, 0.300183f, 0.383015f, 0.301864f,
451  0.384904f, 0.283634f, 0.391040f, 0.287071f, 0.632494f, 0.262853f, 0.653658f, 0.279971f,
452  0.647785f, 0.283486f, 0.629829f, 0.267263f, 0.391040f, 0.287071f, 0.384904f, 0.283634f,
453  0.406068f, 0.265508f, 0.408893f, 0.269959f, 0.611720f, 0.255725f, 0.632494f, 0.262853f,
454  0.629829f, 0.267263f, 0.612641f, 0.261560f, 0.408893f, 0.269959f, 0.406068f, 0.265508f,
455  0.427062f, 0.257728f, 0.426254f, 0.263693f, 0.580734f, 0.266620f, 0.611720f, 0.255725f,
456  0.612641f, 0.261560f, 0.585166f, 0.270991f, 0.426254f, 0.263693f, 0.427062f, 0.257728f,
457  0.458737f, 0.268049f, 0.454369f, 0.272583f, 0.571787f, 0.277295f, 0.580734f, 0.266620f,
458  0.585166f, 0.270991f, 0.578124f, 0.281900f, 0.454369f, 0.272583f, 0.458737f, 0.268049f,
459  0.468070f, 0.278617f, 0.461798f, 0.283441f, 0.584855f, 0.327708f, 0.573085f, 0.311386f,
460  0.579548f, 0.309340f, 0.590644f, 0.321516f, 0.461204f, 0.311233f, 0.467790f, 0.313081f,
461  0.456477f, 0.329961f, 0.450408f, 0.323919f, 0.573085f, 0.311386f, 0.568351f, 0.292904f,
462  0.577524f, 0.293776f, 0.579548f, 0.309340f, 0.462754f, 0.295432f, 0.471978f, 0.294282f,
463  0.467790f, 0.313081f, 0.461204f, 0.311233f, 0.568351f, 0.292904f, 0.571787f, 0.277295f,
464  0.578124f, 0.281900f, 0.577524f, 0.293776f, 0.461798f, 0.283441f, 0.468070f, 0.278617f,
465  0.471978f, 0.294282f, 0.462754f, 0.295432f, 0.521923f, 0.386009f, 0.553095f, 0.390512f,
466  0.553209f, 0.433063f, 0.523031f, 0.433628f, 0.492809f, 0.434538f, 0.490934f, 0.391862f,
467  0.521923f, 0.386009f, 0.523031f, 0.433628f, 0.553095f, 0.390512f, 0.604826f, 0.397804f,
468  0.609819f, 0.431516f, 0.553209f, 0.433063f, 0.435860f, 0.435740f, 0.439252f, 0.401540f,
469  0.490934f, 0.391862f, 0.492809f, 0.434538f, 0.604826f, 0.397804f, 0.626842f, 0.395792f,
470  0.648174f, 0.419316f, 0.609819f, 0.431516f, 0.396518f, 0.425416f, 0.416915f, 0.400552f,
471  0.439252f, 0.401540f, 0.435860f, 0.435740f, 0.626842f, 0.395792f, 0.662817f, 0.372521f,
472  0.692106f, 0.388274f, 0.648174f, 0.419316f, 0.350292f, 0.396229f, 0.379297f, 0.378686f,
473  0.416915f, 0.400552f, 0.396518f, 0.425416f, 0.662817f, 0.372521f, 0.697446f, 0.332673f,
474  0.726332f, 0.341754f, 0.692106f, 0.388274f, 0.312756f, 0.350588f, 0.341964f, 0.339667f,
475  0.379297f, 0.378686f, 0.350292f, 0.396229f, 0.697446f, 0.332673f, 0.707254f, 0.310054f,
476  0.735879f, 0.312112f, 0.726332f, 0.341754f, 0.301067f, 0.320593f, 0.330721f, 0.316853f,
477  0.341964f, 0.339667f, 0.312756f, 0.350588f, 0.707254f, 0.310054f, 0.715342f, 0.265392f,
478  0.729900f, 0.256393f, 0.735879f, 0.312112f, 0.304876f, 0.261087f, 0.320452f, 0.270303f,
479  0.330721f, 0.316853f, 0.301067f, 0.320593f, 0.715342f, 0.265392f, 0.676379f, 0.233241f,
480  0.698172f, 0.216906f, 0.729900f, 0.256393f, 0.337414f, 0.219179f, 0.360308f, 0.235899f,
481  0.320452f, 0.270303f, 0.304876f, 0.261087f, 0.676379f, 0.233241f, 0.647395f, 0.200502f,
482  0.663103f, 0.190671f, 0.698172f, 0.216906f, 0.373474f, 0.191872f, 0.389677f, 0.201890f,
483  0.360308f, 0.235899f, 0.337414f, 0.219179f, 0.626908f, 0.015608f, 0.649444f, 0.022378f,
484  0.660451f, 0.076084f, 0.621440f, 0.048089f, 0.376796f, 0.075296f, 0.388827f, 0.021586f,
485  0.411318f, 0.015131f, 0.416419f, 0.047631f, 0.567460f, 0.000144f, 0.626908f, 0.015608f,
486  0.621440f, 0.048089f, 0.577206f, 0.032801f, 0.416419f, 0.047631f, 0.411318f, 0.015131f,
487  0.470636f, 0.000144f, 0.460782f, 0.032656f, 0.518922f, 0.024886f, 0.567460f, 0.000144f,
488  0.577206f, 0.032801f, 0.547413f, 0.041724f, 0.460782f, 0.032656f, 0.470636f, 0.000144f,
489  0.518922f, 0.024886f, 0.490511f, 0.041669f, 0.540260f, 0.053805f, 0.518916f, 0.050294f,
490  0.518922f, 0.024886f, 0.547413f, 0.041724f, 0.518922f, 0.024886f, 0.518916f, 0.050294f,
491  0.497626f, 0.053770f, 0.490511f, 0.041669f, 0.551930f, 0.058338f, 0.540260f, 0.053805f,
492  0.547413f, 0.041724f, 0.558059f, 0.053871f, 0.490511f, 0.041669f, 0.497626f, 0.053770f,
493  0.485955f, 0.058273f, 0.479842f, 0.053785f, 0.555073f, 0.061900f, 0.551930f, 0.058338f,
494  0.558059f, 0.053871f, 0.576951f, 0.057998f, 0.479842f, 0.053785f, 0.485955f, 0.058273f,
495  0.482805f, 0.061829f, 0.460920f, 0.057845f, 0.563812f, 0.076586f, 0.555073f, 0.061900f,
496  0.576951f, 0.057998f, 0.611687f, 0.078268f, 0.460920f, 0.057845f, 0.482805f, 0.061829f,
497  0.474014f, 0.076511f, 0.425932f, 0.077985f, 0.576951f, 0.057998f, 0.577206f, 0.032801f,
498  0.621440f, 0.048089f, 0.611687f, 0.078268f, 0.416419f, 0.047631f, 0.460782f, 0.032656f,
499  0.460920f, 0.057845f, 0.425932f, 0.077985f, 0.576951f, 0.057998f, 0.558059f, 0.053871f,
500  0.547413f, 0.041724f, 0.577206f, 0.032801f, 0.490511f, 0.041669f, 0.479842f, 0.053785f,
501  0.460920f, 0.057845f, 0.460782f, 0.032656f, 0.626663f, 0.111357f, 0.611687f, 0.078268f,
502  0.621440f, 0.048089f, 0.660451f, 0.076084f, 0.416419f, 0.047631f, 0.425932f, 0.077985f,
503  0.410618f, 0.111244f, 0.376796f, 0.075296f, 0.583135f, 0.108495f, 0.563812f, 0.076586f,
504  0.611687f, 0.078268f, 0.626663f, 0.111357f, 0.425932f, 0.077985f, 0.474014f, 0.076511f,
505  0.454527f, 0.108481f, 0.410618f, 0.111244f, 0.596138f, 0.133426f, 0.629482f, 0.130456f,
506  0.623495f, 0.146796f, 0.601169f, 0.147885f, 0.413741f, 0.147158f, 0.407648f, 0.130594f,
507  0.441395f, 0.133592f, 0.436337f, 0.148194f, 0.583135f, 0.108495f, 0.626663f, 0.111357f,
508  0.629482f, 0.130456f, 0.596138f, 0.133426f, 0.407648f, 0.130594f, 0.410618f, 0.111244f,
509  0.454527f, 0.108481f, 0.441395f, 0.133592f, 0.605512f, 0.165134f, 0.601169f, 0.147885f,
510  0.623495f, 0.146796f, 0.619303f, 0.159841f, 0.413741f, 0.147158f, 0.436337f, 0.148194f,
511  0.432024f, 0.165644f, 0.418035f, 0.160361f, 0.605512f, 0.165134f, 0.619303f, 0.159841f,
512  0.663103f, 0.190671f, 0.647395f, 0.200502f, 0.373474f, 0.191872f, 0.418035f, 0.160361f,
513  0.432024f, 0.165644f, 0.389677f, 0.201890f, 0.945900f, 0.079569f, 0.886245f, 0.121777f,
514  0.849114f, 0.099732f, 0.891780f, 0.036916f, 0.183115f, 0.092127f, 0.141314f, 0.112482f,
515  0.078961f, 0.060719f, 0.142277f, 0.021467f, 0.891780f, 0.036916f, 0.849114f, 0.099732f,
516  0.788458f, 0.080826f, 0.805584f, 0.010786f, 0.246353f, 0.076510f, 0.183115f, 0.092127f,
517  0.142277f, 0.021467f, 0.232648f, 0.003484f, 0.805584f, 0.010786f, 0.788458f, 0.080826f,
518  0.687018f, 0.077204f, 0.672384f, 0.022201f, 0.349875f, 0.075955f, 0.246353f, 0.076510f,
519  0.232648f, 0.003484f, 0.365979f, 0.020991f, 0.672384f, 0.022201f, 0.687018f, 0.077204f,
520  0.660451f, 0.076084f, 0.649444f, 0.022378f, 0.376796f, 0.075296f, 0.349875f, 0.075955f,
521  0.365979f, 0.020991f, 0.388827f, 0.021586f, 0.626663f, 0.111357f, 0.660451f, 0.076084f,
522  0.687018f, 0.077204f, 0.629482f, 0.130456f, 0.349875f, 0.075955f, 0.376796f, 0.075296f,
523  0.410618f, 0.111244f, 0.407648f, 0.130594f, 0.729900f, 0.256393f, 0.698172f, 0.216906f,
524  0.760215f, 0.193244f, 0.789046f, 0.233323f, 0.271553f, 0.193871f, 0.337414f, 0.219179f,
525  0.304876f, 0.261087f, 0.241255f, 0.236977f, 0.994525f, 0.167705f, 0.909112f, 0.183261f,
526  0.886245f, 0.121777f, 0.945900f, 0.079569f, 0.141314f, 0.112482f, 0.107928f, 0.179083f,
527  0.011829f, 0.155367f, 0.078961f, 0.060719f, 0.911671f, 0.402429f, 0.862868f, 0.338556f,
528  0.894128f, 0.301884f, 0.962901f, 0.344752f, 0.123776f, 0.315519f, 0.160557f, 0.356821f,
529  0.106400f, 0.432652f, 0.043968f, 0.367038f, 0.962901f, 0.344752f, 0.894128f, 0.301884f,
530  0.915360f, 0.259804f, 0.999856f, 0.254640f, 0.098965f, 0.266968f, 0.123776f, 0.315519f,
531  0.043968f, 0.367038f, 0.000144f, 0.259113f, 0.999856f, 0.254640f, 0.915360f, 0.259804f,
532  0.909112f, 0.183261f, 0.994525f, 0.167705f, 0.107928f, 0.179083f, 0.098965f, 0.266968f,
533  0.000144f, 0.259113f, 0.011829f, 0.155367f, 0.749542f, 0.334683f, 0.735879f, 0.312112f,
534  0.766337f, 0.300809f, 0.789162f, 0.313727f, 0.267408f, 0.310142f, 0.301067f, 0.320593f,
535  0.288183f, 0.346496f, 0.242992f, 0.325552f, 0.789162f, 0.313727f, 0.766337f, 0.300809f,
536  0.815314f, 0.276388f, 0.846174f, 0.293397f, 0.213065f, 0.285164f, 0.267408f, 0.310142f,
537  0.242992f, 0.325552f, 0.178537f, 0.304983f, 0.846174f, 0.293397f, 0.815314f, 0.276388f,
538  0.845007f, 0.256352f, 0.873517f, 0.265922f, 0.179662f, 0.263312f, 0.213065f, 0.285164f,
539  0.178537f, 0.304983f, 0.147089f, 0.274284f, 0.873517f, 0.265922f, 0.845007f, 0.256352f,
540  0.859075f, 0.228168f, 0.886999f, 0.233769f, 0.162803f, 0.231720f, 0.179662f, 0.263312f,
541  0.147089f, 0.274284f, 0.131514f, 0.237587f, 0.842355f, 0.195160f, 0.875030f, 0.184705f,
542  0.886999f, 0.233769f, 0.859075f, 0.228168f, 0.131514f, 0.237587f, 0.145224f, 0.182749f,
543  0.176788f, 0.196179f, 0.162803f, 0.231720f, 0.909112f, 0.183261f, 0.915360f, 0.259804f,
544  0.886999f, 0.233769f, 0.875030f, 0.184705f, 0.131514f, 0.237587f, 0.098965f, 0.266968f,
545  0.107928f, 0.179083f, 0.145224f, 0.182749f, 0.915360f, 0.259804f, 0.894128f, 0.301884f,
546  0.873517f, 0.265922f, 0.886999f, 0.233769f, 0.147089f, 0.274284f, 0.123776f, 0.315519f,
547  0.098965f, 0.266968f, 0.131514f, 0.237587f, 0.894128f, 0.301884f, 0.862868f, 0.338556f,
548  0.846174f, 0.293397f, 0.873517f, 0.265922f, 0.178537f, 0.304983f, 0.160557f, 0.356821f,
549  0.123776f, 0.315519f, 0.147089f, 0.274284f, 0.862868f, 0.338556f, 0.794286f, 0.364062f,
550  0.789162f, 0.313727f, 0.846174f, 0.293397f, 0.242992f, 0.325552f, 0.239776f, 0.382592f,
551  0.160557f, 0.356821f, 0.178537f, 0.304983f, 0.770185f, 0.379538f, 0.749542f, 0.334683f,
552  0.789162f, 0.313727f, 0.794286f, 0.364062f, 0.242992f, 0.325552f, 0.288183f, 0.346496f,
553  0.268122f, 0.398737f, 0.239776f, 0.382592f, 0.845499f, 0.449967f, 0.794286f, 0.364062f,
554  0.862868f, 0.338556f, 0.911671f, 0.402429f, 0.160557f, 0.356821f, 0.239776f, 0.382592f,
555  0.185281f, 0.484099f, 0.106400f, 0.432652f, 0.815858f, 0.445381f, 0.770572f, 0.444261f,
556  0.755700f, 0.418603f, 0.770185f, 0.379538f, 0.287033f, 0.442912f, 0.271364f, 0.473316f,
557  0.219260f, 0.477186f, 0.268122f, 0.398737f, 0.815858f, 0.445381f, 0.770185f, 0.379538f,
558  0.794286f, 0.364062f, 0.845499f, 0.449967f, 0.239776f, 0.382592f, 0.268122f, 0.398737f,
559  0.219260f, 0.477186f, 0.185281f, 0.484099f, 0.819845f, 0.468071f, 0.815858f, 0.445381f,
560  0.845499f, 0.449967f, 0.185281f, 0.484099f, 0.219260f, 0.477186f, 0.215894f, 0.503605f,
561  0.735879f, 0.312112f, 0.729900f, 0.256393f, 0.789046f, 0.233323f, 0.766337f, 0.300809f,
562  0.241255f, 0.236977f, 0.304876f, 0.261087f, 0.301067f, 0.320593f, 0.267408f, 0.310142f,
563  0.789046f, 0.233323f, 0.809631f, 0.233887f, 0.815314f, 0.276388f, 0.766337f, 0.300809f,
564  0.213065f, 0.285164f, 0.219168f, 0.237388f, 0.241255f, 0.236977f, 0.267408f, 0.310142f,
565  0.809631f, 0.233887f, 0.829287f, 0.219562f, 0.845007f, 0.256352f, 0.815314f, 0.276388f,
566  0.179662f, 0.263312f, 0.199067f, 0.222464f, 0.219168f, 0.237388f, 0.213065f, 0.285164f,
567  0.842355f, 0.195160f, 0.859075f, 0.228168f, 0.845007f, 0.256352f, 0.829287f, 0.219562f,
568  0.179662f, 0.263312f, 0.162803f, 0.231720f, 0.176788f, 0.196179f, 0.199067f, 0.222464f,
569  0.687018f, 0.077204f, 0.788458f, 0.080826f, 0.786480f, 0.117591f, 0.715482f, 0.139727f,
570  0.246666f, 0.114850f, 0.246353f, 0.076510f, 0.349875f, 0.075955f, 0.319538f, 0.139409f,
571  0.760215f, 0.193244f, 0.715482f, 0.139727f, 0.786480f, 0.117591f, 0.785486f, 0.152330f,
572  0.246666f, 0.114850f, 0.319538f, 0.139409f, 0.271553f, 0.193871f, 0.245969f, 0.151002f,
573  0.698172f, 0.216906f, 0.663103f, 0.190671f, 0.715482f, 0.139727f, 0.760215f, 0.193244f,
574  0.319538f, 0.139409f, 0.373474f, 0.191872f, 0.337414f, 0.219179f, 0.271553f, 0.193871f,
575  0.663103f, 0.190671f, 0.623495f, 0.146796f, 0.629482f, 0.130456f, 0.715482f, 0.139727f,
576  0.407648f, 0.130594f, 0.413741f, 0.147158f, 0.373474f, 0.191872f, 0.319538f, 0.139409f,
577  0.629482f, 0.130456f, 0.687018f, 0.077204f, 0.715482f, 0.139727f, 0.319538f, 0.139409f,
578  0.349875f, 0.075955f, 0.407648f, 0.130594f, 0.663103f, 0.190671f, 0.619303f, 0.159841f,
579  0.623495f, 0.146796f, 0.413741f, 0.147158f, 0.418035f, 0.160361f, 0.373474f, 0.191872f,
580  0.842355f, 0.195160f, 0.837382f, 0.156361f, 0.858171f, 0.137775f, 0.875030f, 0.184705f,
581  0.171653f, 0.132294f, 0.196622f, 0.155241f, 0.176788f, 0.196179f, 0.145224f, 0.182749f,
582  0.909112f, 0.183261f, 0.875030f, 0.184705f, 0.858171f, 0.137775f, 0.886245f, 0.121777f,
583  0.171653f, 0.132294f, 0.145224f, 0.182749f, 0.107928f, 0.179083f, 0.141314f, 0.112482f,
584  0.785486f, 0.152330f, 0.786480f, 0.117591f, 0.858171f, 0.137775f, 0.837382f, 0.156361f,
585  0.171653f, 0.132294f, 0.246666f, 0.114850f, 0.245969f, 0.151002f, 0.196622f, 0.155241f,
586  0.788458f, 0.080826f, 0.849114f, 0.099732f, 0.858171f, 0.137775f, 0.786480f, 0.117591f,
587  0.171653f, 0.132294f, 0.183115f, 0.092127f, 0.246353f, 0.076510f, 0.246666f, 0.114850f,
588  0.886245f, 0.121777f, 0.858171f, 0.137775f, 0.849114f, 0.099732f, 0.183115f, 0.092127f,
589  0.171653f, 0.132294f, 0.141314f, 0.112482f, 0.506166f, 0.904851f, 0.432388f, 0.894943f,
590  0.438797f, 0.870229f, 0.491058f, 0.881714f, 0.315867f, 0.868209f, 0.321637f, 0.893225f,
591  0.247207f, 0.901159f, 0.263032f, 0.878321f, 0.506166f, 0.904851f, 0.491058f, 0.881714f,
592  0.572792f, 0.860484f, 0.604825f, 0.879946f, 0.181486f, 0.854693f, 0.263032f, 0.878321f,
593  0.247207f, 0.901159f, 0.148729f, 0.873349f, 0.604825f, 0.879946f, 0.572792f, 0.860484f,
594  0.586396f, 0.793977f, 0.619962f, 0.791615f, 0.169745f, 0.787474f, 0.181486f, 0.854693f,
595  0.148729f, 0.873349f, 0.136063f, 0.784093f, 0.619962f, 0.791615f, 0.586396f, 0.793977f,
596  0.549027f, 0.746412f, 0.563786f, 0.739211f, 0.208656f, 0.740879f, 0.169745f, 0.787474f,
597  0.136063f, 0.784093f, 0.194086f, 0.733241f, 0.563786f, 0.739211f, 0.549027f, 0.746412f,
598  0.500314f, 0.711729f, 0.508270f, 0.697693f, 0.258399f, 0.707497f, 0.208656f, 0.740879f,
599  0.194086f, 0.733241f, 0.250811f, 0.693249f, 0.508270f, 0.697693f, 0.500314f, 0.711729f,
600  0.438641f, 0.680683f, 0.434803f, 0.658882f, 0.320962f, 0.677959f, 0.258399f, 0.707497f,
601  0.250811f, 0.693249f, 0.325318f, 0.656224f, 0.500314f, 0.711729f, 0.505666f, 0.730944f,
602  0.452955f, 0.700023f, 0.438641f, 0.680683f, 0.306136f, 0.696976f, 0.252524f, 0.726592f,
603  0.258399f, 0.707497f, 0.320962f, 0.677959f, 0.549027f, 0.746412f, 0.542850f, 0.755753f,
604  0.505666f, 0.730944f, 0.500314f, 0.711729f, 0.252524f, 0.726592f, 0.214575f, 0.750414f,
605  0.208656f, 0.740879f, 0.258399f, 0.707497f, 0.586396f, 0.793977f, 0.568148f, 0.787367f,
606  0.542850f, 0.755753f, 0.549027f, 0.746412f, 0.214575f, 0.750414f, 0.188269f, 0.781375f,
607  0.169745f, 0.787474f, 0.208656f, 0.740879f, 0.572792f, 0.860484f, 0.555495f, 0.826352f,
608  0.568148f, 0.787367f, 0.586396f, 0.793977f, 0.188269f, 0.781375f, 0.199850f, 0.820889f,
609  0.181486f, 0.854693f, 0.169745f, 0.787474f, 0.491058f, 0.881714f, 0.501231f, 0.844356f,
610  0.555495f, 0.826352f, 0.572792f, 0.860484f, 0.199850f, 0.820889f, 0.253846f, 0.840502f,
611  0.263032f, 0.878321f, 0.181486f, 0.854693f, 0.491058f, 0.881714f, 0.438797f, 0.870229f,
612  0.457832f, 0.840040f, 0.501231f, 0.844356f, 0.297562f, 0.837358f, 0.315867f, 0.868209f,
613  0.263032f, 0.878321f, 0.253846f, 0.840502f, 0.760215f, 0.193244f, 0.785486f, 0.152330f,
614  0.796021f, 0.176969f, 0.783193f, 0.187449f, 0.233625f, 0.175620f, 0.245969f, 0.151002f,
615  0.271553f, 0.193871f, 0.246955f, 0.187075f, 0.391039f, 0.611891f, 0.434803f, 0.658882f,
616  0.438641f, 0.680683f, 0.394766f, 0.686125f, 0.320962f, 0.677959f, 0.325318f, 0.656224f,
617  0.369913f, 0.610196f, 0.364838f, 0.684445f, 0.789046f, 0.233323f, 0.760215f, 0.193244f,
618  0.783193f, 0.187449f, 0.809631f, 0.233887f, 0.246955f, 0.187075f, 0.271553f, 0.193871f,
619  0.241255f, 0.236977f, 0.219168f, 0.237388f, 0.391747f, 0.862097f, 0.401605f, 0.841460f,
620  0.438797f, 0.870229f, 0.432388f, 0.894943f, 0.315867f, 0.868209f, 0.354026f, 0.840297f,
621  0.363377f, 0.861308f, 0.321637f, 0.893225f, 0.438641f, 0.680683f, 0.452955f, 0.700023f,
622  0.435018f, 0.718280f, 0.394766f, 0.686125f, 0.323658f, 0.715731f, 0.306136f, 0.696976f,
623  0.320962f, 0.677959f, 0.364838f, 0.684445f, 0.433669f, 0.729661f, 0.384658f, 0.710299f,
624  0.394766f, 0.686125f, 0.435018f, 0.718280f, 0.364838f, 0.684445f, 0.374400f, 0.708969f,
625  0.324726f, 0.727177f, 0.323658f, 0.715731f, 0.410995f, 0.747662f, 0.384658f, 0.710299f,
626  0.433669f, 0.729661f, 0.427812f, 0.742828f, 0.324726f, 0.727177f, 0.374400f, 0.708969f,
627  0.347028f, 0.745816f, 0.330270f, 0.740536f, 0.418086f, 0.784946f, 0.384657f, 0.795423f,
628  0.384658f, 0.710299f, 0.410995f, 0.747662f, 0.374400f, 0.708969f, 0.372270f, 0.794472f,
629  0.338952f, 0.783073f, 0.347028f, 0.745816f, 0.401605f, 0.841460f, 0.384657f, 0.795423f,
630  0.418086f, 0.784946f, 0.431333f, 0.817535f, 0.338952f, 0.783073f, 0.372270f, 0.794472f,
631  0.354026f, 0.840297f, 0.324790f, 0.815460f, 0.438797f, 0.870229f, 0.401605f, 0.841460f,
632  0.431333f, 0.817535f, 0.457832f, 0.840040f, 0.324790f, 0.815460f, 0.354026f, 0.840297f,
633  0.315867f, 0.868209f, 0.297562f, 0.837358f, 0.809631f, 0.233887f, 0.816266f, 0.203086f,
634  0.825107f, 0.209762f, 0.829287f, 0.219562f, 0.199767f, 0.214827f, 0.209828f, 0.206161f,
635  0.219168f, 0.237388f, 0.199067f, 0.222464f, 0.809631f, 0.233887f, 0.783193f, 0.187449f,
636  0.802192f, 0.184609f, 0.816266f, 0.203086f, 0.226485f, 0.183086f, 0.246955f, 0.187075f,
637  0.219168f, 0.237388f, 0.209828f, 0.206161f, 0.783193f, 0.187449f, 0.796021f, 0.176969f,
638  0.802192f, 0.184609f, 0.226485f, 0.183086f, 0.233625f, 0.175620f, 0.246955f, 0.187075f,
639  0.457832f, 0.840040f, 0.431333f, 0.817535f, 0.448505f, 0.804621f, 0.473386f, 0.824700f,
640  0.307886f, 0.802031f, 0.324790f, 0.815460f, 0.297562f, 0.837358f, 0.282357f, 0.821525f,
641  0.431333f, 0.817535f, 0.418086f, 0.784946f, 0.435868f, 0.779569f, 0.448505f, 0.804621f,
642  0.321237f, 0.777208f, 0.338952f, 0.783073f, 0.324790f, 0.815460f, 0.307886f, 0.802031f,
643  0.418086f, 0.784946f, 0.410995f, 0.747662f, 0.423718f, 0.754191f, 0.435868f, 0.779569f,
644  0.334089f, 0.752045f, 0.347028f, 0.745816f, 0.338952f, 0.783073f, 0.321237f, 0.777208f,
645  0.410995f, 0.747662f, 0.427812f, 0.742828f, 0.437950f, 0.749777f, 0.423718f, 0.754191f,
646  0.319919f, 0.747250f, 0.330270f, 0.740536f, 0.347028f, 0.745816f, 0.334089f, 0.752045f,
647  0.427812f, 0.742828f, 0.433669f, 0.729661f, 0.445392f, 0.731997f, 0.437950f, 0.749777f,
648  0.312907f, 0.729222f, 0.324726f, 0.727177f, 0.330270f, 0.740536f, 0.319919f, 0.747250f,
649  0.433669f, 0.729661f, 0.435018f, 0.718280f, 0.440995f, 0.724383f, 0.445392f, 0.731997f,
650  0.317510f, 0.721697f, 0.323658f, 0.715731f, 0.324726f, 0.727177f, 0.312907f, 0.729222f,
651  0.435018f, 0.718280f, 0.452955f, 0.700023f, 0.455277f, 0.713731f, 0.440995f, 0.724383f,
652  0.303460f, 0.710657f, 0.306136f, 0.696976f, 0.323658f, 0.715731f, 0.317510f, 0.721697f,
653  0.501231f, 0.844356f, 0.457832f, 0.840040f, 0.473386f, 0.824700f, 0.512485f, 0.828811f,
654  0.282357f, 0.821525f, 0.297562f, 0.837358f, 0.253846f, 0.840502f, 0.242975f, 0.824574f,
655  0.555495f, 0.826352f, 0.501231f, 0.844356f, 0.512485f, 0.828811f, 0.550942f, 0.811814f,
656  0.242975f, 0.824574f, 0.253846f, 0.840502f, 0.199850f, 0.820889f, 0.204839f, 0.806417f,
657  0.568148f, 0.787367f, 0.555495f, 0.826352f, 0.550942f, 0.811814f, 0.552139f, 0.787682f,
658  0.204839f, 0.806417f, 0.199850f, 0.820889f, 0.188269f, 0.781375f, 0.204331f, 0.782156f,
659  0.542850f, 0.755753f, 0.568148f, 0.787367f, 0.552139f, 0.787682f, 0.539407f, 0.764539f,
660  0.204331f, 0.782156f, 0.188269f, 0.781375f, 0.214575f, 0.750414f, 0.217774f, 0.759319f,
661  0.505666f, 0.730944f, 0.542850f, 0.755753f, 0.539407f, 0.764539f, 0.508439f, 0.743135f,
662  0.217774f, 0.759319f, 0.214575f, 0.750414f, 0.252524f, 0.726592f, 0.249419f, 0.738732f,
663  0.452955f, 0.700023f, 0.505666f, 0.730944f, 0.508439f, 0.743135f, 0.455277f, 0.713731f,
664  0.249419f, 0.738732f, 0.252524f, 0.726592f, 0.306136f, 0.696976f, 0.303460f, 0.710657f,
665  0.437950f, 0.749777f, 0.445392f, 0.731997f, 0.470841f, 0.748408f, 0.454776f, 0.761665f,
666  0.286960f, 0.745020f, 0.312907f, 0.729222f, 0.319919f, 0.747250f, 0.302729f, 0.758742f,
667  0.454776f, 0.761665f, 0.470841f, 0.748408f, 0.488870f, 0.770464f, 0.475403f, 0.783904f,
668  0.268291f, 0.766661f, 0.286960f, 0.745020f, 0.302729f, 0.758742f, 0.281439f, 0.780511f,
669  0.475403f, 0.783904f, 0.488870f, 0.770464f, 0.503673f, 0.787562f, 0.494476f, 0.802470f,
670  0.252972f, 0.783410f, 0.268291f, 0.766661f, 0.281439f, 0.780511f, 0.261790f, 0.798626f,
671  0.494476f, 0.802470f, 0.503673f, 0.787562f, 0.518562f, 0.791602f, 0.516802f, 0.807339f,
672  0.237920f, 0.787045f, 0.252972f, 0.783410f, 0.261790f, 0.798626f, 0.239243f, 0.802891f,
673  0.512485f, 0.828811f, 0.473386f, 0.824700f, 0.494476f, 0.802470f, 0.516802f, 0.807339f,
674  0.261790f, 0.798626f, 0.282357f, 0.821525f, 0.242975f, 0.824574f, 0.239243f, 0.802891f,
675  0.448505f, 0.804621f, 0.475403f, 0.783904f, 0.494476f, 0.802470f, 0.473386f, 0.824700f,
676  0.261790f, 0.798626f, 0.281439f, 0.780511f, 0.307886f, 0.802031f, 0.282357f, 0.821525f,
677  0.448505f, 0.804621f, 0.435868f, 0.779569f, 0.454776f, 0.761665f, 0.475403f, 0.783904f,
678  0.302729f, 0.758742f, 0.321237f, 0.777208f, 0.307886f, 0.802031f, 0.281439f, 0.780511f,
679  0.437950f, 0.749777f, 0.454776f, 0.761665f, 0.435868f, 0.779569f, 0.423718f, 0.754191f,
680  0.321237f, 0.777208f, 0.302729f, 0.758742f, 0.319919f, 0.747250f, 0.334089f, 0.752045f,
681  0.440995f, 0.724383f, 0.455277f, 0.713731f, 0.470841f, 0.748408f, 0.445392f, 0.731997f,
682  0.286960f, 0.745020f, 0.303460f, 0.710657f, 0.317510f, 0.721697f, 0.312907f, 0.729222f,
683  0.508439f, 0.743135f, 0.488870f, 0.770464f, 0.470841f, 0.748408f, 0.455277f, 0.713731f,
684  0.286960f, 0.745020f, 0.268291f, 0.766661f, 0.249419f, 0.738732f, 0.303460f, 0.710657f,
685  0.539407f, 0.764539f, 0.503673f, 0.787562f, 0.488870f, 0.770464f, 0.508439f, 0.743135f,
686  0.268291f, 0.766661f, 0.252972f, 0.783410f, 0.217774f, 0.759319f, 0.249419f, 0.738732f,
687  0.552139f, 0.787682f, 0.518562f, 0.791602f, 0.503673f, 0.787562f, 0.539407f, 0.764539f,
688  0.252972f, 0.783410f, 0.237920f, 0.787045f, 0.204331f, 0.782156f, 0.217774f, 0.759319f,
689  0.550942f, 0.811814f, 0.516802f, 0.807339f, 0.518562f, 0.791602f, 0.552139f, 0.787682f,
690  0.237920f, 0.787045f, 0.239243f, 0.802891f, 0.204839f, 0.806417f, 0.204331f, 0.782156f,
691  0.512485f, 0.828811f, 0.516802f, 0.807339f, 0.550942f, 0.811814f, 0.204839f, 0.806417f,
692  0.239243f, 0.802891f, 0.242975f, 0.824574f, 0.508270f, 0.697693f, 0.434803f, 0.658882f,
693  0.484068f, 0.628776f, 0.543385f, 0.683538f, 0.276936f, 0.625067f, 0.325318f, 0.656224f,
694  0.250811f, 0.693249f, 0.216123f, 0.678120f, 0.563786f, 0.739211f, 0.508270f, 0.697693f,
695  0.543385f, 0.683538f, 0.581052f, 0.726933f, 0.216123f, 0.678120f, 0.250811f, 0.693249f,
696  0.194086f, 0.733241f, 0.177176f, 0.720426f, 0.619962f, 0.791615f, 0.563786f, 0.739211f,
697  0.581052f, 0.726933f, 0.616701f, 0.759965f, 0.177176f, 0.720426f, 0.194086f, 0.733241f,
698  0.136063f, 0.784093f, 0.140379f, 0.752377f, 0.707492f, 0.759884f, 0.619962f, 0.791615f,
699  0.616701f, 0.759965f, 0.660647f, 0.741167f, 0.140379f, 0.752377f, 0.136063f, 0.784093f,
700  0.049526f, 0.748824f, 0.097038f, 0.732052f, 0.745511f, 0.652100f, 0.707492f, 0.759884f,
701  0.660647f, 0.741167f, 0.677256f, 0.670436f, 0.097038f, 0.732052f, 0.049526f, 0.748824f,
702  0.019409f, 0.639749f, 0.083564f, 0.662038f, 0.740843f, 0.572428f, 0.745511f, 0.652100f,
703  0.677256f, 0.670436f, 0.671403f, 0.592656f, 0.083564f, 0.662038f, 0.019409f, 0.639749f,
704  0.033664f, 0.564403f, 0.092820f, 0.589862f, 0.677256f, 0.670436f, 0.543385f, 0.683538f,
705  0.484068f, 0.628776f, 0.671403f, 0.592656f, 0.276936f, 0.625067f, 0.216123f, 0.678120f,
706  0.083564f, 0.662038f, 0.092820f, 0.589862f, 0.677256f, 0.670436f, 0.660647f, 0.741167f,
707  0.581052f, 0.726933f, 0.543385f, 0.683538f, 0.177176f, 0.720426f, 0.097038f, 0.732052f,
708  0.083564f, 0.662038f, 0.216123f, 0.678120f, 0.660647f, 0.741167f, 0.616701f, 0.759965f,
709  0.581052f, 0.726933f, 0.177176f, 0.720426f, 0.140379f, 0.752377f, 0.097038f, 0.732052f,
710  0.842355f, 0.195160f, 0.829287f, 0.219562f, 0.834578f, 0.206879f, 0.834705f, 0.206959f,
711  0.033664f, 0.564403f, 0.051216f, 0.522659f, 0.145041f, 0.562595f, 0.092820f, 0.589862f,
712  0.620420f, 0.565675f, 0.671403f, 0.592656f, 0.484068f, 0.628776f, 0.498072f, 0.552315f,
713  0.276936f, 0.625067f, 0.092820f, 0.589862f, 0.145041f, 0.562595f, 0.264218f, 0.550140f,
714  0.391039f, 0.611891f, 0.498072f, 0.552315f, 0.484068f, 0.628776f, 0.434803f, 0.658882f,
715  0.276936f, 0.625067f, 0.264218f, 0.550140f, 0.369913f, 0.610196f, 0.325318f, 0.656224f,
716 };
717 
718 #define VERT_MARK 1
719 
720 #define EDGE_ORIG 1
721 #define EDGE_MARK 2
722 
723 #define FACE_MARK 1
724 #define FACE_NEW 2
725 
727 {
728  BMOpSlot *slot_verts_out = BMO_slot_get(op->slots_out, "verts.out");
729 
730  const float dia = BMO_slot_float_get(op->slots_in, "size");
731  const uint xtot = max_ii(1, BMO_slot_int_get(op->slots_in, "x_segments"));
732  const uint ytot = max_ii(1, BMO_slot_int_get(op->slots_in, "y_segments"));
733  const float xtot_inv2 = 2.0f / (xtot);
734  const float ytot_inv2 = 2.0f / (ytot);
735 
736  const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV);
737  const bool calc_uvs = (cd_loop_uv_offset != -1) && BMO_slot_bool_get(op->slots_in, "calc_uvs");
738 
739  BMVert **varr;
740  BMVert *vquad[4];
741 
742  float mat[4][4];
743  float vec[3], tvec[3];
744 
745  uint x, y, i;
746 
747  BMO_slot_mat4_get(op->slots_in, "matrix", mat);
748 
749  BMO_slot_buffer_alloc(op, op->slots_out, "verts.out", (xtot + 1) * (ytot + 1));
750  varr = (BMVert **)slot_verts_out->data.buf;
751 
752  i = 0;
753  vec[2] = 0.0f;
754  for (y = 0; y <= ytot; y++) {
755  vec[1] = ((y * ytot_inv2) - 1.0f) * dia;
756  for (x = 0; x <= xtot; x++) {
757  vec[0] = ((x * xtot_inv2) - 1.0f) * dia;
758  mul_v3_m4v3(tvec, mat, vec);
759  varr[i] = BM_vert_create(bm, tvec, NULL, BM_CREATE_NOP);
760  BMO_vert_flag_enable(bm, varr[i], VERT_MARK);
761  i++;
762  }
763  }
764 
765 #define XY(_x, _y) ((_x) + ((_y) * (xtot + 1)))
766 
767  for (y = 1; y <= ytot; y++) {
768  for (x = 1; x <= xtot; x++) {
769  BMFace *f;
770 
771  vquad[0] = varr[XY(x - 1, y - 1)];
772  vquad[1] = varr[XY(x, y - 1)];
773  vquad[2] = varr[XY(x, y)];
774  vquad[3] = varr[XY(x - 1, y)];
775 
776  f = BM_face_create_verts(bm, vquad, 4, NULL, BM_CREATE_NOP, true);
777  if (calc_uvs) {
779  }
780  }
781  }
782 
783 #undef XY
784 
785  if (calc_uvs) {
786  BM_mesh_calc_uvs_grid(bm, xtot, ytot, FACE_MARK, cd_loop_uv_offset);
787  }
788 }
789 
799  const uint x_segments,
800  const uint y_segments,
801  const short oflag,
802  const int cd_loop_uv_offset)
803 {
804  BMFace *f;
805  BMLoop *l;
806  BMIter iter, liter;
807 
808  const float dx = 1.0f / (float)(x_segments);
809  const float dy = 1.0f / (float)(y_segments);
810  const float dx_wrap = 1.0 - (dx / 2.0f);
811  float x = 0.0f;
812  float y = dy;
813 
814  int loop_index;
815 
816  BLI_assert(cd_loop_uv_offset != -1);
817 
818  BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
819  if (!BMO_face_flag_test(bm, f, oflag)) {
820  continue;
821  }
822 
823  BM_ITER_ELEM_INDEX (l, &liter, f, BM_LOOPS_OF_FACE, loop_index) {
824  MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
825 
826  switch (loop_index) {
827  case 0:
828  y -= dy;
829  break;
830  case 1:
831  x += dx;
832  break;
833  case 2:
834  y += dy;
835  break;
836  case 3:
837  x -= dx;
838  break;
839  default:
840  break;
841  }
842 
843  luv->uv[0] = x;
844  luv->uv[1] = y;
845  }
846 
847  x += dx;
848  if (x >= dx_wrap) {
849  x = 0.0f;
850  y += dy;
851  }
852  }
853 }
854 
856 {
857  const float dia = BMO_slot_float_get(op->slots_in, "diameter");
858  const int seg = BMO_slot_int_get(op->slots_in, "u_segments");
859  const int tot = BMO_slot_int_get(op->slots_in, "v_segments");
860 
861  const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV);
862  const bool calc_uvs = (cd_loop_uv_offset != -1) && BMO_slot_bool_get(op->slots_in, "calc_uvs");
863 
864  BMOperator bmop, prevop;
865  BMVert *eve, *preveve;
866  BMEdge *e;
867  BMIter iter;
868  const float axis[3] = {0, 0, 1};
869  float vec[3], mat[4][4], cmat[3][3];
870  int a;
871 
872  BMO_slot_mat4_get(op->slots_in, "matrix", mat);
873 
874  const float phid = (float)M_PI / tot;
875  /* phi = 0.25f * (float)M_PI; */ /* UNUSED */
876 
877  /* one segment first */
878  for (a = 0; a <= tot; a++) {
879  /* Going in this direction, then edge extruding, makes normals face outward */
880  /* Calculate with doubles for higher precision, see: T87779. */
881  const float phi = M_PI * ((double)a / (double)tot);
882 
883  vec[0] = 0.0;
884  vec[1] = dia * sinf(phi);
885  vec[2] = dia * cosf(phi);
886  eve = BM_vert_create(bm, vec, NULL, BM_CREATE_NOP);
888 
889  if (a != 0) {
890  e = BM_edge_create(bm, preveve, eve, NULL, BM_CREATE_NOP);
892  }
893 
894  preveve = eve;
895  }
896 
897  /* extrude and rotate; negative phi to make normals face outward */
898  axis_angle_to_mat3(cmat, axis, -(M_PI * 2) / seg);
899 
900  for (a = 0; a < seg; a++) {
901  if (a) {
902  BMO_op_initf(bm, &bmop, op->flag, "extrude_edge_only edges=%S", &prevop, "geom.out");
903  BMO_op_exec(bm, &bmop);
904  BMO_op_finish(bm, &prevop);
905  }
906  else {
907  BMO_op_initf(bm, &bmop, op->flag, "extrude_edge_only edges=%fe", EDGE_ORIG);
908  BMO_op_exec(bm, &bmop);
909  }
910 
912  BMO_op_callf(bm, op->flag, "rotate cent=%v matrix=%m3 verts=%S", vec, cmat, &bmop, "geom.out");
913 
914  prevop = bmop;
915  }
916 
917  if (a) {
918  BMO_op_finish(bm, &bmop);
919  }
920 
921  {
922  float len, len2, vec2[3];
923 
924  len = 2 * dia * sinf(phid / 2.0f);
925 
926  /* Length of one segment in shortest parallel. */
927  vec[0] = dia * sinf(phid);
928  vec[1] = 0.0f;
929  vec[2] = dia * cosf(phid);
930 
931  mul_v3_m3v3(vec2, cmat, vec);
932  len2 = len_v3v3(vec, vec2);
933 
934  /* use shortest segment length divided by 3 as merge threshold */
935  BMO_op_callf(
936  bm, op->flag, "remove_doubles verts=%fv dist=%f", VERT_MARK, min_ff(len, len2) / 3.0f);
937  }
938 
939  if (calc_uvs) {
940  BMFace *f;
941  BMLoop *l;
942  BMIter fiter, liter;
943 
944  /* We cannot tag faces for UVs computing above,
945  * so we have to do it now, based on all its vertices being tagged. */
946  BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) {
947  bool valid = true;
948 
949  BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
950  if (!BMO_vert_flag_test(bm, l->v, VERT_MARK)) {
951  valid = false;
952  break;
953  }
954  }
955 
956  if (valid) {
958  }
959  }
960 
961  BM_mesh_calc_uvs_sphere(bm, FACE_MARK, cd_loop_uv_offset);
962  }
963 
964  /* Now apply the inverse matrix. */
965  BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
966  if (BMO_vert_flag_test(bm, eve, VERT_MARK)) {
967  mul_m4_v3(mat, eve->co);
968  }
969  }
970 
972 }
973 
975 {
976  const float dia = BMO_slot_float_get(op->slots_in, "diameter");
977  const float dia_div = dia / 200.0f;
978  const int subdiv = BMO_slot_int_get(op->slots_in, "subdivisions");
979 
980  const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV);
981  const bool calc_uvs = (cd_loop_uv_offset != -1) && BMO_slot_bool_get(op->slots_in, "calc_uvs");
982 
983  BMVert *eva[12];
984  BMVert *v;
985  BMIter liter;
986  BMIter viter;
987  BMLoop *l;
988  float vec[3], mat[4][4] /* , phi, phid */;
989  int a;
990 
991  BMO_slot_mat4_get(op->slots_in, "matrix", mat);
992 
993  /* phid = 2.0f * (float)M_PI / subdiv; */ /* UNUSED */
994  /* phi = 0.25f * (float)M_PI; */ /* UNUSED */
995 
996  for (a = 0; a < 12; a++) {
997  vec[0] = dia_div * icovert[a][0];
998  vec[1] = dia_div * icovert[a][1];
999  vec[2] = dia_div * icovert[a][2];
1000  eva[a] = BM_vert_create(bm, vec, NULL, BM_CREATE_NOP);
1001 
1003  }
1004 
1005  int uvi = 0;
1006  for (a = 0; a < 20; a++) {
1007  BMFace *f;
1008  BMVert *v1, *v2, *v3;
1009 
1010  v1 = eva[icoface[a][0]];
1011  v2 = eva[icoface[a][1]];
1012  v3 = eva[icoface[a][2]];
1013 
1015 
1016  BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
1018  }
1019 
1020  /* Set the UVs here, the iteration order of the faces is not guaranteed,
1021  * so it's best to set the UVs right after the face is created. */
1022  if (calc_uvs) {
1023  int loop_index;
1024  BM_ITER_ELEM_INDEX (l, &liter, f, BM_LOOPS_OF_FACE, loop_index) {
1025  MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
1026  luv->uv[0] = icouvs[uvi][0];
1027  luv->uv[1] = icouvs[uvi][1];
1028  uvi++;
1029  }
1030  }
1031  }
1032 
1033  if (subdiv > 1) {
1034  BMOperator bmop;
1035 
1036  BMO_op_initf(bm,
1037  &bmop,
1038  op->flag,
1039  "subdivide_edges edges=%fe "
1040  "smooth=%f "
1041  "cuts=%i "
1042  "use_grid_fill=%b use_sphere=%b",
1043  EDGE_MARK,
1044  dia,
1045  (1 << (subdiv - 1)) - 1,
1046  true,
1047  true);
1048 
1049  BMO_op_exec(bm, &bmop);
1052  BMO_op_finish(bm, &bmop);
1053  }
1054 
1055  /* must transform after because of sphere subdivision */
1056  BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) {
1057  if (BMO_vert_flag_test(bm, v, VERT_MARK)) {
1058  mul_m4_v3(mat, v->co);
1059  }
1060  }
1061 
1063 }
1064 
1065 static void bm_mesh_calc_uvs_sphere_face(BMFace *f, const int cd_loop_uv_offset)
1066 {
1067  float *uvs[4];
1068  BMLoop *l;
1069  BMIter iter;
1070  float dx;
1071  int loop_index, loop_index_max_x;
1072 
1073  BLI_assert(f->len <= 4);
1074 
1075  /* If face has 3 vertices, it's a polar face, in which case we need to
1076  * compute a nearby to determine its latitude. */
1077  float avgx = 0.0f, avgy = 0.0f;
1078  BM_ITER_ELEM_INDEX (l, &iter, f, BM_LOOPS_OF_FACE, loop_index) {
1079  if (f->len == 3) {
1080  avgx += l->v->co[0];
1081  avgy += l->v->co[1];
1082  }
1083  }
1084  avgx /= 3.0f;
1085  avgy /= 3.0f;
1086 
1087  BM_ITER_ELEM_INDEX (l, &iter, f, BM_LOOPS_OF_FACE, loop_index) {
1088  MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
1089  float x = l->v->co[0];
1090  float y = l->v->co[1];
1091  float z = l->v->co[2];
1092  float len = len_v3(l->v->co);
1093 
1094  /* Use neighboring point to compute angle for poles. */
1095  float theta;
1096  if (f->len == 3 && fabsf(x) < 0.0001f && fabsf(y) < 0.0001f) {
1097  theta = atan2f(avgy, avgx);
1098  }
1099  else {
1100  theta = atan2f(y, x);
1101  }
1102 
1103  /* Shift borderline coordinates to the left. */
1104  if (fabsf(theta - (float)M_PI) < 0.0001f) {
1105  theta = -M_PI;
1106  }
1107 
1108  float phi = saacos(z / len);
1109  luv->uv[0] = 0.5f + theta / ((float)M_PI * 2);
1110  luv->uv[1] = 1.0f - phi / (float)M_PI;
1111 
1112  uvs[loop_index] = luv->uv;
1113  }
1114 
1115  /* Fix awkwardly-wrapping UVs */
1116  loop_index_max_x = 0;
1117  for (loop_index = 1; loop_index < f->len; loop_index++) {
1118  if (uvs[loop_index][0] > uvs[loop_index_max_x][0]) {
1119  loop_index_max_x = loop_index;
1120  }
1121  }
1122 
1123  for (loop_index = 0; loop_index < f->len; loop_index++) {
1124  if (loop_index != loop_index_max_x) {
1125  dx = uvs[loop_index_max_x][0] - uvs[loop_index][0];
1126  if (dx > 0.5f) {
1127  uvs[loop_index][0] += 1.0f;
1128  }
1129  }
1130  }
1131 }
1132 
1139 void BM_mesh_calc_uvs_sphere(BMesh *bm, const short oflag, const int cd_loop_uv_offset)
1140 {
1141  BMFace *f;
1142  BMIter iter;
1143 
1144  BLI_assert(cd_loop_uv_offset != -1); /* caller is responsible for giving us UVs */
1145 
1146  BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
1147  if (!BMO_face_flag_test(bm, f, oflag)) {
1148  continue;
1149  }
1150 
1151  bm_mesh_calc_uvs_sphere_face(f, cd_loop_uv_offset);
1152  }
1153 
1154  BMIter iter2;
1155  BMLoop *l;
1156  int loop_index;
1157  float minx = 1.0f;
1158 
1159  BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
1160  if (!BMO_face_flag_test(bm, f, oflag)) {
1161  continue;
1162  }
1163  BM_ITER_ELEM_INDEX (l, &iter2, f, BM_LOOPS_OF_FACE, loop_index) {
1164  MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
1165  if (luv->uv[0] < minx) {
1166  minx = luv->uv[0];
1167  }
1168  }
1169  }
1170 
1171  BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
1172  if (!BMO_face_flag_test(bm, f, oflag)) {
1173  continue;
1174  }
1175  BM_ITER_ELEM_INDEX (l, &iter2, f, BM_LOOPS_OF_FACE, loop_index) {
1176  MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
1177  luv->uv[0] -= minx;
1178  }
1179  }
1180 }
1181 
1183 {
1184  BMVert **tv = MEM_mallocN(sizeof(*tv) * monkeynv * 2, "tv");
1185  float mat[4][4];
1186  int i;
1187 
1188  BMO_slot_mat4_get(op->slots_in, "matrix", mat);
1189 
1190  const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV);
1191  const bool calc_uvs = (cd_loop_uv_offset != -1) && BMO_slot_bool_get(op->slots_in, "calc_uvs");
1192 
1193  for (i = 0; i < monkeynv; i++) {
1194  float v[3];
1195 
1196  /* rotate to face in the -Y axis */
1197  v[0] = (monkeyv[i][0] + 127) / 128.0;
1198  v[2] = monkeyv[i][1] / 128.0;
1199  v[1] = monkeyv[i][2] / -128.0;
1200 
1201  tv[i] = BM_vert_create(bm, v, NULL, BM_CREATE_NOP);
1203 
1204  if (fabsf(v[0] = -v[0]) < 0.001f) {
1205  tv[monkeynv + i] = tv[i];
1206  }
1207  else {
1209  mul_m4_v3(mat, eve->co);
1210  tv[monkeynv + i] = eve;
1211  }
1212 
1214 
1215  mul_m4_v3(mat, tv[i]->co);
1216  }
1217 
1218  int uvi = 0;
1219  for (i = 0; i < monkeynf; i++) {
1220  BMFace *f_new_a = BM_face_create_quad_tri(
1221  bm,
1222  tv[monkeyf[i][0] + i - monkeyo],
1223  tv[monkeyf[i][1] + i - monkeyo],
1224  tv[monkeyf[i][2] + i - monkeyo],
1225  (monkeyf[i][3] != monkeyf[i][2]) ? tv[monkeyf[i][3] + i - monkeyo] : NULL,
1226  NULL,
1227  BM_CREATE_NOP);
1228 
1229  BMFace *f_new_b = BM_face_create_quad_tri(
1230  bm,
1231  tv[monkeynv + monkeyf[i][2] + i - monkeyo],
1232  tv[monkeynv + monkeyf[i][1] + i - monkeyo],
1233  tv[monkeynv + monkeyf[i][0] + i - monkeyo],
1234  (monkeyf[i][3] != monkeyf[i][2]) ? tv[monkeynv + monkeyf[i][3] + i - monkeyo] : NULL,
1235  NULL,
1236  BM_CREATE_NOP);
1237 
1238  /* Set the UVs here, the iteration order of the faces is not guaranteed,
1239  * so it's best to set the UVs right after the face is created. */
1240  if (calc_uvs) {
1241  BMLoop *l;
1242  BMIter liter;
1243  BM_ITER_ELEM (l, &liter, f_new_a, BM_LOOPS_OF_FACE) {
1244  MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
1245  luv->uv[0] = monkeyuvs[uvi * 2 + 0];
1246  luv->uv[1] = monkeyuvs[uvi * 2 + 1];
1247  uvi++;
1248  }
1249  BM_ITER_ELEM (l, &liter, f_new_b, BM_LOOPS_OF_FACE) {
1250  MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
1251  luv->uv[0] = monkeyuvs[uvi * 2 + 0];
1252  luv->uv[1] = monkeyuvs[uvi * 2 + 1];
1253  uvi++;
1254  }
1255  }
1256  }
1257 
1258  MEM_freeN(tv);
1259 
1261 }
1262 
1264 {
1265  const float radius = BMO_slot_float_get(op->slots_in, "radius");
1266  const int segs = BMO_slot_int_get(op->slots_in, "segments");
1267  const bool cap_ends = BMO_slot_bool_get(op->slots_in, "cap_ends");
1268  const bool cap_tris = BMO_slot_bool_get(op->slots_in, "cap_tris");
1269 
1270  const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV);
1271  const bool calc_uvs = (cd_loop_uv_offset != -1) && BMO_slot_bool_get(op->slots_in, "calc_uvs");
1272 
1273  BMVert *v1, *lastv1 = NULL, *cent1, *firstv1 = NULL;
1274  float vec[3], mat[4][4];
1275  int a;
1276 
1277  if (!segs) {
1278  return;
1279  }
1280 
1281  BMO_slot_mat4_get(op->slots_in, "matrix", mat);
1282 
1283  if (cap_ends) {
1284  zero_v3(vec);
1285  mul_m4_v3(mat, vec);
1286 
1287  cent1 = BM_vert_create(bm, vec, NULL, BM_CREATE_NOP);
1289  }
1290 
1291  for (a = 0; a < segs; a++) {
1292  /* Going this way ends up with normal(s) upward */
1293 
1294  /* Calculate with doubles for higher precision, see: T87779. */
1295  const float phi = (2.0 * M_PI) * ((double)a / (double)segs);
1296  vec[0] = -radius * sinf(phi);
1297  vec[1] = radius * cosf(phi);
1298  vec[2] = 0.0f;
1299  mul_m4_v3(mat, vec);
1301 
1303 
1304  if (lastv1) {
1305  BM_edge_create(bm, v1, lastv1, NULL, BM_CREATE_NOP);
1306  }
1307 
1308  if (a && cap_ends) {
1309  BMFace *f;
1310 
1311  f = BM_face_create_quad_tri(bm, cent1, lastv1, v1, NULL, NULL, BM_CREATE_NOP);
1313  }
1314 
1315  if (!firstv1) {
1316  firstv1 = v1;
1317  }
1318 
1319  lastv1 = v1;
1320  }
1321 
1322  if (!a) {
1323  return;
1324  }
1325 
1326  BM_edge_create(bm, firstv1, lastv1, NULL, 0);
1327 
1328  if (cap_ends) {
1329  BMFace *f;
1330 
1331  f = BM_face_create_quad_tri(bm, cent1, v1, firstv1, NULL, NULL, BM_CREATE_NOP);
1333 
1334  if (calc_uvs) {
1335  BM_mesh_calc_uvs_circle(bm, mat, radius, FACE_NEW, cd_loop_uv_offset);
1336  }
1337  }
1338 
1339  if (!cap_tris) {
1340  BMO_op_callf(bm, op->flag, "dissolve_faces faces=%ff", FACE_NEW);
1341  }
1342 
1344 }
1345 
1355  BMesh *bm, float mat[4][4], const float radius, const short oflag, const int cd_loop_uv_offset)
1356 {
1357  BMFace *f;
1358  BMLoop *l;
1359  BMIter fiter, liter;
1360 
1361  const float uv_scale = 0.5f / radius;
1362  const float uv_center = 0.5f;
1363 
1364  float inv_mat[4][4];
1365 
1366  BLI_assert(cd_loop_uv_offset != -1); /* caller must ensure we have UVs already */
1367 
1368  invert_m4_m4(inv_mat, mat);
1369 
1370  BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) {
1371  if (!BMO_face_flag_test(bm, f, oflag)) {
1372  continue;
1373  }
1374 
1375  BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
1376  MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
1377 
1378  float uv_vco[3];
1379  copy_v3_v3(uv_vco, l->v->co);
1380  /* transform back into the unit circle flat on the Z-axis */
1381  mul_m4_v3(inv_mat, uv_vco);
1382 
1383  /* then just take those coords for UVs */
1384  luv->uv[0] = uv_center + uv_scale * uv_vco[0];
1385  luv->uv[1] = uv_center + uv_scale * uv_vco[1];
1386  }
1387  }
1388 }
1389 
1391 {
1392  BMVert *v1, *v2, *lastv1 = NULL, *lastv2 = NULL, *cent1, *cent2, *firstv1, *firstv2;
1393  BMFace *f;
1394  float vec[3], mat[4][4];
1395  const float dia1 = BMO_slot_float_get(op->slots_in, "diameter1");
1396  const float dia2 = BMO_slot_float_get(op->slots_in, "diameter2");
1397  const float depth_half = 0.5f * BMO_slot_float_get(op->slots_in, "depth");
1398  int segs = BMO_slot_int_get(op->slots_in, "segments");
1399  const bool cap_ends = BMO_slot_bool_get(op->slots_in, "cap_ends");
1400  const bool cap_tris = BMO_slot_bool_get(op->slots_in, "cap_tris");
1401 
1402  const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV);
1403  const bool calc_uvs = (cd_loop_uv_offset != -1) && BMO_slot_bool_get(op->slots_in, "calc_uvs");
1404 
1405  if (!segs) {
1406  return;
1407  }
1408 
1409  BMO_slot_mat4_get(op->slots_in, "matrix", mat);
1410 
1411  if (cap_ends) {
1412  vec[0] = vec[1] = 0.0f;
1413  vec[2] = -depth_half;
1414  mul_m4_v3(mat, vec);
1415 
1416  cent1 = BM_vert_create(bm, vec, NULL, BM_CREATE_NOP);
1417 
1418  vec[0] = vec[1] = 0.0f;
1419  vec[2] = depth_half;
1420  mul_m4_v3(mat, vec);
1421 
1422  cent2 = BM_vert_create(bm, vec, NULL, BM_CREATE_NOP);
1423 
1426  }
1427 
1428  const int side_faces_len = segs - 1;
1429  BMFace **side_faces = MEM_mallocN(sizeof(*side_faces) * side_faces_len, __func__);
1430 
1431  for (int i = 0; i < segs; i++) {
1432  /* Calculate with doubles for higher precision, see: T87779. */
1433  const float phi = (2.0 * M_PI) * ((double)i / (double)segs);
1434 
1435  vec[0] = dia1 * sinf(phi);
1436  vec[1] = dia1 * cosf(phi);
1437  vec[2] = -depth_half;
1438  mul_m4_v3(mat, vec);
1440 
1441  vec[0] = dia2 * sinf(phi);
1442  vec[1] = dia2 * cosf(phi);
1443  vec[2] = depth_half;
1444  mul_m4_v3(mat, vec);
1446 
1449 
1450  if (i) {
1451  if (cap_ends) {
1452  f = BM_face_create_quad_tri(bm, cent1, lastv1, v1, NULL, NULL, BM_CREATE_NOP);
1453  if (calc_uvs) {
1455  }
1457 
1458  f = BM_face_create_quad_tri(bm, cent2, v2, lastv2, NULL, NULL, BM_CREATE_NOP);
1459  if (calc_uvs) {
1461  }
1463  }
1464 
1465  f = BM_face_create_quad_tri(bm, lastv1, lastv2, v2, v1, NULL, BM_CREATE_NOP);
1466  if (calc_uvs) {
1468  }
1469  side_faces[i - 1] = f;
1470  }
1471  else {
1472  firstv1 = v1;
1473  firstv2 = v2;
1474  }
1475 
1476  lastv1 = v1;
1477  lastv2 = v2;
1478  }
1479 
1480  if (cap_ends) {
1481  f = BM_face_create_quad_tri(bm, cent1, v1, firstv1, NULL, NULL, BM_CREATE_NOP);
1482  if (calc_uvs) {
1484  }
1486 
1487  f = BM_face_create_quad_tri(bm, cent2, firstv2, v2, NULL, NULL, BM_CREATE_NOP);
1488  if (calc_uvs) {
1490  }
1492  }
1493 
1494  f = BM_face_create_quad_tri(bm, v1, v2, firstv2, firstv1, NULL, BM_CREATE_NOP);
1495  if (calc_uvs) {
1497  }
1498 
1499  if (calc_uvs) {
1500  BM_mesh_calc_uvs_cone(bm, mat, dia2, dia1, segs, cap_ends, FACE_MARK, cd_loop_uv_offset);
1501  }
1502 
1503  /* Collapse vertices at the first end. */
1504  if (dia1 == 0.0f) {
1505  if (cap_ends) {
1506  BM_vert_kill(bm, cent1);
1507  }
1508  for (int i = 0; i < side_faces_len; i++) {
1509  f = side_faces[i];
1510  BMLoop *l = BM_FACE_FIRST_LOOP(f);
1511  BM_edge_collapse(bm, l->prev->e, l->prev->v, true, true);
1512  }
1513  }
1514 
1515  /* Collapse vertices at the second end. */
1516  if (dia2 == 0.0f) {
1517  if (cap_ends) {
1518  BM_vert_kill(bm, cent2);
1519  }
1520  for (int i = 0; i < side_faces_len; i++) {
1521  f = side_faces[i];
1522  BMLoop *l = BM_FACE_FIRST_LOOP(f);
1523  BM_edge_collapse(bm, l->next->e, l->next->v, true, true);
1524  }
1525  }
1526 
1527  if (!cap_tris) {
1528  BMO_op_callf(bm, op->flag, "dissolve_faces faces=%ff", FACE_NEW);
1529  }
1530 
1531  if (side_faces != NULL) {
1532  MEM_freeN(side_faces);
1533  }
1534 
1536 }
1537 
1550  float mat[4][4],
1551  const float radius_top,
1552  const float radius_bottom,
1553  const int segments,
1554  const bool cap_ends,
1555  const short oflag,
1556  const int cd_loop_uv_offset)
1557 {
1558  BMFace *f;
1559  BMLoop *l;
1560  BMIter fiter, liter;
1561 
1562  const float uv_width = 1.0f / (float)segments;
1563  const float uv_height = cap_ends ? 0.5f : 1.0f;
1564 
1565  /* Note that all this allows us to handle all cases
1566  * (real cone, truncated cone, with or without ends capped)
1567  * with a single common code. */
1568  const float uv_center_y = cap_ends ? 0.25f : 0.5f;
1569  const float uv_center_x_top = cap_ends ? 0.25f : 0.5f;
1570  const float uv_center_x_bottom = cap_ends ? 0.75f : 0.5f;
1571  const float uv_radius = cap_ends ? 0.24f : 0.5f;
1572 
1573  /* Using the opposite's end uv_scale as fallback allows us to handle 'real cone' case. */
1574  const float uv_scale_top = (radius_top != 0.0f) ?
1575  (uv_radius / radius_top) :
1576  ((radius_bottom != 0.0f) ? (uv_radius / radius_bottom) :
1577  uv_radius);
1578  const float uv_scale_bottom = (radius_bottom != 0.0f) ? (uv_radius / radius_bottom) :
1579  uv_scale_top;
1580 
1581  float local_up[3] = {0.0f, 0.0f, 1.0f};
1582 
1583  float x, y;
1584  float inv_mat[4][4];
1585  int loop_index;
1586 
1587  /* Transform the up-vector like we did the cone itself, without location. */
1588  mul_mat3_m4_v3(mat, local_up);
1589  /* Remove global scaling. */
1590  normalize_v3(local_up);
1591 
1592  invert_m4_m4(inv_mat, mat);
1593 
1594  BLI_assert(cd_loop_uv_offset != -1); /* caller is responsible for ensuring the mesh has UVs */
1595 
1596  x = 1.0f;
1597  y = 1.0f - uv_height;
1598 
1599  BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) {
1600  if (!BMO_face_flag_test(bm, f, oflag)) {
1601  continue;
1602  }
1603 
1604  if (f->len == 4 && radius_top && radius_bottom) {
1605  /* side face - so unwrap it in a rectangle */
1606  BM_ITER_ELEM_INDEX (l, &liter, f, BM_LOOPS_OF_FACE, loop_index) {
1607  MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
1608 
1609  switch (loop_index) {
1610  case 0:
1611  /* Continue in the last position */
1612  break;
1613  case 1:
1614  y += uv_height;
1615  break;
1616  case 2:
1617  x -= uv_width;
1618  break;
1619  case 3:
1620  y -= uv_height;
1621  break;
1622  default:
1623  break;
1624  }
1625 
1626  luv->uv[0] = x;
1627  luv->uv[1] = y;
1628  }
1629  }
1630  else {
1631  /* Top or bottom face - so unwrap it by transforming
1632  * back to a circle and using the X/Y coords. */
1634 
1635  BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
1636  MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
1637  float uv_vco[3];
1638 
1639  mul_v3_m4v3(uv_vco, inv_mat, l->v->co);
1640 
1641  if (dot_v3v3(f->no, local_up) > 0.0f) { /* if this is a top face of the cone */
1642  luv->uv[0] = uv_center_x_top + uv_vco[0] * uv_scale_top;
1643  luv->uv[1] = uv_center_y + uv_vco[1] * uv_scale_top;
1644  }
1645  else {
1646  luv->uv[0] = uv_center_x_bottom + uv_vco[0] * uv_scale_bottom;
1647  luv->uv[1] = uv_center_y + uv_vco[1] * uv_scale_bottom;
1648  }
1649  }
1650  }
1651  }
1652 }
1653 
1655 {
1656  BMVert *verts[8];
1657  float mat[4][4];
1658  float off = BMO_slot_float_get(op->slots_in, "size") / 2.0f;
1659 
1660  const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV);
1661  const bool calc_uvs = (cd_loop_uv_offset != -1) && BMO_slot_bool_get(op->slots_in, "calc_uvs");
1662 
1663  /* rotation order set to match 'BM_mesh_calc_uvs_cube' */
1664  const char faces[6][4] = {
1665  {0, 1, 3, 2},
1666  {2, 3, 7, 6},
1667  {6, 7, 5, 4},
1668  {4, 5, 1, 0},
1669  {2, 6, 4, 0},
1670  {7, 3, 1, 5},
1671  };
1672 
1673  BMO_slot_mat4_get(op->slots_in, "matrix", mat);
1674 
1675  if (!off) {
1676  off = 0.5f;
1677  }
1678  int i = 0;
1679 
1680  for (int x = -1; x < 2; x += 2) {
1681  for (int y = -1; y < 2; y += 2) {
1682  for (int z = -1; z < 2; z += 2) {
1683  float vec[3] = {(float)x * off, (float)y * off, (float)z * off};
1684  mul_m4_v3(mat, vec);
1685  verts[i] = BM_vert_create(bm, vec, NULL, BM_CREATE_NOP);
1687  i++;
1688  }
1689  }
1690  }
1691 
1692  for (i = 0; i < ARRAY_SIZE(faces); i++) {
1693  BMFace *f;
1694  BMVert *quad[4] = {
1695  verts[faces[i][0]],
1696  verts[faces[i][1]],
1697  verts[faces[i][2]],
1698  verts[faces[i][3]],
1699  };
1700 
1701  f = BM_face_create_verts(bm, quad, 4, NULL, BM_CREATE_NOP, true);
1702  if (calc_uvs) {
1704  }
1705  }
1706 
1707  if (calc_uvs) {
1709  }
1710 
1712 }
1713 
1724 {
1725  BMFace *f;
1726  BMLoop *l;
1727  BMIter fiter, liter;
1728  const float width = 0.25f;
1729 
1730  const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV);
1731 
1732  float x = 0.375f;
1733  float y = 0.0f;
1734 
1735  int loop_index;
1736 
1737  BLI_assert(cd_loop_uv_offset != -1); /* the caller can ensure that we have UVs */
1738 
1739  BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) {
1740  if (!BMO_face_flag_test(bm, f, oflag)) {
1741  continue;
1742  }
1743 
1744  BM_ITER_ELEM_INDEX (l, &liter, f, BM_LOOPS_OF_FACE, loop_index) {
1745  MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
1746 
1747  luv->uv[0] = x;
1748  luv->uv[1] = y;
1749 
1750  switch (loop_index) {
1751  case 0:
1752  x += width;
1753  break;
1754  case 1:
1755  y += width;
1756  break;
1757  case 2:
1758  x -= width;
1759  break;
1760  case 3:
1761  y -= width;
1762  break;
1763  default:
1764  break;
1765  }
1766  }
1767 
1768  if (y >= 0.75f && x > 0.125f) {
1769  x = 0.125f;
1770  y = 0.5f;
1771  }
1772  else if (x <= 0.125f) {
1773  x = 0.625f;
1774  y = 0.5f;
1775  }
1776  else {
1777  y += 0.25f;
1778  }
1779  }
1780 }
typedef float(TangentPoint)[2]
CustomData interface, see also DNA_customdata_types.h.
int CustomData_get_offset(const struct CustomData *data, int type)
#define BLI_assert(a)
Definition: BLI_assert.h:58
MINLINE float saacos(float fac)
MINLINE float min_ff(float a, float b)
MINLINE int max_ii(int a, int b)
#define M_PI
Definition: BLI_math_base.h:38
void mul_mat3_m4_v3(const float M[4][4], float r[3])
Definition: math_matrix.c:794
bool invert_m4_m4(float R[4][4], const float A[4][4])
Definition: math_matrix.c:1278
void mul_m4_v3(const float M[4][4], float r[3])
Definition: math_matrix.c:732
void mul_v3_m4v3(float r[3], const float M[4][4], const float v[3])
Definition: math_matrix.c:742
void mul_v3_m3v3(float r[3], const float M[3][3], const float a[3])
Definition: math_matrix.c:901
void axis_angle_to_mat3(float R[3][3], const float axis[3], const float angle)
MINLINE float len_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE float normalize_v3(float r[3])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void zero_v3(float r[3])
MINLINE float len_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
unsigned int uint
Definition: BLI_sys_types.h:83
#define ARRAY_SIZE(arr)
typedef double(DMatrix)[4][4]
@ CD_MLOOPUV
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble z
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble v1
Read Guarded memory(de)allocation.
@ BM_VERT
Definition: bmesh_class.h:383
@ BM_EDGE
Definition: bmesh_class.h:384
#define BM_FACE_FIRST_LOOP(p)
Definition: bmesh_class.h:553
#define BM_ELEM_CD_GET_VOID_P(ele, offset)
Definition: bmesh_class.h:530
BMFace * BM_face_create_quad_tri(BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v3, BMVert *v4, const BMFace *f_example, const eBMCreateFlag create_flag)
Make Quad/Triangle.
BMVert * BM_vert_create(BMesh *bm, const float co[3], const BMVert *v_example, const eBMCreateFlag create_flag)
Main function for creating a new vertex.
Definition: bmesh_core.c:58
BMFace * BM_face_create_verts(BMesh *bm, BMVert **vert_arr, const int len, const BMFace *f_example, const eBMCreateFlag create_flag, const bool create_edges)
Definition: bmesh_core.c:500
void BM_vert_kill(BMesh *bm, BMVert *v)
Definition: bmesh_core.c:1002
BMEdge * BM_edge_create(BMesh *bm, BMVert *v1, BMVert *v2, const BMEdge *e_example, const eBMCreateFlag create_flag)
Main function for creating a new edge.
Definition: bmesh_core.c:147
@ BM_CREATE_NOP
Definition: bmesh_core.h:27
#define BM_ITER_ELEM(ele, iter, data, itype)
#define BM_ITER_MESH(ele, iter, bm, itype)
@ BM_VERTS_OF_MESH
@ BM_FACES_OF_MESH
@ BM_LOOPS_OF_FACE
#define BM_ITER_ELEM_INDEX(ele, iter, data, itype, indexvar)
ATTR_WARN_UNUSED_RESULT BMesh * bm
BMVert * BM_edge_collapse(BMesh *bm, BMEdge *e_kill, BMVert *v_kill, const bool do_del, const bool kill_degenerate_faces)
Definition: bmesh_mods.c:566
void BMO_slot_mat4_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, float r_mat[4][4])
void BMO_slot_buffer_flag_enable(BMesh *bm, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const char htype, const short oflag)
BMO_FLAG_BUFFER.
void * BMO_slot_buffer_alloc(BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const int len)
#define BMO_edge_flag_enable(bm, e, oflag)
float BMO_slot_float_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
#define BMO_vert_flag_enable(bm, e, oflag)
void BMO_op_exec(BMesh *bm, BMOperator *op)
BMESH OPSTACK EXEC OP.
bool BMO_op_initf(BMesh *bm, BMOperator *op, const int flag, const char *fmt,...)
#define BMO_face_flag_enable(bm, e, oflag)
#define BMO_vert_flag_test(bm, e, oflag)
int BMO_slot_int_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
void BMO_op_finish(BMesh *bm, BMOperator *op)
BMESH OPSTACK FINISH OP.
BMOpSlot * BMO_slot_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identifier)
BMESH OPSTACK GET SLOT.
#define BMO_face_flag_test(bm, e, oflag)
void BMO_slot_buffer_from_enabled_flag(BMesh *bm, BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const char htype, const short oflag)
bool BMO_slot_bool_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
bool BMO_op_callf(BMesh *bm, const int flag, const char *fmt,...)
ATTR_WARN_UNUSED_RESULT const BMFlagLayer const short oflag
void BM_face_normal_update(BMFace *f)
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMLoop * l
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMVert * v
#define XY(_x, _y)
static const short icoface[20][3]
Definition: bmo_primitive.c:51
static const int monkeyo
Definition: bmo_primitive.c:75
#define VERT_MARK
void BM_mesh_calc_uvs_cube(BMesh *bm, const short oflag)
static const float icovert[12][3]
Definition: bmo_primitive.c:36
static signed char monkeyf[250][4]
#define FACE_NEW
void bmo_create_grid_exec(BMesh *bm, BMOperator *op)
static const int monkeynf
Definition: bmo_primitive.c:77
void bmo_create_circle_exec(BMesh *bm, BMOperator *op)
void bmo_create_monkey_exec(BMesh *bm, BMOperator *op)
#define FACE_MARK
void BM_mesh_calc_uvs_circle(BMesh *bm, float mat[4][4], const float radius, const short oflag, const int cd_loop_uv_offset)
void BM_mesh_calc_uvs_cone(BMesh *bm, float mat[4][4], const float radius_top, const float radius_bottom, const int segments, const bool cap_ends, const short oflag, const int cd_loop_uv_offset)
void bmo_create_icosphere_exec(BMesh *bm, BMOperator *op)
void bmo_create_cone_exec(BMesh *bm, BMOperator *op)
#define EDGE_MARK
static void bm_mesh_calc_uvs_sphere_face(BMFace *f, const int cd_loop_uv_offset)
void BM_mesh_calc_uvs_sphere(BMesh *bm, const short oflag, const int cd_loop_uv_offset)
void bmo_create_cube_exec(BMesh *bm, BMOperator *op)
static const float icouvs[60][2]
Definition: bmo_primitive.c:57
#define EDGE_ORIG
static const float monkeyuvs[]
void BM_mesh_calc_uvs_grid(BMesh *bm, const uint x_segments, const uint y_segments, const short oflag, const int cd_loop_uv_offset)
void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op)
static const signed char monkeyv[271][3]
Definition: bmo_primitive.c:78
static const int monkeynv
Definition: bmo_primitive.c:76
static float verts[][3]
GPUBatch * quad
#define sinf(x)
#define cosf(x)
#define atan2f(x, y)
#define fabsf(x)
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
void *(* MEM_mallocN)(size_t len, const char *str)
Definition: mallocn.c:47
static char faces[256]
static unsigned a[3]
Definition: RandGen.cpp:92
int len
Definition: bmesh_class.h:279
float no[3]
Definition: bmesh_class.h:280
struct BMVert * v
Definition: bmesh_class.h:165
struct BMEdge * e
Definition: bmesh_class.h:176
struct BMLoop * prev
Definition: bmesh_class.h:245
struct BMLoop * next
Definition: bmesh_class.h:245
union BMOpSlot::@139 data
struct BMOpSlot slots_out[BMO_OP_MAX_SLOTS]
struct BMOpSlot slots_in[BMO_OP_MAX_SLOTS]
float co[3]
Definition: bmesh_class.h:99
CustomData ldata
Definition: bmesh_class.h:337
uint len