rotate($rotAngle) { line0 = Line2d.new([-0.7, -0.7], $origin2d) line0.doPathGen(func, 0, 10) {|pt, valA| line1 = Line2d.new(pt, flipX(pt)) line2 = Line2d.new(flipX(pt), flipOrigin(pt)) line3 = Line2d.new(flipOrigin(pt), flipY(pt)) line4 = Line2d.new(flipY(pt), pt) setColor($rainbowPath.doPathPoint(1.0 - $alphaMod), $alphaMod) doPaths([line1, line2, line3, line4], 0.05) { |pts, val| drawLine(pts[0], pts[1]) drawLine(pts[1], pts[2]) drawLine(pts[2], pts[3]) drawLine(pts[3], pts[0]) } } } // entwined meshes line1 = Line2d.new([-0.7, -0.7], [-0.7, 0.7]) line2 = Line2d.new([0.7, -0.7], [0.7, 0.7]) line3 = Line2d.new([-0.7, 0.7], [0.7, 0.7]) line4 = Line2d.new([-0.7, -0.7], [0.7, -0.7]) lineReg = TwoLineRegion.new(line1, line2) lineReg2 = TwoLineRegion.new(line3, line4) rotate($rotAngle){ lineReg2.doCrossHatchLines($epsilon, $counter) {|line1, epsilon1| lineReg.doCrossHatchLines($epsilon, $counter) {|line2, epsilon2| setColor($usedPath.doPathPoint(epsilon1 * epsilon2), $alphaMod) drawLine(line2) drawLine(line1) } } // Bezier shits randColorPath = BezierPath.new([randomColor, randomColor, randomColor, randomColor]) pd = PathDrawer.new doPathsParallel([$upLine, $downLine, $downLineX, $upLineX], 0.2) {|ptsA, val| path1 = Line.new(ptsA[0], ptsA[1]) path2 = Line.new(ptsA[2], ptsA[3]) doPathsParallel([$leftLine, path1, path2, $rightLineX], 0.01) { |pts, eps| doBezierPath(pts, 0.001) { |pt, epsilon| pt = jitter(pt, epsilon) pd.doPoint(pt) { setColor(randColorPath.doPathPoint(epsilon)) } } pd.init } } // flowers pd = PathDrawer.new ellipse = EllipsePath.new($origin2d, 1.0, 1.0) ellipse.doPath(0.006) { |pt, eps| line = Line.new($origin2d, jitter(pt, 0.05 )) pd.init line.doPath(0.003) { |ptA, epsA| setColor($usedPath.doPathPoint( epsA), 1.0 - epsA) pd.doPoint(jitter(ptA, 0.05 * eps)) } } // polys ep = EllipsePath.new($origin2d, 1.6 + $epsilon2, 1.6 + $epsilon2) pa = NPointAccumulator.new(3) pa.init ep.doPath($epsilon) { |point, eps| setColor($usedPath.doPathPoint(eps), alpha = 1.0 - $epsilon) pa.doPoint(point) { |points| drawPolygon(points.map {|point| jitter(point, eps * 0.1)}) } } // circlething c = CirclePath.new($origin2d, Point2d.new($epsilon2, $epsilon2), true, $pi) pa = PathAccumulator.new rw = RandomWalk.new(0.01, 0.02) c.doPath($epsilon) { |point, val| st = rw.step c1 = CirclePath.new(point, Point2d.new(st, st)) c1.doPath($epsilon) { |pointA, eps| pa.doPoint(jitter(pointA, 0.01)) } setColor($usedPath.doPathPoint(val), $alpha) drawPolygon(pa.points) pa.init } // interactIVE if ($mvPt != $origin2d) if $changed $path.addPoint($mvPt) $changed = false end $path.doPath { |pt, eps| setColor($usedPath.doPathPoint(eps), $alpha) drawLine(jitter(pt, 0.05), $centerPt) } end // Make crosshatches if $clickDown $points << $clickPt while $points.length > 4 $points.delete_at(0) end if $points.length == 4 $crossHatches << CrossHatch.new($points, $epsilon) $points.delete_at(0) $points.delete_at(0) end $clickDown = false end if $crossHatches.length > 0 $crossHatches.last.setDensity($epsilon) end rotate($rotAngle) { $crossHatches.each do |ch| ch.draw { |val| setColor($usedPath.doPathPoint(val))} end } //