From: David S. <dsc...@vy...> - 2001-03-02 17:30:03
|
Yes, this is a VPython bug. Thick curves are rendered with rectangular cross sections, but with shading that makes them look more round than that. To render these VPython needs to construct a 2D basis for the cross section of the curve at each point. Cross-sectional view of a curve ^ Basis vector 2 | /|\ / | \ ( x--)--> Basis vector 1 \ / \ / Some care is taken to make sure that each basis isn't "twisted" with respect to the previous and next ones, but I wasn't able to get that exactly right. Straight line segments are particularly bad because finite floating point precision tends to make them jitter randomly from "concave up" to "concave down". You might be able to work around the problem by making the line curve *very* slightly, e.g pos=(r*cos(theta), r*sin(theta + r/1000.0)) or something. If anyone can think of a better way to generate the cross sections, of course, I would love to hear it! Dave -----Original Message----- From: vis...@li... [mailto:vis...@li...]On Behalf Of Stephen Highland Sent: Friday, March 02, 2001 12:14 PM To: vis...@li... Subject: [Visualpython-users] why do straight 'curves' have 'knots'? When I run this simple program, expecting a straight (tilted) line, I get a thing that's straight, all right, but it has narrow spots in places that make it look like it's twisted. What's going on? from visual import * theta =0.4 c=curve(radius=0.04,color=color.yellow) for r in arange(0.1,1.0,0.1): c.append(pos=(r*cos(theta),r*sin(theta),0)) The reason I'm building a straight line in segments is so I can color it differently along its length. Have I found some sort of VPython error or am I doing something dumb? ---Steve Highland (still having lots of fun...) |