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: main.go
    path of file: ./repos/imagick/examples/affine
    
    the code of the file until where you have to start completion: // Port of http://members.shaw.ca/el.supremo/MagickWand/affine.htm to Go
package main

import (
	"math"

	"gopkg.in/gographics/imagick.v2/imagick"
)

func DegreesToRadians(deg float64) (rad float64) {
	rad = deg * math.Pi / 180.0
	return
}

func RadiansToDegrees(rad float64) (deg float64) {
	deg = rad * 180.0 / math.Pi
	return
}

// Each of these affine functions assumes that the input arrays
// have been correctly defined to be arrays of 6 (or more)
    
func example4() {
	imagick.Initialize()
	defer imagick.Terminate()

	t1 := make([]float64, 6)
	r := make([]float64, 6)
	t2 := make([]float64, 6)
	temp := make([]float64, 6)
	result := make([]float64, 6)

	// Dimensions of the final rectangle
	w := uint(600)
	h := uint(100)
	// angle of clockwise rotation
	theta := 15.0 // degrees
	// Convert theta to radians
	rad_theta := DegreesToRadians(theta)
	// Compute the dimensions of the rectangular gradient
	gw := (uint)(float64(w)*math.Cos(rad_theta) + float64(h)*math.Sin(rad_theta) + 0.5)
	gh := (uint)(float64(w)*math.Sin(rad_theta) + float64(h)*math.Cos(rad_theta) + 0.5)
	// Don't let the rotation make the gradient rectangle any smaller
	// than the required output
	if gw < w {
		gw = w
	}
	if gh < h {
		gh = h
	}

	mw := imagick.NewMagickWand()
	mw.SetSize(gw, gh)
	mw.ReadImage("gradient:white-black")

	// Initialize the required affines
	// translate centre of gradient to origin
	set_translate_affine(t1, float64(-gw)/2.0, float64(-gh)/2.0)
	// rotate clockwise by theta degrees
	set_rotate_affine(r, theta)
	// translate back again
	set_translate_affine(t2, float64(gw)/2.0, float64(gh)/2.0)

	// Now multiply the affine sequences
	// temp = t1*r
	affine_multiply(temp, t1, r)
	// result = temp*t2
	affine_multiply(result, temp, t2)

	mw.DistortImage(imagick.DISTORTION_AFFINE_PROJECTION, result, false)
	// Get the size of the distorted image and crop out the middle

	nw := mw.GetImageWidth()
	nh := mw.GetImageHeight()
	mw.CropImage(w, h, int((nw-w)/2), int((nh-h)/2))
	mw.WriteImage("rotgrad_2.png")
}