【问题标题】:scaling object to match field of view缩放对象以匹配视野
【发布时间】:2013-01-23 18:35:44
【问题描述】:

我在 Flash (as3) 中的专有全景查看器应用程序顶部覆盖了一些可点击的热点,我需要确保热点根据用户放大/缩小时不断变化的视野进行缩放,但是我不确定要使用什么公式。

我将最大和最小视野分别设置为 90 和 25。我得到了一些关于如何计算图标比例的建议:

来自全景软件的制造商:

Scale => 1/tan(FoV)

这似乎对我不起作用。并且:

scalar += (ZOOM_SCALE_UPPER - ZOOM_SCALE_LOWER) * ( ZOOM_LIMIT_OUT - tempFOV   )/( ZOOM_LIMIT_OUT-ZOOM_LIMIT_IN) ;

hotspot.scaleX = hotspot.scaleY = scalar;

让我靠近,但在某些时候热点停止缩放,即使全景图继续缩放。我以为我可以这样做:

diffFOV = previousFOV - currentFOV.
hotspot.scale = currentScale*(1-diffFov)

但这也不完全正确。一切都变得太大或太小。

有什么想法吗?

【问题讨论】:

    标签: actionscript-3 flash trigonometry image-scaling fieldofview


    【解决方案1】:

    你可能想多了。

    //assume we change the scale
    var NEW_SCALE:Number = currentScale*(1-(previousFOV-currentFOV));
    
    //1. change the scale of the parent containing both the view and the hotspots
    viewSprite.scale = NEW_SCALE;
    //this way the hotspot and the panorama will scale together
    
    //2. if they are not in the same parent... then set them both to the same view
    hotspot.scale = panorama.scale;
    

    如果它们没有在它们的中心点上注册,您唯一可能需要做的就是重新定位。

    【讨论】:

    • 嘿,你说得对,我想太多了。我需要首先计算 FOV 的百分比变化:(lastFOV-curFieldOfView)/lastFOV;) 然后将相同的百分比变化应用于剪辑的比例。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-10
    • 1970-01-01
    • 2020-11-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多