Mercurial > mm7
comparison Indoor.cpp @ 793:290afbd48b6b
IndoorLocation::GetSector fixed (even better!)
author | Nomad |
---|---|
date | Mon, 25 Mar 2013 09:17:42 +0200 |
parents | 346f7069676a |
children | 4a00901e063c |
comparison
equal
deleted
inserted
replaced
792:41b4e9769863 | 793:290afbd48b6b |
---|---|
3194 continue; | 3194 continue; |
3195 | 3195 |
3196 v54 = 0; | 3196 v54 = 0; |
3197 v50 = pVertices[pFace->pVertexIDs[0]].y >= sY; | 3197 v50 = pVertices[pFace->pVertexIDs[0]].y >= sY; |
3198 | 3198 |
3199 for (uint k = 1; k < pFace->uNumVertices; k++) | 3199 for (uint k = 1; k <= pFace->uNumVertices; k++) |
3200 { | 3200 { |
3201 v59 = v50; | 3201 v59 = v50; |
3202 | 3202 |
3203 if (v54 >= 2) | 3203 if (v54 >= 2) |
3204 break; | 3204 break; |
3205 | 3205 |
3206 auto v2 = &pVertices[pFace->pVertexIDs[k]]; | 3206 auto v2 = &pVertices[pFace->pVertexIDs[k]]; |
3207 v50 = v2->y >= sY; | 3207 v50 = v2->y >= sY; |
3208 | 3208 |
3209 if ( v59 == v50 ) | 3209 if (v59 == v50) |
3210 continue; | 3210 continue; |
3211 | 3211 |
3212 auto v1 = &pVertices[pFace->pVertexIDs[k - 1]]; | 3212 auto v1 = &pVertices[pFace->pVertexIDs[k - 1]]; |
3213 v25 = v2->x >= sX ? 0 : 2; | 3213 v25 = v2->x >= sX ? 0 : 2; |
3214 v26 = v25 | (v1->x < sX); | 3214 v26 = v25 | (v1->x < sX); |
3230 HIDWORD(v33) = v32 >> 16;*/ | 3230 HIDWORD(v33) = v32 >> 16;*/ |
3231 //fixpoint_div(v1->x - v2->x, v1->y - v2->y); | 3231 //fixpoint_div(v1->x - v2->x, v1->y - v2->y); |
3232 //_a58 = v33 / (v1->y - v2->y); | 3232 //_a58 = v33 / (v1->y - v2->y); |
3233 //_a59 = fixpoint_mul(_a58, sY - v2->y); | 3233 //_a59 = fixpoint_mul(_a58, sY - v2->y); |
3234 auto x_div_y = fixpoint_div(v1->x - v2->x, v1->y - v2->y); | 3234 auto x_div_y = fixpoint_div(v1->x - v2->x, v1->y - v2->y); |
3235 auto rval = fixpoint_mul(x_div_y, sY - v2->y); // a / b * c - looks like projection | 3235 auto res = fixpoint_mul(x_div_y, sY - v2->y); // a / b * c - looks like projection |
3236 if (rval + v2->x > sX) | 3236 if (res + v2->x > sX) |
3237 ++v54; | 3237 ++v54; |
3238 } | 3238 } |
3239 else | 3239 else |
3240 { | 3240 { |
3241 auto x_div_y = fixpoint_div(v2->x - v1->x, v2->y - v1->y); | 3241 auto x_div_y = fixpoint_div(v2->x - v1->x, v2->y - v1->y); |