Quantcast
Channel: TechNet Blogs
Viewing all articles
Browse latest Browse all 34890

Happy easter with a TSQL egg :-)

$
0
0

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.5BEGIN

       INSERT INTO @tTableSELECT 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 @tTableSELECT 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 geoFROM @tTable;

 

Per info: Equation of Egg Shaped Curve IV

 

Happy easter! Buona Pasqua!


Viewing all articles
Browse latest Browse all 34890

Trending Articles