When working on big Flat where high precision is needed (doing polygonal area calculation) there seams to be some internal rounding in the Krpano making result with just small offset to real result. |
|
Quellcode |
1 2 3 4 5 6 |
<hotspot name="test" keep="true" ath="0" atv="0" align="center" edge="center" fillcolor="123456" fillalpha="0.9" borderwidth="2" bordercolor="123456"> <point ath="-0.2" atv="0.2"/> <point ath="0.30" atv="0.20"/> <point ath="0.30" atv="-0.20"/> <point ath="-0.20" atv="-0.20"/> </hotspot> |
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Umalo« (18. Dezember 2017, 13:44)
Thanks for your try but it is other way around. I need not rounded result as I work with huge Flat pano. We know that ath and atv values there are very smll so I need as precised NOT rounded result. As part of the code I also display selected area rounding would make mistakes. So I need correct (as possible) result in first place. If I would work on sphere system then this rounding would be used.I use roundval in this case.
But the building of an 'average' (summing and dividing by the number of point) is wrong for 3d vectors - all vectors were unit-vectors (length 1) and I was wrongly assuming that the resulting averaged vector would be also an unit-vector (which is it not course). The correct solution is summing and then normalizing the resulting vector.
Zitat
First the ath/atv values will be converted to 3d vectors, then these 3d vectors will be averaged and then the resulting 3d vector will be converted back to the 'center' ath/atv value.
. |
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 |
<hotspot name="test" keep="true" ath="0" atv="0" align="center" edge="center" fillcolor="123456" fillalpha="0.9" borderwidth="2" bordercolor="123456"
onloaded="showlog();
hotspot[test].getcenter(ath_center,atv_center);
trace('center ath:',get(ath_center));
trace('center atv:',get(atv_center));
">
<point ath="-0.2" atv="0.2"/>
<point ath="0.30" atv="0.20"/>
<point ath="0.30" atv="-0.20"/>
<point ath="-0.20" atv="-0.20"/>
</hotspot>
|
|
|
Quellcode |
1 2 |
INFO: center ath:0.05000000000001137 INFO: center atv:0 |
.
.