private VIS.WorkSpace.Geometry GetDestinationGeometry( VLUnityCameraHelper.FlipCoordinateSystemHandedness fcsHandedness) { VLGeometry creator = this.destinationGeometry.GetComponent <VLGeometry>(); // check if object has a geometry component if (creator != null) { return(CreateVLGeometry(creator, fcsHandedness)); } else { // if target object has no geometry component -> use center point which is stored in // destinationPoints[0] VIS.WorkSpace.Transform trans = VLUnityCameraHelper.CreateLocalVLTransform( this.destinationGeometry, fcsHandedness); Vector3[] destination = GetDestinationVertices(); trans.t = new float[3] { destination[0].x, destination[0].y, destination[0].z }; return(new VIS.WorkSpace.Plane( 0, 0, 1, trans)); } }
private static VIS.WorkSpace.Geometry CreateVLGeometry(VLGeometry creator, VLUnityCameraHelper.FlipCoordinateSystemHandedness fcsHandedness) { return(creator.CreateVLGeometry(VLUnityCameraHelper.CreateLocalVLTransform( creator.gameObject, fcsHandedness))); }
private static VLModelTrackerCommands.SetInitPoseCmd.Param CameraToInitParam( Camera camera, Matrix4x4 offset, VLUnityCameraHelper.FlipCoordinateSystemHandedness flipCSHandedness = VLUnityCameraHelper.FlipCoordinateSystemHandedness.Automatically) { Vector4 t; Quaternion q; VLUnityCameraHelper.CameraToVLPose(camera, offset, out t, out q, flipCSHandedness); return(new VLModelTrackerCommands.SetInitPoseCmd.Param( t.x, t.y, t.z, q.x, q.y, q.z, q.w)); }
private void UpdateInitPose(Camera cam, VLUnityCameraHelper.FlipCoordinateSystemHandedness flipCSHandedness) { // Get the VisionLib transformation from the Unity camera VLUnityCameraHelper.CameraToVLPose( cam, this.rotCamera, out this.t, out this.q, flipCSHandedness); // Convert the transformation into JSON this.initPose.Set(t, q); this.initPoseString = VLJsonUtility.ToJson(this.initPose, this.prettyPrint); }
/// <summary> /// Creates a VLWorkSpace.Definition from this VLWorkSpace. /// </summary> /// <returns>VLWorkSpace.Definition described by this class</returns> public VIS.WorkSpace.Definition GetWorkSpaceDefinition(bool useCameraRotation) { VLUnityCameraHelper.FlipCoordinateSystemHandedness fcsHandedness = VLUnityCameraHelper.FlipCoordinateSystemHandedness.Automatically; if (InitWorkerReference()) { fcsHandedness = this.workerBehaviour.flipCoordinateSystemHandedness; } VIS.WorkSpace.Definition currentWorkSpaceDef = new VIS.WorkSpace.Definition( new VIS.WorkSpace.Transform( this.transform.position, this.transform.rotation), VLUnityCameraHelper.UnityVectorToVLVector(this.upVector, fcsHandedness), useCameraRotation ? defaultRotationRange : 0.0f, defaultRotationStep); currentWorkSpaceDef.origin = GetSourceGeometry(fcsHandedness); currentWorkSpaceDef.destination = GetDestinationGeometry(fcsHandedness); return(currentWorkSpaceDef); }
private VIS.WorkSpace.Geometry GetSourceGeometry( VLUnityCameraHelper.FlipCoordinateSystemHandedness fcsHandedness) { return(CreateVLGeometry(this.sourceGeometry, fcsHandedness)); }