[ 
https://issues.apache.org/jira/browse/LUCENE-7970?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16178583#comment-16178583
 ] 

Ignacio Vera commented on LUCENE-7970:
--------------------------------------

Hi [~daddywri],

Thanks for the patch and the updates. Therefore you need always to be able to 
define the shape with a collections of planes. This approach is very nice, it 
is like approximating the circle as a polygon with n-sides. I have a look into 
the patch and first think I notice is that cardinality points are wrong: 0 
degrees bearing angle is for north. I did the following changes and I was able 
to build circles:

{{
      final GeoPoint eastPoint = planetModel.surfacePointOnBearing(center, 
cutoffAngle, Math.PI * 0.5);                                                    
  
      final GeoPoint westPoint = planetModel.surfacePointOnBearing(center, 
cutoffAngle, Math.PI * 1.5);                                                    
  
      final GeoPoint northPoint = planetModel.surfacePointOnBearing(center, 
cutoffAngle, 0.0);                                                              
 
      final GeoPoint southPoint = planetModel.surfacePointOnBearing(center, 
cutoffAngle, Math.PI);                                                          
 
                                                                                
                                                                             
      this.edgePoints = new GeoPoint[]{northPoint};                             
                                                                             
                                                                                
                                                                             
      if (planetModel.c > planetModel.ab) {                                     
                                                                             
        // z can be greater than x or y, so ellipse is longer in height than 
width                                                                           
        slices.add(new ApproximationSlice(center, eastPoint, Math.PI * 0.5, 
westPoint, Math.PI * -0.5, northPoint, 0));                                     
 
        slices.add(new ApproximationSlice(center, westPoint, 1.5 * Math.PI, 
eastPoint, 0.5 * Math.PI, southPoint, Math.PI));                                
 
      } else {                                                                  
                                                                             
        // z will be less than x or y, so ellipse is shorter than it is tall    
                                                                             
        slices.add(new ApproximationSlice(center, northPoint, 2 * Math.PI , 
southPoint, Math.PI, eastPoint, 1.5  * Math.PI));                               
 
        slices.add(new ApproximationSlice(center, southPoint, Math.PI, 
northPoint, Math.PI * 0.0, westPoint, 0.5 * Math.PI));                          
      
}}

Note I have to change the bearing angles of the slice so averages give the 
expected numbers. I need to look a bit further but it is looking very nice.

Thanks!

I.

> Add a Geo3d shape that models an exact circle, even when the planet model is 
> not a sphere
> -----------------------------------------------------------------------------------------
>
>                 Key: LUCENE-7970
>                 URL: https://issues.apache.org/jira/browse/LUCENE-7970
>             Project: Lucene - Core
>          Issue Type: Improvement
>          Components: modules/spatial3d
>            Reporter: Ignacio Vera
>            Assignee: Karl Wright
>         Attachments: circle.jpg, LUCENE-7970-exact.diff, LUCENE_7970.patch, 
> LUCENE-7970.patch, LUCENE-7970-proposed.patch, 
> LUCENE-7970_testBearingPoint.patch
>
>
> Hi [~Karl wright],
> How circles are currently build do not behave very well when the planet model 
> is not an sphere. when you are close to the border in WGS84 you might get 
> false positves or false negatives when checking if a point is WITHIN. I think 
> the reason is how the points to generate the circle plane are generated which 
> assumes a sphere.
> My proposal is the following:
> Add a new method to PlanetModel:  
> public GeoPoint pointOnBearing(GeoPoint from, double dist, double bearing);
> Which uses and algorithm that takes into account that the planet might not be 
> spherical. For example Vincenty's formulae 
> (https://en.wikipedia.org/wiki/Vincenty%27s_formulae).
> Use this method to generate the points for the circle plane. My experiments 
> shows that this approach removes false negatives in WGS84 meanwhile it works 
> nicely in the Sphere.
> Does it make sense?



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to