← Back to team overview

yade-users team mailing list archive

Re: [Question #682656]: relative coordinate or local coordinate

 

Question #682656 on Yade changed:
https://answers.launchpad.net/yade/+question/682656

    Status: Open => Answered

Jan Stránský proposed the following answer:
something like this?
###
def rotateAround(point,center,axis,angle):
	d = point - center
	q = Quaternion(axis,angle)
	d = q*d
	return center + d
#
s1 = sphere((1,2,3),radius=0.5)
# center of s2 given relatively to center of s1
s2 = sphere(s1.state.pos+(0,0,1),radius=0.5)
# center of s2 is rotated
s2.state.pos = rotateAround(s2.state.pos,s1.state.pos,(1,0,0),pi/3)
print s1.state.pos
print s2.state.pos
###

cheers
Jan

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.