From 60e026a2ccff9f5f0965d98ac8e9921866c4d649 Mon Sep 17 00:00:00 2001 From: Alvin Penner Date: Mon, 28 Dec 2009 06:12:43 -0500 Subject: [PATCH] patches for LP bug 461964, latitude hiding formula and comment 13. --- share/extensions/wireframe_sphere.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/share/extensions/wireframe_sphere.py b/share/extensions/wireframe_sphere.py index ec7e9ea33..8fbd4d3f1 100644 --- a/share/extensions/wireframe_sphere.py +++ b/share/extensions/wireframe_sphere.py @@ -147,10 +147,13 @@ class Wireframe_Sphere(inkex.Effect): for i in range(0,so.NUM_LONG/2): long_angle = so.ROT_OFFSET + (i*delta_long)*(pi/180.0); #The longitude of this particular line in radians + if long_angle > pi: + long_angle -= 2*pi width = so.RADIUS * cos(long_angle) height = so.RADIUS * sin(long_angle) * sin(so.TILT) #the rise is scaled by the sine of the tilt - length = sqrt(width*width+height*height) #by pythagorean theorem - inverse = sin(acos(length/so.RADIUS)) + # length = sqrt(width*width+height*height) #by pythagorean theorem + # inverse = sin(acos(length/so.RADIUS)) + inverse = abs(sin(long_angle)) * cos(so.TILT) minorRad = so.RADIUS * inverse minorRad=minorRad + EPSILON @@ -200,9 +203,7 @@ class Wireframe_Sphere(inkex.Effect): if lat_angle > pi-so.TILT: #this LoLat is fully visible draw_SVG_ellipse((majorRad, minorRad), (cx,cy), grp_lat) else: #this LoLat is partially visible - - proportion = -(acos( (lat_angle - pi/2)/(pi/2 - so.TILT)) )/pi + 1 #this is a dirty hacky approximation - #FIXME: if you can work out the right way to do this, please do it + proportion = -(acos( tan(lat_angle - pi/2)/tan(pi/2 - so.TILT)) )/pi + 1 start_end = ( pi/2 - proportion*pi, pi/2 + proportion*pi ) #make the start and end angles (mirror image around pi/2) draw_SVG_ellipse((majorRad, minorRad), (cx,cy), grp_lat, start_end) -- 2.30.2