WorldViz User Forum how to "spin/spinto" an rectangular around its center or edge?
 User Name Remember Me? Password
 Register FAQ Search Today's Posts Mark Forums Read

 Thread Tools Rate Thread Display Modes
#1
06-27-2010, 01:50 AM
 znchb Member Join Date: Sep 2008 Posts: 21
how to "spin/spinto" an rectangular around its center or edge?

Please see the program below, I build an rectangular using polygon, and I want to make it spin around its Center point or around its Edge Line of rectangular ?
Is there anyone would like to help me?
Thank you very much!

import viz
import vizact
viz.go()
viz.clearcolor(viz.WHITE)
bg = viz.add('tut_ground.wrl')
pos = bg.getPosition()
viz.MainView.setPosition(pos[0],pos[1]+5,pos[2]-20)
A = [pos[0]-2, pos[1]+8, pos[2]+10 ]
B = [pos[0]+2, pos[1]+8, pos[2]+10 ]
C = [pos[0]+2, pos[1]+4, pos[2]+10 ]
D = [pos[0]-2, pos[1]+4, pos[2]+10 ]
viz.startlayer(viz.POLYGON)
viz.vertex(A)
viz.vertex(B)
viz.vertex(C)
viz.vertex(D)
Rectangular = viz.endlayer()
Rectangular.color(viz.RED)
#make it spin/spinto
#Rectangular.addAction(vizact.spinto(0,0,1, 180, 30))
Rectangular.addAction(vizact.spin(0,0,1, 90))
#---- How to make it spin around the Center of the rectangular ?-------
#---- or how to make it spin around the Edge Line of rectangular ? -----
#2
06-27-2010, 08:25 PM
 znchb Member Join Date: Sep 2008 Posts: 21
Is there anyone can help me? I really need to solve this problem, which is one function of my project.
I will be very appreciated.
#3
06-28-2010, 10:45 AM
 farshizzo WorldViz Team Member Join Date: Mar 2003 Posts: 2,849
You should create the rectangle so that it is centered around the axis you want it to rotate about. Instead of adding the position to the vertex positions, specify the vertices so they are centered about the origin (0,0,0), and then add the position to the entire model using the Rectangular.setPosition command.

 Thread Tools Display Modes Rate This Thread Linear Mode Rate This Thread: 5 : Excellent 4 : Good 3 : Average 2 : Bad 1 : Terrible

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Announcements Vizard Precision Position Tracker (PPT) Plug-in development

 Similar Threads Thread Thread Starter Forum Replies Last Post vijaykiran Vizard 2 10-19-2009 11:10 AM hosier Vizard 6 02-13-2009 01:04 PM realvision Vizard 2 03-25-2008 10:32 AM johannes2 Vizard 2 02-12-2008 03:56 AM bjgold Vizard 3 07-25-2006 04:22 PM

All times are GMT -7. The time now is 07:09 PM.

 Contact Us - WorldViz Home - Archive - Top

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2022, vBulletin Solutions, Inc.
Copyright 2002-2018 WorldViz LLC