Some notes on code.
Code fails when consective path points are parallel to Z axis (1,1,0) (2,2,0).
But more mysteriously the translational part of the transform does not seem to be
working look at the following.
def CreateTube(path,radius,steps,closed=0):
---create circle ---
for i in range(segs):
forward, right = Vector3d(), Vector3d()
if i != segs-1: forward.sub(path[i+1],path[i])
else :
if closed : forward.sub(path[i],path[i-1])
else : forward.sub(path[1],path[0])
forward.normalize()
up = Vector3d(0.0,0.0,1.0)
right.cross(forward, up)
up.cross(forward, right)
frenetmatrix = Matrix3d(right,up, forward)
trans = Transform3D(frenetmatrix, Vector3d(), 1)
trans.setTranslation(path[i])
for k in range(steps):
tempvert = Vector3d()
trans.transform(circle[k], tempvert)
---print ---
Input :
path = ((1,1,1),(2,2,2))
total = CreateTube(path, 0.5, 3, 1)
Notice:
Path = (1,1,1), circle(0.5,0,0), vertex(0.288-, 0.166-, 0.288-)
Path = (2,2,2), circle(0.5,0,0), vertex(0.288-, 0.166-, 0.288-)
HOW IS THIS POSSIBLE WITH DIFFERENT TRANSLATIONAL COMPONENTS ?
Output :
trans ------------------------------
0.5773502691896258, -0.5773502691896258, 0.0, 1.0
0.3333333333333334, 0.3333333333333334, -0.6666666666666669, 1.0
0.5773502691896258, 0.5773502691896258, 0.5773502691896258, 1.0
0.0, 0.0, 0.0, 1.0
point (1.0, 1.0, 1.0)
circle (0.5, 0.0, 0.0)
vertex (0.2886751345948129, 0.1666666666666667, 0.2886751345948129)
trans ------------------------------
0.5773502691896258, -0.5773502691896258, 0.0, 2.0
0.3333333333333334, 0.3333333333333334, -0.6666666666666669, 2.0
0.5773502691896258, 0.5773502691896258, 0.5773502691896258, 2.0
0.0, 0.0, 0.0, 1.0
point (2.0, 2.0, 2.0)
circle (0.5, 0.0, 0.0)
vertex (0.2886751345948129, 0.1666666666666667, 0.2886751345948129)
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".