[gdal-dev] dfMaxAngleStepSizeDegrees in ApproximateArcAngles

Joaquim Manuel Freire Luís jluis at ualg.pt
Thu Jun 16 10:35:35 PDT 2022


Ah ghrr, I missed one argin in my wrapping (the dfRotation) and probably because the dfMaxAngleStepSizeDegrees  has a default value, an error was not triggered.
Now it works. Sorry for the noise.

From: Even Rouault <even.rouault at spatialys.com>
Sent: Thursday, June 16, 2022 5:49 PM
To: Joaquim Manuel Freire Luís <jluis at ualg.pt>; gdal-dev at lists.osgeo.org
Subject: Re: [gdal-dev] dfMaxAngleStepSizeDegrees in ApproximateArcAngles


I can't replicate that. Below the output with the Python bindings that directly map OGR_G_ApproximateArcAngles():

>>> from osgeo import ogr
>>> g = ogr.ApproximateArcAngles(0, 0, 0, 1, 1, 0, 0, -90, 0)
>>> g.FlattenTo2D()
>>> g.ExportToWkt()
'LINESTRING (1 0,0.997668769190539 0.068242413364671,0.990685946036331 0.136166649096247,0.979084087682323 0.203456013052634,0.962917287347799 0.269796771157024,0.942260922118821 0.334879612170986,0.917211301505453 0.398401089846241,0.887885218402375 0.460065037731152,0.854419404546489 0.519583950035434,0.816969893010442 0.576680322114867,0.77571129070442 0.631087944326053,0.730835964278124 0.682553143218654,0.682553143218654 0.730835964278124,0.631087944326053 0.77571129070442,0.576680322114867 0.816969893010442,0.519583950035434 0.854419404546489,0.460065037731152 0.887885218402375,0.398401089846242 0.917211301505453,0.334879612170986 0.942260922118821,0.269796771157024 0.962917287347799,0.203456013052634 0.979084087682323,0.136166649096247 0.990685946036331,0.068242413364671 0.997668769190539,0.0 1.0)'

>>> g = ogr.ApproximateArcAngles(0, 0, 0, 1, 1, 0, 0, -90, 10)
>>> g.FlattenTo2D()
>>> g.ExportToWkt()
'LINESTRING (1 0,0.984807753012208 0.17364817766693,0.939692620785908 0.342020143325669,0.866025403784439 0.5,0.766044443118978 0.642787609686539,0.642787609686539 0.766044443118978,0.5 0.866025403784439,0.342020143325669 0.939692620785908,0.17364817766693 0.984807753012208,0.0 1.0)'
>>>

For the inc=0 case, note that there's a x/y inversion compared to your output.

The inc=10 case has 10 points in its output as expected

Even
Le 16/06/2022 à 18:27, Joaquim Manuel Freire Luís a écrit :
Even, I wrapped OGR_G_ApproximateArcAngles() in Julia and I think there is something wrong with the  dfMaxAngleStepSizeDegrees argument
(here shortcut to ‘inc’)

This is fine (just repeating the default 0.0 value). Note, I’m dropping the z (=0) argin but that’s only the julia wrapper interface.

D = GMT.Gdal.arcellipse(0, 0, 1., 1., 0., -90., inc=0.)
BoundingBox: [6.123233995736766e-17, 1.0, 0.0, 1.0]
24×2 GMTdataset{Float64, 2}
Row │ x            y
     │ Float64      Float64
─────┼────────────────────────
   1 │ 6.12323e-17  1.0
   2 │ 0.0682424    0.997669
   3 │ 0.136167     0.990686
   4 │ 0.203456     0.979084
   5 │ 0.269797     0.962917
  ⋮  │      ⋮           ⋮
  20 │ 0.962917     0.269797
  21 │ 0.979084     0.203456
  22 │ 0.990686     0.136167
  23 │ 0.997669     0.0682424
  24 │ 1.0          0.0

But if I use for example 10 (or any other number) the dfEndAngle is no longer respected

D = GMT.Gdal.arcellipse(0, 0., 1., 1., 0., -90., inc=10.)
BoundingBox: [6.123233995736766e-17, 0.9993908270190958, -0.17364817766693033, 1.0]
26×2 GMTdataset{Float64, 2}
Row │ x            y
     │ Float64      Float64
─────┼─────────────────────────
   1 │ 6.12323e-17   1.0
   2 │ 0.0697565     0.997564
   3 │ 0.139173      0.990268
   4 │ 0.207912      0.978148
   5 │ 0.275637      0.961262
   6 │ 0.34202       0.939693
   7 │ 0.406737      0.913545
   8 │ 0.469472      0.882948
  ⋮  │      ⋮           ⋮
  19 │ 0.951057      0.309017
  20 │ 0.970296      0.241922
  21 │ 0.984808      0.173648
  22 │ 0.994522      0.104528
  23 │ 0.999391      0.0348995
  24 │ 0.999391     -0.0348995
  25 │ 0.994522     -0.104528
  26 │ 0.984808     -0.173648


Joaquim



_______________________________________________

gdal-dev mailing list

gdal-dev at lists.osgeo.org<mailto:gdal-dev at lists.osgeo.org>

https://lists.osgeo.org/mailman/listinfo/gdal-dev

--

http://www.spatialys.com

My software is free, but my time generally not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20220616/32e2eeb0/attachment-0001.htm>


More information about the gdal-dev mailing list