// TransformMirrorPoint symmetrically mirrors the following text, drawings and
// images on the point specified by (x, y).
//
// The TransformBegin() example demonstrates this method.
499470
func (f *Fpdf) TransformMirrorPoint(x, y float64) {
	f.TransformScale(-100, -100, x, y)
}
220041
func (mirrorRef *MirrorReference) getMirrorInfo(source DataSource, contentId string, cloud CloudSpec, format string,
	requireSigned bool) (*MirrorInfo, error) {

	metadata, err := GetMirrorMetadataWithFormat(source, mirrorRef.Path, format, requireSigned)
	if err != nil {
		return nil, err
	}
	mirrorInfo, err := metadata.getMirrorInfo(contentId, cloud)
	if err != nil {
		return nil, err
	}
	return mirrorInfo, nil
}
302541
func (mirrorRefs *MirrorRefs) getMirrorReference(datatype, contentId string, cloud CloudSpec) (*MirrorReference, error) {
	candidates := mirrorRefs.extractMirrorRefs(contentId)
	if len(candidates) == 0 {
		return nil, errors.NotFoundf("mirror data for %q", contentId)
	}
	// Restrict by cloud spec and datatype.
	hasRightCloud := func(mirrorRef *MirrorReference) bool {
		return mirrorRef.hasCloud(cloud) && mirrorRef.DataType == datatype
	}
	matchingCandidates := candidates.filter(hasRightCloud)
	if len(matchingCandidates) == 0 {
		// No cloud specific mirrors found so look for a non cloud specific mirror.
		for _, candidate := range candidates {
			if len(candidate.Clouds) == 0 {
				logger.Debugf("using default candidate for content id %q are %v", contentId, candidate)
				return &candidate, nil
			}
		}
		return nil, errors.NotFoundf("index file with cloud %v", cloud)
	}

	logger.Debugf("candidate matches for content id %q are %v", contentId, candidates)

	// Pick arbitrary match.
	return &matchingCandidates[0], nil
}
1150719
func (s *DefaultService) LoadMirrors(mirrors []string) error {
	s.mu.Lock()
	defer s.mu.Unlock()

	return s.config.LoadMirrors(mirrors)
}
607364
func Midpoint(φ1, λ1, φ2, λ2 float64) Point {
	var point = Point{}

	φ1 = Deg2Rad(φ1)
	λ1 = Deg2Rad(λ1)
	φ2 = Deg2Rad(φ2)

	Δλ := Deg2Rad(λ2) - λ1

	Bx := math.Cos(φ2) * math.Cos(Δλ)
	By := math.Cos(φ2) * math.Sin(Δλ)

	point.lat = Rad2Deg(math.Atan2(math.Sin(φ1)+math.Sin(φ2), math.Sqrt(math.Pow(math.Cos(φ1)+Bx, 2)+math.Pow(By, 2))))
	point.lon = Rad2Deg(λ1 + math.Atan2(By, math.Cos(φ1)+Bx))

	return point
}
524562
func NewMirrorMakerConfig() *MirrorMakerConfig {
	return &MirrorMakerConfig{
		KeyEncoder:   producer.ByteSerializer,
		ValueEncoder: producer.ByteSerializer,
		KeyDecoder:   &ByteDecoder{},
		ValueDecoder: &ByteDecoder{},
	}
}
997308
func (f *FakeDocker) GetImageEntrypoint(image string) ([]string, error) {
	return f.GetImageEntrypointResult, f.GetImageEntrypointError
}
793213
func (f *Fpdf) point(x, y float64) {
	f.outf("%.2f %.2f m", x*f.k, (f.h-y)*f.k)
}
1055198
func transformPaymentDirect(mctx libkb.MetaContext, acctID stellar1.AccountID, p stellar1.PaymentSummaryDirect, oc OwnAccountLookupCache) (*stellar1.PaymentLocal, error) {
	loc, err := newPaymentLocal(mctx, p.TxID, p.Ctime, p.Amount, p.Asset)
	if err != nil {
		return nil, err
	}

	isSender := p.FromStellar.Eq(acctID)
	isRecipient := p.ToStellar.Eq(acctID)
	switch {
	case isSender && isRecipient:
		loc.Delta = stellar1.BalanceDelta_NONE
	case isSender:
		loc.Delta = stellar1.BalanceDelta_DECREASE
	case isRecipient:
		loc.Delta = stellar1.BalanceDelta_INCREASE
	}

	loc.Worth, _, err = formatWorth(mctx, p.DisplayAmount, p.DisplayCurrency)
	if err != nil {
		return nil, err
	}

	loc.FromAccountID = p.FromStellar
	loc.FromType = stellar1.ParticipantType_STELLAR
	if username, err := lookupUsername(mctx, p.From.Uid); err == nil {
		loc.FromUsername = username
		loc.FromType = stellar1.ParticipantType_KEYBASE
	}

	loc.ToAccountID = &p.ToStellar
	loc.ToType = stellar1.ParticipantType_STELLAR
	if p.To != nil {
		if username, err := lookupUsername(mctx, p.To.Uid); err == nil {
			loc.ToUsername = username
			loc.ToType = stellar1.ParticipantType_KEYBASE
		}
	}

	fillOwnAccounts(mctx, loc, oc)
	switch {
	case loc.FromAccountName != "":
		// we are sender
		loc.WorthAtSendTime, _, err = formatWorthAtSendTime(mctx, p, true)
	case loc.ToAccountName != "":
		// we are recipient
		loc.WorthAtSendTime, _, err = formatWorthAtSendTime(mctx, p, false)
	}
	if err != nil {
		return nil, err
	}

	loc.StatusSimplified = p.TxStatus.ToPaymentStatus()
	loc.StatusDescription = strings.ToLower(loc.StatusSimplified.String())
	loc.StatusDetail = p.TxErrMsg

	loc.Note, loc.NoteErr = decryptNote(mctx, p.TxID, p.NoteB64)

	loc.SourceAmountMax = p.SourceAmountMax
	loc.SourceAmountActual = p.SourceAmountActual
	loc.SourceAsset = p.SourceAsset

	return loc, nil
}
571497
func (tr Matrix) Transform(points []float64) {
	for i, j := 0, 1; j < len(points); i, j = i+2, j+2 {
		x := points[i]
		y := points[j]
		points[i] = x*tr[0] + y*tr[2] + tr[4]
		points[j] = x*tr[1] + y*tr[3] + tr[5]
	}
}
415363
func BuildMirroredAsset(u *url.URL, hash *hashing.Hash) *MirroredAsset {
	baseUrlString := fmt.Sprintf(defaultKopsMirrorBase, kops.Version)
	if !strings.HasSuffix(baseUrlString, "/") {
		baseUrlString += "/"
	}

	a := &MirroredAsset{
		Hash: hash,
	}

	urlString := u.String()
	a.Locations = []string{urlString}

	// Look at mirrors
	if strings.HasPrefix(urlString, baseUrlString) {
		if hash == nil {
			glog.Warningf("not using mirrors for asset %s as it does not have a known hash", u.String())
		} else {
			suffix := strings.TrimPrefix(urlString, baseUrlString)
			// This is under our base url - add our well-known mirrors
			a.Locations = []string{}
			for _, m := range defaultKopsMirrors {
				filename := suffix
				for k, v := range m.Replace {
					filename = strings.Replace(filename, k, v, -1)
				}
				base := fmt.Sprintf(m.URL, kops.Version)
				a.Locations = append(a.Locations, base+filename)
			}
		}
	}

	return a
}
546402
func (c *Callbacks) OnCDOTAUserMsg_MinimapDebugPoint(fn func(*dota.CDOTAUserMsg_MinimapDebugPoint) error) {
	c.onCDOTAUserMsg_MinimapDebugPoint = append(c.onCDOTAUserMsg_MinimapDebugPoint, fn)
}
4177
func deriveClonePoint(src *Point) *Point {
	if src == nil {
		return nil
	}
	dst := new(Point)
	deriveDeepCopy_6(dst, src)
	return dst
}
440610
func (nm *nelderMead) reflect(vertices vertices, midpoint *nmVertex) *nmVertex {
	toScalar := midpoint.subtract(nm.lastVertex(vertices))
	toScalar = toScalar.multiply(alpha)
	toScalar = midpoint.add(toScalar)
	return nm.evaluateWithConstraints(vertices, toScalar)
}
665443
func (b *Button) SizeHint() image.Point {
	if len(b.text) == 0 {
		return b.MinSizeHint()
	}

	var size image.Point
	lines := strings.Split(b.text, "\n")
	for _, line := range lines {
		if w := stringWidth(line); w > size.X {
			size.X = w
		}
	}
	size.Y = len(lines)

	return size
}
32648
func NewMirrorOptions(streams genericclioptions.IOStreams) *MirrorOptions {
	return &MirrorOptions{
		IOStreams:       streams,
		ParallelOptions: imagemanifest.ParallelOptions{MaxPerRegistry: 6},
	}
}
1155906
func NormalizePoint(x []float64) {

	var sum float64
	for i := range x {
		sum += x[i] * x[i]
	}

	mag := math.Sqrt(sum)

	for i := range x {
		if math.IsInf(x[i]/mag, 0) || math.IsNaN(x[i]/mag) {
			// fallback to zero when dividing by 0
			x[i] = 0
			continue
		}

		x[i] /= mag
	}
}