Does anyone know how to create an algorithm capable of making the figure just like in the picture, when given a set of specific points (3D array)
-
4It's a thing, is this what you are looking for: blog.andreaskahler.com/2009/06/…– Luke San Antonio BialeckiCommented Apr 20, 2013 at 23:09
-
3@LukeSanAntonio Post that as an answer so I can upvote it please ;) (but not just the link, some minimal explanation of the algorithm would be necessary for an answer)– yannisCommented Apr 20, 2013 at 23:10
-
1@YannisRizos I would, but I don't have any knowledge or experience in this kind of thing, so I could not give you an adequate explanation (well I could, but others could do much better) The only reason I knew the link is because I knew the name of the shape from Blender (wiki.blender.org/index.php/Doc:2.4/Manual/Modeling/Meshes/…)– Luke San Antonio BialeckiCommented Apr 20, 2013 at 23:37
-
creating the shadow from a 3D object is done daily, check out shadow mapping and shadow volume, but there are more shadow creation algorithms available– ratchet freakCommented Apr 20, 2013 at 23:38
-
It's not the Shadow I'm looking to create, it's the physical object. We're going to 3D print it.– user88794Commented Apr 21, 2013 at 0:41
1 Answer
Coming here after the battle, but since there are no accepted answer yet and seeing that @Luke refuses to get the rep he deserves, here is a quick summary of the link he provided.
So the full algorithm is available here:
http://blog.andreaskahler.com/2009/06/creating-icosphere-mesh-in-code.html
The idea is to bootstrap your mesh with a simple method which gives you a sphere with 20 faces, and then refine it until you are satisfied.
Bootstrapping the shape
You start with an icosahedron. As the wikipedia article says, you can obtain the vertices by drawing three identical and orthogonal rectangle. You have 3 rectangles with 4 corner each --> 12 vertices.
Wikipedia illustration:
For example, the Z plan points are (a, b are the rectangle lengths):
- (+a, +b, 0)
- (-a, +b, 0)
- (+a, -b, 0)
- (-a, -b, 0)
Now you still have to find the 20 faces. This is left as an exercise to the reader :p
Refining the shape
Now that you have a basic sphere, you may want to add polygons. You do so with this simple algorithm:
for each iteration:
# each iteration multiplies by 4 the number of faces
for each edge at the current iteration:
split the edge in two
replace the middle point on the sphere
To find the middle point, we suppose that we wish to create the unit sphere (center (0, 0, 0), radius 1).
middlePoint(p1, p2):
middle = Point((p1.X + p2.X / 2), # same for y, z)
radius = sqrt(middle.X^2, middle.Y^2, middle.Z^2)
return Point(middle.X / radius, # same for y, z)
At each iteration, we may have to reconstruct the faces, but it is fairly easy. Each face is divided into four: