How to draw SQL Server “circularstring” in C# [closed]

删除回忆录丶 提交于 2019-12-13 08:04:29

问题


SQL Server has a spatial type "circularstring" that is collection of odd points. How can I draw this type in c#. Drawarc works based on angles while in circularstring we have just points. Drawcurve works based on the points but the result is not the same as circularstring. With three points, circularstring is an arc of the circle pass through that points while curve is not.

Thanks a lot.

Majid


回答1:


The basic solution could look like this:

  • Take three points A,B,C (blue) and create the arc.
  • Take the last one plus the next two and create the next arc.
  • Continue until all points are used.
  • If the number of points is even or if two consecutive points are the same the data are invalid.

To create the arc:

  • Find the center M (green) of the circle (the crossing of the yellow lines)
  • Find the (clockwise) angle between the x-axis and the connection between M and A (starting angle, orange)
  • Find the angle between M and A and C (sweep angle, orange)

Now you can draw the arc.

The short yellow lines connect the points; the long ones stand perpendicular on them.



来源:https://stackoverflow.com/questions/36795556/how-to-draw-sql-server-circularstring-in-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!