


Summary
This is a little mathematical doodle I produced using my marching cubes code. Its an isosurface of a series of spheres which are squashed and rotated as you move up the model.
Print Settings
Printer:
Eaglemoss Vector3 Rafts:
Yes Supports:
Yes Resolution:
.2 mm Infill:
20% Notes:
The bottom is quite curved and they are a number of overhangs so really needs a raft and supports on the model.
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.
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.
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;
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);
}
Loading prints...
Twisted Drop
0
likes
1
collection
Tags:
Creative Commons Attribution
You can distribute, remix, adapt, and build upon the material in any medium or format, as long as attribution is given to the creator.
Files Included
1 downloadable file:
Free download - login required
Downloaded: 19 times
Downloaded: 19 times
Loading comments...