// ShearZ3D creates a homogeneous 3D shear matrix along the Z-axis
191187
func ShearZ3D(shearX, shearY float64) Mat4 {
	return Mat4{1, 0, 0, 0, 0, 1, 0, 0, float64(shearX), float64(shearY), 1, 0, 0, 0, 0, 1}
}
397677
func (a Affine) Shear(x, y float64) Affine {
	d := 1 - x*y
	return a.Mul(Affine{
		+1 / d, -x / d, 0,
		-y / d, +1 / d, 0,
		0, 0, 1,
	})
}
1006855
func (mat *T) Transpose3x3() *T {
	swap(&mat[1][0], &mat[0][1])
	swap(&mat[2][0], &mat[0][2])
	swap(&mat[2][1], &mat[1][2])
	return mat
}
1195812
func Mat4x3FromCols(col0, col1, col2 Vec4) Mat4x3 {
	return Mat4x3{col0[0], col0[1], col0[2], col0[3], col1[0], col1[1], col1[2], col1[3], col2[0], col2[1], col2[2], col2[3]}
}
1202512
func (g *Point) Z() float64 {
	zIndex := g.layout.ZIndex()
	if zIndex == -1 {
		return 0
	}
	return g.flatCoords[zIndex]
}
530949
func (s *ZoneService) NewListDedicatedZonesParams() *ListDedicatedZonesParams {
	p := &ListDedicatedZonesParams{}
	p.p = make(map[string]interface{})
	return p
}
540292
func clz32(x uint32) uint8 {
	var n uint8

	if x >= (1 << 16) {
		if x >= (1 << 24) {
			if x >= (1 << 28) {
				n = 28
			} else {
				n = 24
			}
		} else {
			if x >= (1 << 20) {
				n = 20
			} else {
				n = 16
			}
		}
	} else {
		if x >= (1 << 8) {
			if x >= (1 << 12) {
				n = 12
			} else {
				n = 8
			}
		} else {
			if x >= (1 << 4) {
				n = 4
			} else {
				n = 0
			}
		}
	}
	return clzLookup[x>>n] - n
}
210834
func Rotate3DZ(angle float32) Mat3 {
	//angle = (angle * math.Pi) / 180.0
	sin, cos := float32(math.Sin(float64(angle))), float32(math.Cos(float64(angle)))

	return Mat3{cos, sin, 0, -sin, cos, 0, 0, 0, 1}
}
901611
func (p *TCompactProtocol) zigzagToInt32(n int32) int32 {
	u := uint32(n)
	return int32(u>>1) ^ -(n & 1)
}
1135651
func (client *Client) DescribeZones(args *DescribeZonesArgs) (zones []ZoneType, err error) {

	result := []ZoneType{}

	for {
		response := DescribeZonesResponse{}
		err = client.Invoke("DescribeZones", args, &response)

		if err != nil {
			return result, err
		}

		result = append(result, response.Zones.Zone...)

		nextPage := response.PaginationResult.NextPage()
		if nextPage == nil {
			break
		}
		args.Pagination = *nextPage
	}

	return result, nil
}
562770
func faceXYZToUV(face int, p Point) (u, v float64, ok bool) {
	switch face {
	case 0:
		if p.X <= 0 {
			return 0, 0, false
		}
	case 1:
		if p.Y <= 0 {
			return 0, 0, false
		}
	case 2:
		if p.Z <= 0 {
			return 0, 0, false
		}
	case 3:
		if p.X >= 0 {
			return 0, 0, false
		}
	case 4:
		if p.Y >= 0 {
			return 0, 0, false
		}
	default:
		if p.Z >= 0 {
			return 0, 0, false
		}
	}

	u, v = validFaceXYZToUV(face, p.Vector)
	return u, v, true
}
50060
func (s *TransformS3DataSource) SetS3DataType(v string) *TransformS3DataSource {
	s.S3DataType = &v
	return s
}
104452
func (mat *T) AssignZRotation(angle float64) *T {
	cosine := math.Cos(angle)
	sine := math.Sin(angle)

	mat[0][0] = cosine
	mat[1][0] = -sine
	mat[2][0] = 0
	mat[3][0] = 0

	mat[0][1] = sine
	mat[1][1] = cosine
	mat[2][1] = 0
	mat[3][1] = 0

	mat[0][2] = 0
	mat[1][2] = 0
	mat[2][2] = 1
	mat[3][2] = 0

	mat[0][3] = 0
	mat[1][3] = 0
	mat[2][3] = 0
	mat[3][3] = 1

	return mat
}
86102
func rgbToXyz(r, g, b uint32) (float64, float64, float64) {
	normalizedR := float64(r) / 0xFFFF
	normalizedG := float64(g) / 0xFFFF
	normalizedB := float64(b) / 0xFFFF

	if normalizedR > 0.04045 {
		normalizedR = math.Pow(((normalizedR + 0.055) / 1.055), 2.4)
	} else {
		normalizedR = normalizedR / 12.92
	}

	if normalizedG > 0.04045 {
		normalizedG = math.Pow(((normalizedG + 0.055) / 1.055), 2.4)
	} else {
		normalizedG = normalizedG / 12.92
	}

	if normalizedB > 0.04045 {
		normalizedB = math.Pow(((normalizedB + 0.055) / 1.055), 2.4)
	} else {
		normalizedB = normalizedB / 12.92
	}

	normalizedR *= 100
	normalizedG *= 100
	normalizedB *= 100

	x := normalizedR*0.4124 + normalizedG*0.3576 + normalizedB*0.1805
	y := normalizedR*0.2126 + normalizedG*0.7152 + normalizedB*0.0722
	z := normalizedR*0.0193 + normalizedG*0.1192 + normalizedB*0.9505

	return x, y, z
}
472914
func Scale2D(scaleX, scaleY float32) Mat3 {
	return Mat3{float32(scaleX), 0, 0, 0, float32(scaleY), 0, 0, 0, 1}
}
689226
func symmetricDifference(hostIDs []string, lbInstances []*cloudstack.VirtualMachine) ([]string, []string) {
	new := make(map[string]bool)
	for _, hostID := range hostIDs {
		new[hostID] = true
	}

	var remove []string
	for _, instance := range lbInstances {
		if new[instance.Id] {
			delete(new, instance.Id)
			continue
		}

		remove = append(remove, instance.Id)
	}

	var assign []string
	for hostID := range new {
		assign = append(assign, hostID)
	}

	return assign, remove
}
622846
func (curve *KoblitzCurve) doubleJacobian(x1, y1, z1, x3, y3, z3 *fieldVal) {
	// Doubling a point at infinity is still infinity.
	if y1.IsZero() || z1.IsZero() {
		x3.SetInt(0)
		y3.SetInt(0)
		z3.SetInt(0)
		return
	}

	// Slightly faster point doubling can be achieved when the z value is 1
	// by avoiding the multiplication on the z value.  This section calls
	// a point doubling function which is accelerated by using that
	// assumption when possible.
	if z1.Normalize().Equals(fieldOne) {
		curve.doubleZ1EqualsOne(x1, y1, x3, y3, z3)
		return
	}

	// Fall back to generic point doubling which works with arbitrary z
	// values.
	curve.doubleGeneric(x1, y1, z1, x3, y3, z3)
}