require 'bizzieDraw' require 'bizziePath' require 'bizzieGeometry' def process end def crossHatch end class CrossHatch def initialize(points, density) @line1 = Line2d.new(points[0], points[1]) @line2 = Line2d.new(points[1], points[2]) @line3 = Line2d.new(points[3], points[2]) @line4 = Line2d.new(points[0], points[3]) @density = density end def setDensity(density) @density = density end def draw doPathsParallel([@line1, @line3, @line2, @line4], @density) { |pts, val| yield val #do whatever you need to do each line drawLine(pts[0], pts[1]) drawLine(pts[2], pts[3]) } end end def rotateIterate(theta, num = 1, point = $origin2d) num.times do |x| if (x != 0) GL.PushMatrix GL.Translate(point.x, point.y, 0.0) GL.Rotate(theta * x, 0.0, 0.0, 0.1) GL.Translate(-1 * point.x, -1 * point.y, 0.0) yield Float(x)/Float(num) GL.PopMatrix end end end