MCPcopy
hub / github.com/tdewolff/canvas / Tile

Method Tile

path_tiling.go:293–306  ·  view source on GitHub ↗

P1 wallpaper group var P1 = []Matrix{Identity} Pm wallpaper group var Pm = []Matrix{ Identity, Identity.ReflectYAbout(0.5), } Pg wallpaper group var Pg = []Matrix{ Identity, Identity.Translate(0.5, 0.0).ReflectYAbout(0.5), } func Cm(x, y float64) Tiler { return Tiler{ Point{x, 0.0}, Point

(clip *Path, cell Matrix)

Source from the content-addressed store, hash-verified

291
292// Tile tiles a path within a clipping path using the given primitive cell.
293func (p *Path) Tile(clip *Path, cell Matrix) *Path {
294 // get path overflow out of cell
295 bounds := p.FastBounds()
296 clipBounds := clip.FastBounds()
297 cells := TileRectangle(cell, clipBounds, bounds)
298
299 // append all tiles
300 r := &Path{}
301 for _, cell := range cells {
302 pos := cell.Dot(Origin)
303 r = r.Append(p.Copy().Translate(pos.X, pos.Y))
304 }
305 return r.And(clip)
306}
307
308// Triangulate tessellates the path with triangles that fill the path. WIP
309func (p *Path) Triangulate() ([][3]Point, [][5]Point) {

Callers 6

rhombitrihexagonalTilingFunction · 0.95
floretTilingFunction · 0.45
cairoTilingFunction · 0.45
pythagoreanTilingFunction · 0.45
drawFunction · 0.45
RenderPathMethod · 0.45

Calls 7

FastBoundsMethod · 0.95
AppendMethod · 0.95
CopyMethod · 0.95
AndMethod · 0.95
TileRectangleFunction · 0.85
DotMethod · 0.45
TranslateMethod · 0.45

Tested by

no test coverage detected