wiki:GraphicsLibrary

Brainstorming vom 01.06.2010:

abstract class Drawing {
  def rotate (angle : Double) : Drawing = new Rotation(angle, this)

  val a : Drawing = _
  val b = a rotate 90
}

class Vector2D ... {
  def -> (Vector2D other) : Drawing
}

object Drawing {
  def draw (block : => List[Drawing]) : Drawing = new Combination(block)
  def line (a : Vector2D, b : Vector2D) : Drawing = new Line(a, b)
  def test {
    draw {
      (5,5) -> (1,1)
      line ((0,0), (1,7))
    } rotate 45
  }
}

private case class Line (a : Vector2D, b : Vector2D) extends Drawing
private case class Polygon (points : List[Vector2D]) extends Drawing
private case class Combination (drawings : List[Drawing]) extends Drawing
private case class Rotation (angle : Double, drawing : Drawing) extends Drawing

Last modified 7 years ago Last modified on 08.06.2010 14:01:23