public void AddLine(double latitude, double longitude, double?z, double?m)
        {
            // Transforming from geodetic coordinates to a unit vector.
            var endPoint = SpatialUtil.SphericalDegToCartesian(latitude, longitude);

            var angle = endPoint.Angle(_startPoint);

            if (angle > MinAngle)
            {
                // _startPoint and endPoint are the unit vectors that correspond to the input
                // start and end points.  In their 3D space we operate in a local coordinate system
                // where _startPoint is the x axis and the xy plane contains endPoint. Every
                // point is now generated from the previous one by a fixed rotation in the local
                // xy plane, and converted back to geodetic coordinates.

                // Construct the local z and y axes.
                var zAxis = (_startPoint + endPoint).CrossProduct(_startPoint - endPoint).Unitize();
                var yAxis = (_startPoint).CrossProduct(zAxis);

                // Calculating how many points we need.
                var count = Convert.ToInt32(Math.Ceiling(angle / SpatialUtil.ToRadians(_angle)));

                // Scaling the angle so that points are equally placed.
                var exactAngle = angle / count;

                var cosine = Math.Cos(exactAngle);
                var sine   = Math.Sin(exactAngle);

                // Setting the first x and y points in our local coordinate system.
                var x = cosine;
                var y = sine;

                for (var i = 0; i < count - 1; i++)
                {
                    var newPoint = (_startPoint * x + yAxis * y).Unitize();

                    // Adding the point.
                    _sink.AddLine(SpatialUtil.LatitudeDeg(newPoint), SpatialUtil.LongitudeDeg(newPoint), null, null);

                    // Rotating to get next point.
                    var r = x * cosine - y * sine;
                    y = x * sine + y * cosine;
                    x = r;
                }
            }
            _sink.AddLine(latitude, longitude, z, m);

            // Remembering last point we added.
            _startPoint = endPoint;
        }
 public void BeginFigure(double latitude, double longitude, double?z, double?m)
 {
     // Starting the figure, remembering the vector that corresponds to the first point.
     _startPoint = SpatialUtil.SphericalDegToCartesian(latitude, longitude);
     _sink.BeginFigure(latitude, longitude, z, m);
 }