[Closed] half circle
managed to remove second half
radius1 = radius2 = 100 –both radii of the hemi-circles
theHeight = 100 –the distance between the halves
num_faces = 10 –number of segments per hemi-circle
vert_array = #() –vertex array
face_array = #() –face array
center1 = [0,theHeight/2,0] –center of the first hemi-circle
center2 = [0,-theHeight/2,0] –center of the second hemi-circle
append vert_array center1 –add the center to the vertex array
vert_count = 1 –init. the vertex counter to 1
theStep = 180.0/num_faces –the angle to increment to get N segments
deathdriver = 180
for a = 0 to 180-theStep by theStep do –loop through the segments of the first hemi-circle
(
append vert_array (center1 + [radius1cos(a),radius1sin(a),0]) –add first vertex on circle
append vert_array (center1 + [radius1cos(a+theStep),radius1sin(a+theStep),0]) –add second circle + the angular offset
append face_array [1 ,vert_count+1,vert_count+2] –define a face from center1 (vertex 1) and the two new vertices on the circle
vert_count += 2 –add two because two new vertices were added
)–end a loop
append vert_array center2 –add the second center as vertex
center2Index = vert_count += 1 –and remember its index
for a = 180 to 360 by deathdriver do –same as above, but other half from 180 to 360-the step
(
append vert_array (center2 + [radius2cos(a),radius2sin(a),0]) –same as before, just using center2 and radius2
append vert_array (center2 + [radius2cos(a),radius2sin(a),0]) –same as before
append face_array [center2Index ,vert_count+1,vert_count+2] –connect the vertex at center2 with the two new verts
vert_count += 2 –increase by 2 as before
)–end a loop
append face_array [center2Index ,vert_count, 2] –create a face from the center2 to the last vertex to the first vertex of first half-circle (index 2)
append face_array [1, center2Index , 2] –create a face using first center, the second center and the first vertex of hemi circle 1
append face_array [center2Index – 1, center2Index + 1, 1 ] –same with the last vertex of circle 1, the first vertex of circle2 and center 1
append face_array [center2Index + 1, center2Index, 1 ] –and finally face from first vertex of circle2, center 2 and center 1
m = mesh vertices:vert_array faces:face_array –create the mesh…
btw, do you have anything against me posting these on scriptspot?
i bow in thy honour for helping me, o great bobo, god of maxscript.
Not at all. Scriptspot is where it belongs to…
I am still going to add a couple of tutorials to the MAXScript Reference based on my version of the code because the AntiStar was obviously not enough to get you started.