Search code examples
c#entity-frameworkgeometrysqlgeometry

how can i get the center Point of sqlgeometry arc?


i have Mssql database i'm storing some geometry in database as sqlgeometry i work in mvc4 project with EF5 i have arcs store in the databse i can get it form database as dbgeometry then convert it to sqlgeometry for some reasons i want to get the centerpoint of this arc ? is there is free geometry .net lib to calculate that for me?

the is my sample code that build the arc geometry from 3 point on arc

            SqlGeometryBuilder geomBuil = new SqlGeometryBuilder();

        geomBuil.SetSrid(32637);
        geomBuil.BeginGeometry(OpenGisGeometryType.CircularString);
        geomBuil.BeginFigure(startPoint.X, startPoint.Y);
        geomBuil.AddCircularArc(PointOnArc.X, PointOnArc.Y, endPoint.X, endPoint.Y);
        geomBuil.EndFigure();
        geomBuil.EndGeometry();

        SqlGeometry arc = geomBuil.ConstructedGeometry;

Solution

  • You have 3 points at circle - startPoint, PointOnArc and endPoint. To find circle center, you can use formulae from Circumcircle equations section here.