Mercurial > forge
changeset 9834:648d10dd8b02 octave-forge
geometry: Fixing typos. deprecating old functions
author | jpicarbajal |
---|---|
date | Sat, 24 Mar 2012 10:24:19 +0000 |
parents | ec17785d6dcf |
children | 122d82315308 |
files | main/geometry/inst/io/deprecated/private/_parsePath.py main/geometry/inst/io/private/_parsePath.py main/geometry/inst/shape2d/shapecentroid.m |
diffstat | 3 files changed, 71 insertions(+), 71 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main/geometry/inst/io/deprecated/private/_parsePath.py Sat Mar 24 10:24:19 2012 +0000 @@ -0,0 +1,64 @@ +#!/usr/bin/env python + +import inkex, simplepath +import sys +#import getopt + +def parsePaths (filen=None): + + svg = inkex.Effect () + svg.parse (filen) + + paths = svg.document.xpath ('//svg:path', namespaces=inkex.NSS) + for path in paths: + D = simplepath.parsePath (path.attrib['d']) + cmdlst = []; + parlst = []; + for cmd,params in D: + cmdlst.append(cmd) + parlst.append(params) + + print 'svgpath = struct("cmd","{0}","data",{{{1}}});' \ + .format(''.join(cmdlst),str(parlst).replace('[[','[').replace(']]',']')) + + print 'svgpathid = "{0}"; $'.format(path.attrib['id']) + + + +# ---------------------------- + +if __name__=="__main__": + ''' + try: + optlist,args = getopt.getopt(sys.argv[1:],"thdp") + except getopt.GetoptError: + usage() + sys.exit(2) + + doHelp = 0 + c = Context() + c.doPrint = 1 + for opt in optlist: + if opt[0] == "-d": c.debug = 1 + if opt[0] == "-p": c.plot = 1 + if opt[0] == "-t": c.triangulate = 1 + if opt[0] == "-h": doHelp = 1 + + if not doHelp: + pts = [] + fp = sys.stdin + if len(args) > 0: + fp = open(args[0],'r') + for line in fp: + fld = line.split() + x = float(fld[0]) + y = float(fld[1]) + pts.append(Site(x,y)) + if len(args) > 0: fp.close() + + if doHelp or len(pts) == 0: + usage() + sys.exit(2) + ''' + svg = sys.argv[1] + parsePaths(svg)
--- a/main/geometry/inst/io/private/_parsePath.py Sat Mar 24 09:46:42 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -#!/usr/bin/env python - -import inkex, simplepath -import sys -#import getopt - -def parsePaths (filen=None): - - svg = inkex.Effect () - svg.parse (filen) - - paths = svg.document.xpath ('//svg:path', namespaces=inkex.NSS) - for path in paths: - D = simplepath.parsePath (path.attrib['d']) - cmdlst = []; - parlst = []; - for cmd,params in D: - cmdlst.append(cmd) - parlst.append(params) - - print 'svgpath = struct("cmd","{0}","data",{{{1}}});' \ - .format(''.join(cmdlst),str(parlst).replace('[[','[').replace(']]',']')) - - print 'svgpathid = "{0}"; $'.format(path.attrib['id']) - - - -# ---------------------------- - -if __name__=="__main__": - ''' - try: - optlist,args = getopt.getopt(sys.argv[1:],"thdp") - except getopt.GetoptError: - usage() - sys.exit(2) - - doHelp = 0 - c = Context() - c.doPrint = 1 - for opt in optlist: - if opt[0] == "-d": c.debug = 1 - if opt[0] == "-p": c.plot = 1 - if opt[0] == "-t": c.triangulate = 1 - if opt[0] == "-h": doHelp = 1 - - if not doHelp: - pts = [] - fp = sys.stdin - if len(args) > 0: - fp = open(args[0],'r') - for line in fp: - fld = line.split() - x = float(fld[0]) - y = float(fld[1]) - pts.append(Site(x,y)) - if len(args) > 0: fp.close() - - if doHelp or len(pts) == 0: - usage() - sys.exit(2) - ''' - svg = sys.argv[1] - parsePaths(svg)
--- a/main/geometry/inst/shape2d/shapecentroid.m Sat Mar 24 09:46:42 2012 +0000 +++ b/main/geometry/inst/shape2d/shapecentroid.m Sat Mar 24 10:24:19 2012 +0000 @@ -36,7 +36,7 @@ [~,id] = lastwarn ('',''); if strcmp (id ,'geom2d:shapearea:InvalidResult') - lastwarn('Inverting centriod','geom2d:shapecentriod:InvalidResult'); + lastwarn('Inverting centroid','geom2d:shapecentroid:InvalidResult'); cm = -cm; end @@ -65,13 +65,13 @@ %! [0.25 0.75; ... %! 0 0]}; %! CoM = shapecentroid (boomerang) -%! Gcentriod = centroid(shape2polygon(boomerang)) +%! Gcentroid = centroid(shape2polygon(boomerang)) %! %! figure(1); clf; %! shapeplot(boomerang,10,'-o'); %! hold on -%! drawPoint(CoM,'xk;shape centriod;'); -%! drawPoint(Gcentriod,'xr;point centriod;'); +%! drawPoint(CoM,'xk;shape centroid;'); +%! drawPoint(Gcentroid,'xr;point centroid;'); %! hold off %! axis equal @@ -83,12 +83,12 @@ %! [0.00000 1.10798; 0.28965 -0.53032]; ... %! [-0.34163 1.10798; 0.00000 -0.24067]};... %! CoM = shapecentroid (Lshape) -%! Gcentriod = centroid (shape2polygon (Lshape)) +%! Gcentroid = centroid (shape2polygon (Lshape)) %! %! shapeplot(Lshape,10,'-o'); %! hold on -%! drawPoint(CoM,'xk;shape centriod;'); -%! drawPoint(Gcentriod,'xr;point centriod;'); +%! drawPoint(CoM,'xk;shape centroid;'); +%! drawPoint(Gcentroid,'xr;point centroid;'); %! hold off %! axis equal