Skip to content Skip to sidebar Skip to footer

How To Draw Sql Server "circularstring" In C#

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

Solution 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.

enter image description here

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

Post a Comment for "How To Draw Sql Server "circularstring" In C#"