Share via


Happy easter with a TSQL egg :-)

Non essendo capace a fare un uovo di cioccolato, mi sono limitato a costruirlo con il tipo geometry :-)

image

 

 DECLARE @x AS float = -1.5;
DECLARE @tTable TABLE( geo geometry );

WHILE @x < 1.5
    BEGIN

       INSERT INTO @tTable
       SELECT geometry::STGeomFromText( 'POINT(' + cast(@x as varchar) + ' ' + 
             cast ( ( 1 + (@x*1.5)/8 ) * SQRT( 1 - POWER((@x/1.5),2) ) as varchar)  + ')' , 4326 )AS y;
       
       INSERT INTO @tTable
       SELECT geometry::STGeomFromText( 'POINT(' + cast(@x as varchar) + ' -' + 
             cast ( ( 1 + (@x*1.5)/8 ) * SQRT( 1 - POWER((@x/1.5),2) ) as varchar)  + ')' , 4326 )AS y;

       SET @x = @x + 0.005;
    END;

SELECT geo
  FROM @tTable;

 

Per info: Equation of Egg Shaped Curve IV

 

Happy easter! Buona Pasqua!