Simo, This "Bounding Containers" Python script from the ESRI ArcScripts site has a lot or raw Computational Geometry code to create a Minimum Bounding Rectangle and more.
http://arcscripts.esri.com/details.asp?dbid=14535 In GeomHelper.py I see a function to rotate a shape: def transRotatePnts(pnts,pntCent,angle): X0 = pntCent[0]; Y0 = pntCent[1] #print "transform2D center ", str(X0), str(Y0) if pnts[0] != pnts[-1]: N = len(pnts) else: N = len(pnts)-1 #translate and rotate shapes and determine area angle = angle*(-1.0) #reverse the rotation cosXY = math.cos(degToRad * angle) sinXY = math.sin(degToRad * angle) rotPnts = [] for j in range(0, N): X1 = pnts[j][0] - X0; Y1 = pnts[j][1] - Y0 X = (X1 * cosXY) - (Y1 *sinXY) Y = (X1 * sinXY) + (Y1 *cosXY) pnt = [X, Y] rotPnts.append(pnt) #Return the rotated points and the centre return rotPnts I do not see anything for Scaling. On Jan 17, 10:14 am, simo <[email protected]> wrote: > Hi all, > > As preamble, I have to say I'm new to Python and don't know (much) > about Java - I come from a PHP world. > > Anyway, since several months I follow GiS python activity, and I was > waiting for the day I'll have opportunity and overall time to work > with shapely and others open source python projects .... > > Finally that time has come and I'm trying to adapt Julien Gaffuri's > SmallestSurroundingRectangle to python (available here > :http://opencarto.svn.sourceforge.net/viewvc/opencarto/trunk/src/main/... > ) > > His algorithm call a Rotate method and I was not able to find > something similar into Python. > Do you know if such method is included somewhere? > > the java rotation class is available at > :http://opencarto.svn.sourceforge.net/viewvc/opencarto/trunk/src/main/... > > subsidiary question : what about a scaling method ? > > the scaling class is available at > :http://opencarto.svn.sourceforge.net/viewvc/opencarto/trunk/src/main/... > > many thanks, > > simo
