def shade(self, stroke): # normals are stored in a tuple, so they don't update when we reposition vertices. normals = tuple(stroke_normal(stroke)) for svert, normal in zip(stroke, normals): a = self.start + svert.u * (self.end - self.start) svert.point += (normal * a) + self.xy stroke.update_length()
def shade(self, stroke): # normals are stored in a tuple, so they don't update when we reposition vertices. normals = tuple(stroke_normal(stroke)) distances = iter_distance_along_stroke(stroke) for svert, distance, normal in zip(stroke, distances, normals): n = normal * self._amplitude * cos(distance / self._wavelength * 2 * pi + self._phase) svert.point += n stroke.update_length()
def shade(self, stroke): # normals are stored in a tuple, so they don't update when we reposition vertices. normals = tuple(stroke_normal(stroke)) distances = iter_distance_along_stroke(stroke) coeff = 1 / self.wavelength * 2 * pi for svert, distance, normal in zip(stroke, distances, normals): n = normal * self.amplitude * cos(distance * coeff + self.phase) svert.point += n stroke.update_length()