[prev in list] [next in list] [prev in thread] [next in thread] 

List:       poi-dev
Subject:    =?utf-8?q?=5BPR=5D_XDGF=3A_replace_an_elliptical_arc_with_a_line_when_a_cont?= =?utf-8?q?rol_point_i
From:       komarovd95_(via_GitHub) <git () apache ! org>
Date:       2024-02-29 16:21:51
Message-ID: PR_kwDOAAMmIM5oUHxA () gitbox ! apache ! org
[Download RAW message or body]


komarovd95 opened a new pull request, #601:
URL: https://github.com/apache/poi/pull/601

   We've faced an issue with elliptical arcs in VSDX files - when a control point of \
the elliptic arc is co-linear (i.e. lies on the same line) with begin and end points \
of the arc, it leads to very huge numbers when calculating coordinates of the center \
of the arc.   
   It happens because slopes of two tangents (class `EllipticalArcTo` lines 198 and \
201) are equal to each other which leads to division by zero (or by value that is \
very near to zero).  
   As the solution it's proposed to check co-linearity before calculating an arc. I \
added this condition check into `EllipticalArcTo#createEllipticalArc` method to also \
cover corner-cases with `ArcTo` (which uses the method under the hood) and with \
`RelEllipticalArcTo`.   
   Below you can find an example that high-lights the problem. 
   <img width="270" alt="Screenshot 2024-02-29 at 16 11 00" \
src="https://github.com/apache/poi/assets/11631627/9b4cd6f8-f453-407c-b91e-db23b41df9d8">
  
   And after the fix: 
   <img width="270" alt="Screenshot 2024-02-29 at 16 12 11" \
src="https://github.com/apache/poi/assets/11631627/147ababc-cdd8-4311-8c35-decc7749cd7b">
  
   The file itself (just change extension to `.vsdx` since GitHub does not allow to \
upload VSDX files)  [Single \
Icon.zip](https://github.com/apache/poi/files/14450770/Single.Icon.zip)  
   
     


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic