⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 viewinfo.java

📁 JAVA3D矩陈的相关类
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
		leftEye.set(leftEyeInHead) ;		headToHeadTracker.transform(leftEye) ;		ci.si.headTrackerToLeftPlate.transform(leftEye,						       ci.eyeInPlate) ;		break ;	    case View.RIGHT_EYE_VIEW:		rightEye.set(rightEyeInHead) ;		headToHeadTracker.transform(rightEye) ;		ci.si.headTrackerToRightPlate.transform(rightEye,							ci.eyeInPlate) ;		break ;	    case View.CYCLOPEAN_EYE_VIEW:	    default:		throw new IllegalStateException		    ("Illegal monoscopic view policy for 2-channel HMD") ;	    }	}	v3d.set(ci.eyeInPlate) ;	ci.eyeToPlate.set(v3d) ;    }    private void getEyesTracked(CanvasInfo ci) {	leftEye.set(leftEyeInHead) ;	rightEye.set(rightEyeInHead) ;	headToTrackerBase.transform(leftEye) ;	headToTrackerBase.transform(rightEye) ;	if (coeCentering) {	    // Coexistence and tracker base coordinates are the same.	    // Centering is normally turned off for tracking.	    getCoexistenceToImagePlate(ci) ;	    ci.coeToPlate.transform(leftEye) ;	    ci.coeToRightPlate.transform(rightEye) ;	}	else {	    // The normal policy for head tracking.	    ci.si.trackerBaseToPlate.transform(leftEye) ;	    ci.si.trackerBaseToPlate.transform(rightEye) ;	}	setEyeScreenRelative(ci, leftEye, rightEye) ;    }    private void getEyesFixedScreen(CanvasInfo ci) {	switch (eyePolicy) {	case View.RELATIVE_TO_FIELD_OF_VIEW:	    double z = ci.getFieldOfViewOffset() ;	    setEyeWindowRelative(ci, z, z) ;	    break ;	case View.RELATIVE_TO_WINDOW:	    setEyeWindowRelative(ci,				 ci.leftManualEyeInPlate.z,				 ci.rightManualEyeInPlate.z) ;	    break ;	case View.RELATIVE_TO_SCREEN:	    setEyeScreenRelative(ci, 				 ci.leftManualEyeInPlate,				 ci.rightManualEyeInPlate) ;	    break ;	case View.RELATIVE_TO_COEXISTENCE:	    view.getLeftManualEyeInCoexistence(leftEye) ;	    view.getRightManualEyeInCoexistence(rightEye) ;	    getCoexistenceToImagePlate(ci) ;	    ci.coeToPlate.transform(leftEye) ;	    ci.coeToRightPlate.transform(rightEye) ;	    setEyeScreenRelative(ci, leftEye, rightEye) ;	    break ;	}    }    private void setEyeWindowRelative(CanvasInfo ci,				      double leftZ, double rightZ) {	// Eye position X is offset from the window center.	double centerX = (ci.canvasX + (ci.canvasWidth / 2.0)) ;	leftEye.x  = centerX + leftEyeInHead.x ;	rightEye.x = centerX + rightEyeInHead.x ;	// Eye position Y is always the canvas center.	leftEye.y = rightEye.y = ci.canvasY + (ci.canvasHeight / 2.0) ;		// Eye positions Z are as given.	leftEye.z = leftZ ;	rightEye.z = rightZ ;	setEyeScreenRelative(ci, leftEye, rightEye) ;    }    private void setEyeScreenRelative(CanvasInfo ci,				      Point3d leftEye, Point3d rightEye) {	if (ci.useStereo) {	    ci.eyeInPlate.set(leftEye) ;	    ci.rightEyeInPlate.set(rightEye) ;	    if (ci.rightEyeToPlate == null)		ci.rightEyeToPlate = new Transform3D() ;	    v3d.set(ci.rightEyeInPlate) ;	    ci.rightEyeToPlate.set(v3d) ;	}	else {	    switch (ci.monoscopicPolicy) {	    case View.CYCLOPEAN_EYE_VIEW:		ci.eyeInPlate.set((leftEye.x + rightEye.x) / 2.0,				  (leftEye.y + rightEye.y) / 2.0,				  (leftEye.z + rightEye.z) / 2.0) ;		break ;	    case View.LEFT_EYE_VIEW:		ci.eyeInPlate.set(leftEye) ;		break ;	    case View.RIGHT_EYE_VIEW:		ci.eyeInPlate.set(rightEye) ;		break ;	    }	}	v3d.set(ci.eyeInPlate) ;	ci.eyeToPlate.set(v3d) ;    }    /**     * Gets the current transforms from eye coordinates to view platform     * coordinates and copies them into the given Transform3Ds.<p>     *      * With a monoscopic canvas the eye transform is copied to the first     * argument and the second argument is not used.  For a stereo canvas the     * first argument receives the left eye transform, and if the second     * argument is non-null it receives the right eye transform.<p>     *     * This method requires a Canvas3D.	 When using a head mounted display,     * head tracking with fixed screens, or a window eyepoint policy of     * <code>RELATIVE_TO_COEXISTENCE</code>, then the transforms returned may     * be different for each canvas if stereo is not in use and they have     * different monoscopic view policies.  They may additionally differ in     * scale across canvases with the <code>PHYSICAL_WORLD</code> window     * resize policy or the <code>SCALE_SCREEN_SIZE</code> screen scale     * policy, which alter the scale depending upon the width of the canvas or     * the width of the screen respectively.<p>     *      * With window eyepoint policies of <code>RELATIVE_TO_FIELD_OF_VIEW</code>,     * <code>RELATIVE_TO_SCREEN</code>, or <code>RELATIVE_TO_WINDOW</code>,     * then the transforms returned may differ across canvases due to     * the following additional conditions:<p><ul>     *      * <li>The window eyepoint policy is <code>RELATIVE_TO_WINDOW</code> or     *	   <code>RELATIVE_TO_SCREEN</code>, in which case the manual eye     *	   position in image plate can be set differently for each     *	   canvas.</li><p>     *     * <li>The window eyepoint policy is <code>RELATIVE_TO_FIELD_OF_VIEW</code>     *	   and the view attach policy is <code>NOMINAL_SCREEN</code>, which     *	   decouples the view platform's canvas Z offset from the eyepoint's     *	   canvas Z offset.</li><p>      *     * <li>The eyepoint X and Y coordinates are centered in the canvas with a     *	   window eyepoint policy of <code>RELATIVE_TO_FIELD_OF_VIEW</code>     *	   or <code>RELATIVE_TO_WINDOW</code>, and a window movement policy     *	   of <code>VIRTUAL_WORLD</code> centers the view platform's X and Y     *	   coordinates to the middle of the screen.</li><p>     *     * <li>Coexistence centering is set false, which allows each canvas and     *	   screen to have a different position with respect to coexistence     *	   coordinates.</li></ul>     *     * @param c3d the Canvas3D to use     * @param e2vpl the Transform3D to receive the left transform     * @param e2vpr the Transform3D to receive the right transform, or null     */    public void getEyeToViewPlatform(Canvas3D c3d, 				     Transform3D e2vpl, Transform3D e2vpr) {	CanvasInfo ci = updateCache(c3d, "getEyeToViewPlatform", false) ;	getEyeToViewPlatform(ci) ;	e2vpl.set(ci.eyeToViewPlatform) ;	if (ci.useStereo && e2vpr != null)	    e2vpr.set(ci.rightEyeToViewPlatform) ;    }    private void getEyeToViewPlatform(CanvasInfo ci) {	if (ci.updateEyeToViewPlatform) {	    if (verbose) System.err.println("updating EyeToViewPlatform") ;	    if (ci.eyeToViewPlatform == null)		ci.eyeToViewPlatform = new Transform3D() ;	    getEyeToImagePlate(ci) ;	    getImagePlateToViewPlatform(ci) ;	    ci.eyeToViewPlatform.mul(ci.plateToViewPlatform, ci.eyeToPlate) ;	    if (ci.useStereo) {		if (ci.rightEyeToViewPlatform == null) 		    ci.rightEyeToViewPlatform = new Transform3D() ;		ci.rightEyeToViewPlatform.mul		    (ci.rightPlateToViewPlatform, ci.rightEyeToPlate) ;	    }	    ci.updateEyeToViewPlatform = false ;	    if (verbose) t3dPrint(ci.eyeToViewPlatform, "eyeToVp") ;	}    }    /**     * Gets the current transforms from view platform coordinates to eye     * coordinates and copies them into the given Transform3Ds.<p>     *      * With a monoscopic canvas the eye transform is copied to the first     * argument and the second argument is not used.  For a stereo canvas the     * first argument receives the left eye transform, and if the second     * argument is non-null it receives the right eye transform.<p>     *     * This method requires a Canvas3D.	 The transforms returned may differ     * across canvases for all the same reasons discussed in the description     * of <code>getEyeToViewPlatform</code>.     *      * @param c3d the Canvas3D to use     * @param vp2el the Transform3D to receive the left transform     * @param vp2er the Transform3D to receive the right transform, or null     * @see #getEyeToViewPlatform     *       getEyeToViewPlatform(Canvas3D, Transform3D, Transform3D)     */    public void getViewPlatformToEye(Canvas3D c3d, 				     Transform3D vp2el, Transform3D vp2er) {	CanvasInfo ci = updateCache(c3d, "getViewPlatformToEye", false) ;	getViewPlatformToEye(ci) ;	vp2el.set(ci.viewPlatformToEye) ;	if (ci.useStereo && vp2er != null)	    vp2er.set(ci.viewPlatformToRightEye) ;    }    private void getViewPlatformToEye(CanvasInfo ci) {	if (ci.updateViewPlatformToEye) {	    if (verbose) System.err.println("updating ViewPlatformToEye") ;	    if (ci.viewPlatformToEye == null)		ci.viewPlatformToEye = new Transform3D() ;	    getEyeToViewPlatform(ci) ;	    ci.viewPlatformToEye.invert(ci.eyeToViewPlatform) ;	    if (ci.useStereo) {		if (ci.viewPlatformToRightEye == null)		    ci.viewPlatformToRightEye = new Transform3D() ;		ci.viewPlatformToRightEye.invert(ci.rightEyeToViewPlatform) ;	    }	    ci.updateViewPlatformToEye = false ;	}    }    /**     * Gets the current transforms from eye coordinates to virtual world     * coordinates and copies them into the given Transform3Ds.<p>     *      * With a monoscopic canvas the eye transform is copied to the first     * argument and the second argument is not used.  For a stereo canvas the     * first argument receives the left eye transform, and if the second     * argument is non-null it receives the right eye transform.<p>     *     * The View must be attached to a ViewPlatform which is part of a live     * scene graph, and the ViewPlatform node must have its     * <code>ALLOW_LOCAL_TO_VWORLD_READ</code> capability set.<p>     *     * This method requires a Canvas3D.	 The transforms returned may differ     * across canvases for all the same reasons discussed in the description     * of <code>getEyeToViewPlatform</code>.       *     * @param c3d the Canvas3D to use     * @param e2vwl the Transform3D to receive the left transform     * @param e2vwr the Transform3D to receive the right transform, or null     * @see #getEyeToViewPlatform     *       getEyeToViewPlatform(Canvas3D, Transform3D, Transform3D)     */    public void getEyeToVworld(Canvas3D c3d,			       Transform3D e2vwl, Transform3D e2vwr) {	CanvasInfo ci = updateCache(c3d, "getEyeToVworld", true) ;	getEyeToVworld(ci) ;	e2vwl.set(ci.eyeToVworld) ;	if (ci.useStereo && e2vwr != null)	    e2vwr.set(ci.rightEyeToVworld) ;    }    private void getEyeToVworld(CanvasInfo ci) {	if (ci.updateEyeToVworld) {	    if (verbose) System.err.println("updating EyeToVworld") ;	    if (ci.eyeToVworld == null)		ci.eyeToVworld = new Transform3D() ;	    getEyeToViewPlatform(ci) ;	    ci.eyeToVworld.mul		(vpi.viewPlatformToVworld, ci.eyeToViewPlatform) ;	    if (ci.useStereo) {		if (ci.rightEyeToVworld == null)		    ci.rightEyeToVworld = new Transform3D() ;		ci.rightEyeToVworld.mul		    (vpi.viewPlatformToVworld, ci.rightEyeToViewPlatform) ;	    }	    ci.updateEyeToVworld = false ;	}    }    /**     * Gets the transforms from eye coordinates to clipping coordinates     * and copies them into the given Transform3Ds.  These transforms take     * a viewing volume bounded by the physical canvas edges and the     * physical front and back clip planes and project it into a range     * bound to [-1.0 .. +1.0] on each of the X, Y, and Z axes.	 If a     * perspective projection has been specified then the physical image     * plate eye location defines the apex of a viewing frustum;     * otherwise, the orientation of the image plate determines the     * direction of a parallel projection.<p>     *      * With a monoscopic canvas the projection transform is copied to the

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -