func (r *Rotation) Apply(point geometry.Point) (newPoint geometry.Point) {
	if r == nil {
		return point
	}

	if r.Degrees%90 != 0 {
		// no need to handle non-90 degree rotations for this problem, let's not
		// bother with error handling here
		panic("rotations that are not multiples of 90 are not supported")
	}

	switch (r.Degrees + 360) % 360 {
	default: // 0
		return point
	case 90:
		return geometry.NewInts(point.MustGet(1).Int(), -point.MustGet(0).Int())
	case 180:
		return geometry.NewInts(-point.MustGet(0).Int(), -point.MustGet(1).Int())
	case 270:
		return geometry.NewInts(-point.MustGet(1).Int(), point.MustGet(0).Int())
	}
}
// Apply rotates a point around the global origin (0,0). Only right angle rotations
// are supported (i.e. rotations that are multiples of 90 degrees).
Apply rotates a point around the global origin (0,0). Only right angle rotations
are supported .
// Apply rotates a point around the global origin ( 0 0 ) . Only right angle rotations // are supported ( i . e . rotations that are multiples of 90 degrees ) .
func (r *Rotation) Apply(point geometry.Point) (newPoint geometry.Point) {
	if r == nil {
		return point
	}
	if r.Degrees%90 != 0 {
		panic("rotations that are not multiples of 90 are not supported")
	}
	switch (r.Degrees + 360) % 360 {
	default: 
		return point
	case 90:
		return geometry.NewInts(point.MustGet(1).Int(), -point.MustGet(0).Int())
	case 180:
		return geometry.NewInts(-point.MustGet(0).Int(), -point.MustGet(1).Int())
	case 270:
		return geometry.NewInts(-point.MustGet(1).Int(), point.MustGet(0).Int())
	}
}
func ( r * Rotation ) Apply ( point geometry . Point ) ( newPoint geometry . Point ) { if r == nil { return point } if r . Degrees % 90 != 0 { panic ( " " ) } switch ( r . Degrees + 360 ) % 360 { default : return point case 90 : return geometry . NewInts ( point . MustGet ( 1 ) . Int ( ) , - point . MustGet ( 0 ) . Int ( ) ) case 180 : return geometry . NewInts ( - point . MustGet ( 0 ) . Int ( ) , - point . MustGet ( 1 ) . Int ( ) ) case 270 : return geometry . NewInts ( - point . MustGet ( 1 ) . Int ( ) , point . MustGet ( 0 ) . Int ( ) ) } }
Apply rotates a point around the global origin (0,0).
Apply rotates a point around the global origin ( 0 0 ) .
// no need to handle non-90 degree rotations for this problem, let's not // bother with error handling here // 0