Search the Community
Showing results for tags 'geometry creation VEX'.
-
float theta; int res_lon = 10; //longitude resolution float start_theta = 0; float end_theta = 0.5; float theta_step = ((end_theta-start_theta)/float(res_lon)); float phi; int res_lat = 10; //latitude resolution float start_phi = 0; float end_phi = 0.6; float phi_step = ((end_phi-start_phi)/float(res_lat)); float r_min = 1 ; float r_max = 2 ; int pt_n; int prim_poly_n = addprim(geoself(), "poly"); //inner radius arcs for (int i = 0; i < res_lat ; i++){ for (int j = 0; j < res_lon; j++){ theta = (start_theta + theta_step*j); vector pos = set( r_min*cos(theta), 0, r_min*sin(theta) ); //latitude arcs phi = start_phi + phi_step*i; matrix rot = ident(); vector up = set( 0, 1, 0); vector rot_axis = cross ( normalize(pos), up); float angle= phi; rotate(rot, angle, rot_axis); pos *=rot; pt_n = addpoint(geoself(), set(pos)); // ptnum created addvertex(geoself(), prim_poly_n, pt_n); } } //outer radius for (int i = 0; i < res_lat ; i++){ for (int j = 0; j < res_lon; j++){ theta = start_theta + theta_step*j; vector pos = set( r_max*cos(theta), 0, r_max*sin(theta) ); //latitude arcs phi = start_phi + phi_step*i; matrix rot = ident(); vector up = set( 0, 1 , 0); vector rot_axis = cross ( normalize(pos), up); float angle= phi; rotate(rot, angle, rot_axis); pos *=rot; pt_n = addpoint(geoself(), set(pos)); // ptnum created addvertex(geoself(), prim_poly_n, pt_n); } } Hello OdForce!!! I am trying to create a nice slice of cake in VEX. The above code is written in an attribute wrangle SOP, run over Detail. It generates the points just right, but the face connection is not correct. I believe this is related to the order of creation of the points, hence the ptnum. What is the right ptnum order to make the faces connect properly? Any tips on how to achieve the result is much appreciated and will be rewarded with a tasty slice of Cake! thank you!