Location: Netherlands
Occupation: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer
: https://pame.virtualtuur.comThis post has been edited 1 times, last edit by "Tuur" (May 10th 2022, 1:59pm)
Location: Netherlands
Occupation: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer
: https://pame.virtualtuur.comLocation: Netherlands
Occupation: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer
: https://pame.virtualtuur.comPerhaps by establishing a circumference with a radius equal to the distance between the center and the farthest point of the hotspot and then calculate if that point is inside the screen... Not perfect either, but it would be closer to the solution.this method is not perfect tough...
it can only detect if a hotspot origin is in the visible stage
but a large hotspot may be partially visible, even if its origin is outside the visible stage
This post has been edited 1 times, last edit by "Fernando" (May 12th 2022, 6:13pm)
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 |
<settings transparent_angle="45"/>
<events name="transparent_active" keep="true" onviewchanged="transparent_active"/>
<action name="transparent_active" scope="local">
getlooktodistance(current_angle, hotspot[logo].ath, hotspot[logo].atv);
calc(alpha_hs, 1 - current_angle /settings.transparent_angle );
clamp(alpha_hs, 0, get(settings.transparent_angle));
copy(hotspot[logo].alpha, alpha_hs);
</action>
|
Perhaps by establishing a circumference with a radius equal to the distance between the center and the farthest point of the hotspot and then calculate if that point is inside the screen... Not perfect either, but it would be closer to the solution.
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
<action name="test2"> copy(hs, hotspot[link]); spheretoscreen(hs.ath, hs.atv, x,y ); calc(xw, hs.pixelwidth / 2 ); calc(stw, stagewidth - xw ); calc(yh, hs.pixelheight / 2); calc(sth, stageheight - yh ); if(x GT xw AND x LT stw AND y GT yh AND y LT sth, trace(YES); , trace(NO); ); </action> |
If super accuracy is not needed, then you can enter a coefficient with a rough correction for fov. This is if the hotspot is distorted. Just pick the right number that satisfies.Hi, San7, I'am very interesting in your example,Ok, but how do you make it work if you see a part of the hotspot? (view attachment 2)In this case, the signal as soon as the picture reaches the edge
Thanks for your help!
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
<action name="test2"> calc(coeff, 100 / view.fov ); copy(hs, hotspot[link]); spheretoscreen(hs.ath, hs.atv, x,y ); calc(xw, (hs.pixelwidth / 2) * coeff ); calc(stw, stagewidth - xw ); calc(yh, (hs.pixelheight / 2) * coeff ); calc(sth, stageheight - yh ); if(x GT xw AND x LT stw AND y GT yh AND y LT sth, set( hs.alpha,1); , set( hs.alpha,0); ); </action> |
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
<hotspotname="mezaninepcchino" url="%VIEWER%/meza/central_chino+.png" alpha="0" keep="true" zoom="true" scale="0.000715" rotate="-70" ondown="draghotspot();" ath="-0.013641" atv="0.123258" enabled="false" visible="false" distorted="true" /> |
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
<events name="test" keep="true"
onviewchange="test2()"
/>
<action name="test2">
calc(coeff, 100 / view.fov );
copy(hs, hotspot[mezaninepcchino]);
spheretoscreen(hs.ath, hs.atv, x,y );
calc(xw, (hs.pixelwidth / 2) * coeff );
calc(stw, stagewidth - xw );
calc(yh, (hs.pixelheight / 2) * coeff );
calc(sth, stageheight - yh );
if(x GT xw AND x LT stw AND y GT yh AND y LT sth,
set( hs.alpha,1); trace(YES);
,
set( hs.alpha,0.5); trace(NO);
);
</action>
|