Benutzerinformationen überspringen
Wohnort: Netherlands
Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer
: https://pame.virtualtuur.comDieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Tuur« (10. Mai 2022, 13:59)
Benutzerinformationen überspringen
Wohnort: Netherlands
Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer
: https://pame.virtualtuur.comBenutzerinformationen überspringen
Wohnort: Netherlands
Beruf: 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
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Fernando« (12. Mai 2022, 18:13)
|
|
Quellcode |
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.
|
|
Quellcode |
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> |
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
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!
|
|
Quellcode |
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> |
|
|
Quellcode |
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" /> |
|
|
Quellcode |
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>
|