| 42 | } |
| 43 | |
| 44 | bool calcCircleCenter( const Vector2f& p0, const Vector2f& p1, const Vector2f& p2, Vector2f& center ) |
| 45 | { |
| 46 | const auto dif1 = p1 - p0; |
| 47 | const auto dif2 = p2 - p0; |
| 48 | |
| 49 | const auto proj1 = dot( dif1, p0 + p1 ); |
| 50 | const auto proj2 = dot( dif2, p0 + p2 ); |
| 51 | const auto det = cross( dif1, p2 - p1 ) * 2; |
| 52 | |
| 53 | if ( fabs( det ) < 1e-10 ) |
| 54 | return false; |
| 55 | |
| 56 | // calc center coords |
| 57 | center.x = ( dif2.y * proj1 - dif1.y * proj2 ) / det; |
| 58 | center.y = ( dif1.x * proj2 - dif2.x * proj1 ) / det; |
| 59 | |
| 60 | return true; |
| 61 | } |
| 62 | |
| 63 | // get coordinate along specified axis |
| 64 | float coord( const GCommand& command, Axis axis ) |
no test coverage detected