In teracting and Con trolling of Complica ted Action s in Virtua l Exper imen ts L IXin( Education College of Zhejiang NormalUniversity, J inhua 321004, China)Abstract:VRML can sustain dynamic and interactive 3D scenes, but its auto - interaction is not obvious; Java is a high - pow2 ered p rogramming language that can be freely used in 3D scenes and has the advantages of flexibility and strong computing power.Their organic amalgamation achieves the dynamic interaction of 3D virtual space. This article researches on the interacting and controlling methods of comp licated actions in virtual experiments, stresses the methods of interactionswith exterior: the adding of Scrip t nodes in VRML, the communicating system with Java, Java p rogramming in nods and the transferring orders in p roceeding.
In conclusion, the article suggests the virtual physics experiment - detailed examp les of cuttingmagnetic flux lineswith electrical wires.
Key words: virtual experiment; interactive control; VRML; Java
0 引 言
虚拟实验的设计与应用研究是当前实验教学的一个热门话题,但由于虚拟实验实现的固有难度以及各种相关技术的制约,目前所开发的虚拟实验,大多存在交互性弱、沉浸感不强、实验过程由插值动画完成等诸多问题, 没有很好地体现通过“做中学”(Learning Through Doing)来完成实践技能的培养这一实验教学目标[ 1 ] ,不能反映现实实验的本来面目,致使实验效果不甚理想。本文就虚拟实验中复杂运动的交互与控制方法进行了研究, 重点讨论VRML 的外部交互方法:VRML中Scrip t节点的添加、与Java的通信机制、节点中的Java程序以及执行中的调用次序。最后给出了虚拟物理实验———导线切割磁力线的实现结果。实验交互方式完全模拟真实的实验过程,能动态地从场景中获取用户需要的数据,实验结果反馈实时,较好地实现了复杂运动的交互与控制。
在式(1)中: E是感应电动势, B 是磁感应强度,V 是直导线的运动速度, l是直导线的有效切割长度,θ是运动方向与磁感应线的夹角;在式(2)中: R是直导线的电阻, rA 是电流表内阻。根据实验的要求,主要求得电流值I,由此确定指针的偏转角度。一般情况,磁场强度和导线长度为固定值,在使用Java编制具体脚本时,主要考虑速度V和切割夹角θ的变化对电流的影响。