From: <md...@us...> - 2007-12-10 19:53:14
|
Revision: 4694 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4694&view=rev Author: mdboom Date: 2007-12-10 11:53:12 -0800 (Mon, 10 Dec 2007) Log Message: ----------- Simplify even more Modified Paths: -------------- branches/transforms/lib/matplotlib/path.py Modified: branches/transforms/lib/matplotlib/path.py =================================================================== --- branches/transforms/lib/matplotlib/path.py 2007-12-10 19:46:00 UTC (rev 4693) +++ branches/transforms/lib/matplotlib/path.py 2007-12-10 19:53:12 UTC (rev 4694) @@ -440,20 +440,28 @@ n = int(2 ** math.ceil((eta2 - eta1) / halfpi)) deta = (eta2 - eta1) / n - etaB = eta1 + t = math.tan(0.5 * deta) + alpha = math.sin(deta) * (math.sqrt(4.0 + 3.0 * t * t) - 1) / 3.0 - cos_etaB = math.cos(etaB) - sin_etaB = math.sin(etaB) - xB = cos_etaB - yB = sin_etaB - xB_dot = -sin_etaB - yB_dot = cos_etaB + steps = npy.linspace(eta1, eta2, n + 1, True) + cos_eta = npy.cos(steps) + sin_eta = npy.sin(steps) + xA = cos_eta[:-1] + yA = sin_eta[:-1] + xA_dot = -yA + yA_dot = xA + + xB = cos_eta[1:] + yB = sin_eta[1:] + xB_dot = -yB + yB_dot = xB + if is_wedge: length = n * 3 + 4 vertices = npy.zeros((length, 2), npy.float_) codes = Path.CURVE4 * npy.ones((length, ), Path.code_type) - vertices[1] = [xB, yB] + vertices[1] = [xA[0], yA[0]] codes[0:2] = [Path.MOVETO, Path.LINETO] codes[-2:] = [Path.LINETO, Path.CLOSEPOLY] vertex_offset = 2 @@ -462,28 +470,11 @@ length = n * 3 + 1 vertices = npy.zeros((length, 2), npy.float_) codes = Path.CURVE4 * npy.ones((length, ), Path.code_type) - vertices[0] = [xB, yB] + vertices[0] = [xA[0], yA[0]] codes[0] = Path.MOVETO vertex_offset = 1 end = length - t = math.tan(0.5 * deta) - alpha = math.sin(deta) * (math.sqrt(4.0 + 3.0 * t * t) - 1) / 3.0 - - steps = npy.linspace(eta1, eta2, n + 1, True) - cos_eta = npy.cos(steps) - sin_eta = npy.sin(steps) - - xA = cos_eta[:-1] - yA = sin_eta[:-1] - xA_dot = -yA - yA_dot = xA - - xB = cos_eta[1:] - yB = sin_eta[1:] - xB_dot = -yB - yB_dot = xB - vertices[vertex_offset :end:3, 0] = xA + alpha * xA_dot vertices[vertex_offset :end:3, 1] = yA + alpha * yA_dot vertices[vertex_offset+1:end:3, 0] = xB - alpha * xB_dot This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |