Transform trigonometric formulas to minimize the loss of precision
Closes #18142.
This commit is contained in:
@@ -486,9 +486,9 @@ void wxGraphicsPathData::AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2,
|
|||||||
// Determine spatial relation between the vectors.
|
// Determine spatial relation between the vectors.
|
||||||
bool drawClockwiseArc = v1.GetCrossProduct(v2) < 0;
|
bool drawClockwiseArc = v1.GetCrossProduct(v2) < 0;
|
||||||
|
|
||||||
alpha = wxDegToRad(alpha) / 2.0;
|
alpha = wxDegToRad(alpha);
|
||||||
wxDouble distT = r / sin(alpha) * cos(alpha);
|
wxDouble distT = r / (1.0 + cos(alpha)) * sin(alpha); // = r / tan(a/2) = r / sin(a/2) * cos(a/2)
|
||||||
wxDouble distC = r / sin(alpha);
|
wxDouble distC = r / sin(alpha / 2.0);
|
||||||
wxASSERT_MSG( distT <= v1Length && distT <= v2Length,
|
wxASSERT_MSG( distT <= v1Length && distT <= v2Length,
|
||||||
wxS("Radius is too big to fit the arc to given points") );
|
wxS("Radius is too big to fit the arc to given points") );
|
||||||
// Calculate tangential points
|
// Calculate tangential points
|
||||||
|
Reference in New Issue
Block a user