Create arbitrary ellipsoid using level set

Asked by Ruidong LI

Hi! I'd like to ask how to set the 'orientation' keyword in the levelSetBody. It seems that we need to input a quaternion. But the problem is that what's the format of this input?Can someone help me with this? Many thanks.

Cheers,
Kyle

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Ruidong LI
Solved:
Last query:
Last reply:
Revision history for this message
Karol Brzezinski (kbrzezinski) said :
#1

Hi,

Quaternion is composed of axis direction (three components) followed by angle of rotation:

###
lsb1 = levelSetBody(
        'superellipsoid', center=(0, 0, 0), extents=(0.05, 0.05, 0.15), epsilons=(1.1, 0.2), spacing=0.01, nSurfNodes=2502, nodesPath=1, dynamic=False,
        orientation=Quaternion((1, 0, 0), 0),
)

lsb2 = levelSetBody(
        'superellipsoid', center=(0, 0, 0.25), extents=(0.05, 0.05, 0.15), epsilons=(1.1, 0.2), spacing=0.01, nSurfNodes=2502, nodesPath=1, dynamic=False,
        orientation=Quaternion((1, 0, 0), pi/2),# rotated 90 degrees around x-axis
)

lsb3 = levelSetBody(
        'superellipsoid', center=(0, 0, 0.5), extents=(0.05, 0.05, 0.15), epsilons=(1.1, 0.2), spacing=0.01, nSurfNodes=2502, nodesPath=1, dynamic=False,
        orientation=Quaternion((0, 1, 0), pi/2),# rotated 90 degrees around y-axis
)
O.bodies.append([lsb1,lsb2,lsb3])
####

Cheers,
Karol

Revision history for this message
Ruidong LI (kyle2000) said :
#2

Thank you, Karol. Your answer solved my problem.