Chrissy2009
08-25-2009, 03:22 PM
Hi,
I try to re-define my problem from the other thread:
I want to draw a line two ways:
1)
begin = [0,0,0]
end = [-2,1,2]
viz.startlayer(viz.LINES)
viz.linewidth(2)
viz.vertexcolor(viz.RED)
viz.vertex(begin)
viz.vertex(end)
viz.startlayer(viz.POINTS)
viz.pointsize(3)
viz.vertex(begin)
viz.vertex(end)
dr = viz.endlayer()
and like this
2)
begin = [0,0,0]
end = [-2,1,2]
d = vizmat.Distance(begin,end)
viz.startlayer(viz.LINES)
viz.linewidth(2)
viz.vertexcolor(0,0,0.6)
viz.vertex(0,0,0)
viz.vertex(0,d,0)
viz.startlayer(viz.POINTS)
viz.pointsize(3)
viz.vertex(0,0,0)
viz.vertex(0,d,0)
drr = viz.endlayer()
drr.setPosition(begin)
drr.setEuler(0,0,-vizmat.AngleToPoint([begin[0],begin[1]],[end[0],end[1]]))
The rotation about the z-axis works very fine. (see scrennshot1)
But now I want to rotate the second line (the blue one) around the y-axis, too. So that I can see in the Top-View that the lines are exactly at the same place, the same direction, the same length and so on.
I've tested many ways, but I can't find a solution.
I've done:
drr.setEuler(-vizmat.AngleToPoint([begin[0],begin[2]],[end[0],end[2]]), 0, -vizmat.AngleToPoint([begin[0],begin[1]],[end[0],end[1]]))
and
drr.setEuler(vizmat.AngleToPoint([begin[0],begin[2]],[end[0],end[2]]), 0, -vizmat.AngleToPoint([begin[0],begin[1]],[end[0],end[1]]))
and
drr.setEuler(-vizmat.AngleToPoint([begin[2],begin[0]],[end[2],end[0]]), 0, -vizmat.AngleToPoint([begin[0],begin[1]],[end[0],end[1]]))
and
drr.setEuler(vizmat.AngleToPoint([begin[2],begin[0]],[end[2],end[0]]), 0, -vizmat.AngleToPoint([begin[0],begin[1]],[end[0],end[1]]))
but nothing works fine. Where is my mistake??
Thanks a lot....
I try to re-define my problem from the other thread:
I want to draw a line two ways:
1)
begin = [0,0,0]
end = [-2,1,2]
viz.startlayer(viz.LINES)
viz.linewidth(2)
viz.vertexcolor(viz.RED)
viz.vertex(begin)
viz.vertex(end)
viz.startlayer(viz.POINTS)
viz.pointsize(3)
viz.vertex(begin)
viz.vertex(end)
dr = viz.endlayer()
and like this
2)
begin = [0,0,0]
end = [-2,1,2]
d = vizmat.Distance(begin,end)
viz.startlayer(viz.LINES)
viz.linewidth(2)
viz.vertexcolor(0,0,0.6)
viz.vertex(0,0,0)
viz.vertex(0,d,0)
viz.startlayer(viz.POINTS)
viz.pointsize(3)
viz.vertex(0,0,0)
viz.vertex(0,d,0)
drr = viz.endlayer()
drr.setPosition(begin)
drr.setEuler(0,0,-vizmat.AngleToPoint([begin[0],begin[1]],[end[0],end[1]]))
The rotation about the z-axis works very fine. (see scrennshot1)
But now I want to rotate the second line (the blue one) around the y-axis, too. So that I can see in the Top-View that the lines are exactly at the same place, the same direction, the same length and so on.
I've tested many ways, but I can't find a solution.
I've done:
drr.setEuler(-vizmat.AngleToPoint([begin[0],begin[2]],[end[0],end[2]]), 0, -vizmat.AngleToPoint([begin[0],begin[1]],[end[0],end[1]]))
and
drr.setEuler(vizmat.AngleToPoint([begin[0],begin[2]],[end[0],end[2]]), 0, -vizmat.AngleToPoint([begin[0],begin[1]],[end[0],end[1]]))
and
drr.setEuler(-vizmat.AngleToPoint([begin[2],begin[0]],[end[2],end[0]]), 0, -vizmat.AngleToPoint([begin[0],begin[1]],[end[0],end[1]]))
and
drr.setEuler(vizmat.AngleToPoint([begin[2],begin[0]],[end[2],end[0]]), 0, -vizmat.AngleToPoint([begin[0],begin[1]],[end[0],end[1]]))
but nothing works fine. Where is my mistake??
Thanks a lot....