// ApplyForce returns the result of applying the force from the direction of the
// other coordinate.
197672
func (c *Coordinate) ApplyForce(config *Config, force float64, other *Coordinate) *Coordinate {
	if !c.IsCompatibleWith(other) {
		panic(DimensionalityConflictError{})
	}

	ret := c.Clone()
	unit, mag := unitVectorAt(c.Vec, other.Vec)
	ret.Vec = add(ret.Vec, mul(unit, force))
	if mag > zeroThreshold {
		ret.Height = (ret.Height+other.Height)*force/mag + ret.Height
		ret.Height = math.Max(ret.Height, config.HeightMin)
	}
	return ret
}
707968
func (w *Waiter) ApplyOptions(opts ...WaiterOption) {
	for _, fn := range opts {
		fn(w)
	}
}
445483
func Apply(img image.Image, fn func(color.RGBA) color.RGBA) *image.RGBA {
	bounds := img.Bounds()
	dst := clone.AsRGBA(img)
	w, h := bounds.Dx(), bounds.Dy()

	parallel.Line(h, func(start, end int) {
		for y := start; y < end; y++ {
			for x := 0; x < w; x++ {
				dstPos := y*dst.Stride + x*4

				c := color.RGBA{}

				c.R = dst.Pix[dstPos+0]
				c.G = dst.Pix[dstPos+1]
				c.B = dst.Pix[dstPos+2]
				c.A = dst.Pix[dstPos+3]

				c = fn(c)

				dst.Pix[dstPos+0] = c.R
				dst.Pix[dstPos+1] = c.G
				dst.Pix[dstPos+2] = c.B
				dst.Pix[dstPos+3] = c.A
			}
		}
	})

	return dst
}
1258437
func (s *CancelJobInput) SetForce(v bool) *CancelJobInput {
	s.Force = &v
	return s
}
907156
func (s *BatchModifyClusterSnapshotsInput) SetForce(v bool) *BatchModifyClusterSnapshotsInput {
	s.Force = &v
	return s
}
593016
func (s *DeleteTaskSetInput) SetForce(v bool) *DeleteTaskSetInput {
	s.Force = &v
	return s
}
423049
func (st *State) ApplyOperation(op ModelOperation) error {
	err := st.db().Run(op.Build)
	return op.Done(err)
}
1302292
func (f StoreOpt) Apply(store *Store) error {
	if f != nil {
		return f(store)
	}
	return nil
}
835699
func (s *DeleteLoadBalancerTlsCertificateInput) SetForce(v bool) *DeleteLoadBalancerTlsCertificateInput {
	s.Force = &v
	return s
}
1098026
func (a *Attribute) Apply(e *Element) {
	if e.allowAttributes {
		e.attrs = append(e.attrs, a)
	}
}
174057
func (s *DeleteServiceInput) SetForce(v bool) *DeleteServiceInput {
	s.Force = &v
	return s
}
943393
func (q *Query) Apply(fn func(*Query) (*Query, error)) *Query {
	qq, err := fn(q)
	if err != nil {
		q.err(err)
		return q
	}
	return qq
}
1365123
func WithForce(ctx context.Context, force bool) context.Context {
	return context.WithValue(ctx, ctxKeyForce, force)
}
324420
func (arb *Arbiter) applyImpulse() {
	a := arb.ShapeA.Body
	b := arb.ShapeB.Body
	vr := vect.Vect{}

	for _, con := range arb.Contacts {
		n := con.n
		r1 := con.r1
		r2 := con.r2

		vr.X = (-r2.Y*b.w + b.v.X) - (-r1.Y*a.w + a.v.X)
		vr.Y = (r2.X*b.w + b.v.Y) - (r1.X*a.w + a.v.Y)

		// Calculate and clamp the bias impulse.
		jbnOld := con.jBias
		con.jBias = jbnOld + (con.bias-(((((-r2.Y*b.w_bias)+b.v_bias.X)-((-r1.Y*a.w_bias)+a.v_bias.X))*n.X)+((((r2.X*b.w_bias)+b.v_bias.Y)-((r1.X*a.w_bias)+a.v_bias.Y))*n.Y)))*con.nMass
		if 0 > con.jBias {
			con.jBias = 0
		}

		// Calculate and clamp the normal impulse.
		jnOld := con.jnAcc
		con.jnAcc = jnOld - (con.bounce+(vr.X*n.X)+(vr.Y*n.Y))*con.nMass
		if 0 > con.jnAcc {
			con.jnAcc = 0
		}

		// Calculate and clamp the friction impulse.
		jtMax := arb.u * con.jnAcc
		jtOld := con.jtAcc
		con.jtAcc = jtOld - (((vr.X+arb.Surface_vr.X)*-n.Y)+((vr.Y+arb.Surface_vr.Y)*n.X))*con.tMass
		if con.jtAcc > jtMax {
			con.jtAcc = jtMax
		} else if con.jtAcc < -jtMax {
			con.jtAcc = -jtMax
		}

		jbnOld = (con.jBias - jbnOld)
		vr.X = n.X * jbnOld
		vr.Y = n.Y * jbnOld

		a.v_bias.X = (-vr.X * a.m_inv) + a.v_bias.X
		a.v_bias.Y = (-vr.Y * a.m_inv) + a.v_bias.Y
		a.w_bias += a.i_inv * ((r1.X * -vr.Y) - (r1.Y * -vr.X))

		b.v_bias.X = (vr.X * b.m_inv) + b.v_bias.X
		b.v_bias.Y = (vr.Y * b.m_inv) + b.v_bias.Y
		b.w_bias += b.i_inv * ((r2.X * vr.Y) - (r2.Y * vr.X))

		jnOld = con.jnAcc - jnOld
		jtOld = con.jtAcc - jtOld

		vr.X = (n.X * jnOld) - (n.Y * jtOld)
		vr.Y = (n.X * jtOld) + (n.Y * jnOld)

		a.v.X = (-vr.X * a.m_inv) + a.v.X
		a.v.Y = (-vr.Y * a.m_inv) + a.v.Y
		a.w += a.i_inv * ((r1.X * -vr.Y) - (r1.Y * -vr.X))

		b.v.X = (vr.X * b.m_inv) + b.v.X
		b.v.Y = (vr.Y * b.m_inv) + b.v.Y

		b.w += b.i_inv * ((r2.X * vr.Y) - (r2.Y * vr.X))
	}
}
734723
func (cli *DockerCli) Apply(ops ...DockerCliOption) error {
	for _, op := range ops {
		if err := op(cli); err != nil {
			return err
		}
	}
	return nil
}
882719
func (c *configuration) apply(t transition) {
	logf("Applying %v", t)
	w1 := int(c.stackValue(1))
	w2 := int(c.stackValue(0))

	if t.Move == Left {
		c.AddArc(w2, w1, t.DependencyType)
		c.removeSecondTopStack()
	} else if t.Move == Right {
		c.AddArc(w1, w2, t.DependencyType)
		c.removeTopStack()
	} else {
		c.shift()
	}
}
286910
func (g *Git) Apply(patch string) *command.Model {
	return g.command("apply", "--index", patch)
}