func (m *Map) ColourFaces(ctx *cairo.Surface, brush func(*Face) (float64, float64, float64, float64)) { m.Faces.Do(func(f interface{}) { F := f.(*Face) ctx.SetSourceRGBA(brush(F)) e := F.boundary ctx.MoveTo(e.start.Float64()) for f := e.Next(); f != e; f = f.Next() { ctx.LineTo(f.start.Float64()) } ctx.ClosePath() ctx.Fill() }) }
func (m *Map) ColourDebugFaces(ctx *cairo.Surface) { n := float64(m.Faces.Len()) i := 0. m.Faces.Do(func(f interface{}) { F, _ := f.(*Face) if F.Value.(string) == "outer" { return } e := F.boundary ctx.MoveTo(e.start.Float64()) for f := e.Next(); f != e; f = f.Next() { ctx.LineTo(f.start.Float64()) } ctx.ClosePath() if F.Value.(string) == "skeleton" { ctx.SetSourceRGBA(0., 0., 1., 1.) } else { ctx.SetSourceRGBA(i/n, 0., 0., 1.) } ctx.Fill() i = i + 1. }) }
func (p *Point) Draw(ctx *cairo.Surface) { ctx.Arc(p.x.Float64(), p.y.Float64(), .1, 0., 2.*math.Pi) ctx.Fill() }