Prints (0)

No Prints Yet
Be the first to upload a Print for this Design!
Description
Summary A slight tweak to my code for the Twisted Drop, with a stretch and a Boolean merge with a cone to give a trunk and remove some of the weirdness inside the tree. Print Settings Printer: Eaglemoss Vector3 Rafts: Yes Supports: Yes Resolution: 0.2 mm Infill: 20% How I Designed This I started with some code I give my students to help them start 3D graphics projects. This helps them create models in Vertex and Index Buffers programmatically. I then grabbed the Marching Cubes function from here, and used it so that I could feed in an equation and get out a Vertex Buffer containing a given isosurface of that equation, display it and then spits out a basic obj file. My wife commented that the twisted drop looked a bit like a Christmas tree, so I slightly tweaked the code for it to produce this. The model is in a cubic region 2 Pi to a side and centred at the origin, with a grid of values 100 x 100 x 100 and the isosurface value is zero. This left a few odd bits of other geometry junk in that region, so when I pulled it in to Netfabb to stitch it all together I also removed all of them apart from this piece which I also slightly stretched. The geometry got a bit strung out and tortured on the inside of the "tree", so I Boolean added a plain cone to cover it up and act as a trunk Value Function This is the code which calculates the function / equation value for a given point in space float VBMarchCubes::function(Vector3 _pos) { _pos *= 2.0; float w = _pos.z *1.2f; float x = (_pos.x *cos(w)  _pos.y * sin(w))/(0.25*(_pos.z+XM_PI)), y = (_pos.x*sin(w)+_pos.y*cos(w)) /(0.25* (_pos.z + XM_PI)), z = _pos.z*cos(w)*cos(w); float x1 = _pos.x, y1 = _pos.y, z1 = _pos.z; return ((x + 1)*(x + 1) + (y + 1)*(y + 1) + (z  2)*(z  2)  XM_PIDIV2*XM_PIDIV2)*((x  1)*(x  1) + (y  1)*(y  1) + (z  2)*(z  2)  XM_PIDIV2*XM_PIDIV2) *((x  1)*(x  1) + (y + 1)*(y + 1) + (z  1)*(z  1)  XM_PIDIV2*XM_PIDIV2)*((x + 1)*(x + 1) + (y  1)*(y  1) + (z  1)*(z  1)  XM_PIDIV2*XM_PIDIV2) *((x + 1)*(x + 1) + (y + 1)*(y + 1) + (z + 1)*(z + 1)  XM_PIDIV2*XM_PIDIV2)*((x  1)*(x  1) + (y  1)*(y  1) + (z + 1)*(z + 1)  XM_PIDIV2*XM_PIDIV2) *((x1*x1 / (XM_PI*XM_PI) + y1*y1 / (XM_PI*XM_PI) + (z1  4)*(z1  4) / (XM_PIDIV4*XM_PIDIV4))  1); }
Comments