Toplogical Anomaly

Hello, I decided to mess around with some spirals now that my script is working.

Here it is again

```
module Spiral
def self.make_circle_face(entities, circle_edges)
pts = []
circle_edges.each { |e|
pts << e.vertices[0]
}
face = entities.add_face(pts)
return face
end
def self.make_circle(entities, point, radius, normal)
# make a circle face at the point with the given radius
circ = entities.add_circle(point, normal, radius)
circ_face = self.make_circle_face(entities, circ)
return circ_face
end
def self.draw_turns(entities, segments, radius, taper_amount,
z, z_increment, facet_size, last_point, num_turns)
(facet_size..(360 * num_turns)).step(facet_size).each do |angle|
theta = angle.degrees
radius -= taper_amount
x = radius * Math.cos(theta)
y = radius * Math.sin(theta)
point = Geom::Point3d.new(x, y, z)
line = entities.add_line(last_point, point)
segments << line
last_point = point
z += z_increment
end
end
def self.draw(radius, taper_amount, z_increment, num_turns, facet_size, segments)
model = Sketchup.active_model
entities = model.active_entities
z = 0
endpoint = Geom::Point3d.new(radius, 0, z)
spiral_group = entities.add_group
spiral_entities = spiral_group.entities
self.draw_turns(spiral_entities, segments, radius,
taper_amount, z, z_increment, facet_size, endpoint, num_turns)
return spiral_group
end # method draw
end # module Spiral
radius = 100
taper_amount = 0.3
z_increment = 1
num_turns = 3
facet_size = 6
segments = []
wire_thickness = 20
model = Sketchup.active_model
model.start_operation('spiral', true)
spiral_group = Spiral.draw(radius, taper_amount, z_increment, num_turns, facet_size, segments)
entities = spiral_group.entities
start_point = Geom::Point3d.new(radius, 0, 0)
normal = [0,-1,0]
face = Spiral.make_circle(entities, start_point, wire_thickness, normal)
face.followme(segments)
# begin abusing spiral
stuff = spiral_group.explode
curves = stuff.grep(Sketchup::Curve)
curves.each { |c|
points = c.vertices.map(&:position)
points.each_with_index { |pt,i|
pt.z = pt.z * i
pt.x = pt.x * i
pt.y = pt.y * i
}
c.move_vertices(points)
}
model.commit_operation
```

I decided to iterate through the curves and mess with the position of the vertices, resulting in this interesting shape here.

However I’m not sure why the faces became so patchy. (My husband immediately remembered a similar shape from Star Trek - pictured above.)

Is there a way to programmatically heal the faces so the object looks smooth again?

Thanks for any thoughts

-j_jones