You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: prepare.go
    path of file: ./repos/tegola/vendor/github.com/go-spatial/geom/encoding/mvt
    
    the code of the file until where you have to start completion: package mvt

import (
	"log"

	"github.com/go-spatial/geom/cmp"

	"github.com/go-spatial/geom/winding"

	"github.com/go-spatial/geom"
)

// PrepareGeo converts the geometry's coordinates to tile pixel coordinates. tile should be the
// extent of the tile, in the same projection as geo. pixelExtent is the dimension of the
// (square) tile in pixels usually 4096, see DefaultExtent.
// This function treats the tile extent elements as left, top, right, bottom. This is fine
// when working with a north-positive projection such as lat/long (epsg:4326)
// and web mercator (epsg:3857), but a south-positive projection (ie. epsg:2054) or west-postive
// projection would then flip the geomtery. To properly render these coordinate systems, simply
// swap the X's or Y's in the tile extent.
func Pr
    
func preparePolygon(g geom.Polygon, tile *geom.Extent, pixelExtent float64) (p geom.Polygon) {
	lines := geom.MultiLineString(g.LinearRings())
	p = make(geom.Polygon, 0, len(lines))

	if len(lines) == 0 {
		return p
	}

	for _, line := range lines.LineStrings() {

		if len(line) < 2 {
			if debug {
				// skip lines that have been reduced to less than 2 points.
				log.Println("skipping line 2", line, len(line))
			}
			continue
		}
		ln := preparelinestr(line, tile, pixelExtent)
		if cmp.HiCMP.GeomPointEqual(ln[0], ln[len(ln)-1]) {
			// first and last is the same, need to remove the last point.
			ln = ln[:len(ln)-1]
		}
		if len(ln) < 2 {
			if debug {
				// skip lines that have been reduced to less than 2 points.
				log.Println("skipping line 2", line, len(ln))
			}
			continue
		}
		p = append(p, ln)
	}

	order := winding.Order{
		YPositiveDown: false,
	}
	return geom.Polygon(order.RectifyPolygon([][][2]float64(p)))
}