         }
     }
     
-    private func _setTransform (transform: Matrix4) {
+    func _setTransform (transform: Matrix4) {
         let position = positionWC
         let up = upWC
         let direction = directionWC

        let clampPitch = Math.clamp(pitch, min: -M_PI_2, max: M_PI_2)
        let clampHeading = Math.zeroToTwoPi(heading) - M_PI_2
        
        let pitchQuat = Quaternion(fromAxis: Cartesian3.unitY, angle: -clampPitch)
        let headingQuat = Quaternion(fromAxis: Cartesian3.unitZ, angle: -clampHeading)
        let rotQuat = pitchQuat.multiply(headingQuat)
        let rotMatrix = Matrix3(fromQuaternion: rotQuat)
        
        return rotMatrix.multiplyByVector(Cartesian3.unitX).negate().multiplyByScalar(range)
    }

            _setTransform(endTransform)
        }
        
        var convert = true
        var destination = destination ?? .cartesian(positionWC)
        
        if case let Destination.rectangle(rectangle) = destination {
            destination = Destination.cartesian(getRectangleCameraCoordinates(rectangle))
            convert = false
        }
        var orientation = orientation
        if orientation != nil {
            if case Orientation.directionUp(direction: _, up: _) = orientation! {
                orientation = directionUpToHeadingPitchRoll(destination.cartesian!, orientation: orientation!)
            }
        }
        
        var heading = 0.0
        var pitch = -M_PI_2
        var roll = 0.0
        
        if let orientation = orientation {
            if case let Orientation.headingPitchRoll(headingIn, pitchIn, rollIn) = orientation {
                heading = headingIn
                pitch = pitchIn
                roll = rollIn
            }
        }

        if _mode == .Scene3D {
            setView3D(destination.cartesian!, heading: heading, pitch: pitch, roll: roll)
        } else if _mode == SceneMode.Scene2D {
            setView2D(destination.cartesian!, convert: convert)
        } else {
            setViewCV(destination.cartesian!, heading: heading, pitch: pitch, roll: roll, convert: convert)
        }
    }
    
