← Back to team overview

yade-users team mailing list archive

[Question #290716]: There's something wrong with the function shape.setVertices() of polyhedra.

 

New question #290716 on Yade:
https://answers.launchpad.net/yade/+question/290716

Hi there, I find that there will be something wrong when I use shape.setVertices() to update the coords of polyhedra element.
The following is a simple example: 

a = [[0,0,0],[0,0,1],[0,1,0],[1,0,0]]
b = [[0,0,0],[0,0,1],[0,1,0],[2,0,0]]
The I created two tetraPoly Elements:
The first one:
O.bodies.append(yade.utils.tetraPoly(a))
And the second one:
O.bodies.append(yade.utils.tetraPoly(b))

We can get the two elements' geometrical parameters:

/********     The first one:  *********/
Local coords:
[Vector3(0.816496580927726,-2.7755575615628914e-17,0.14433756729740668),
 Vector3(-0.408248290463863,0.7071067811865476,0.14433756729740627),
 Vector3(-0.40824829046386313,-0.7071067811865475,0.14433756729740638),
 Vector3(1.1102230246251565e-16,0,-0.43301270189221935)]
Center position:
Vector3(0.25,0.25,0.25)
And orientation:
Quaternion((-0.7692737357538557,0.5902844985873291,-0.24450384497347377),0.9878610573978008)

/********     The second one:  *********/
Local coords:
[Vector3(1.540585613069975,-2.7755575615628914e-17,0.03994957824318643),
 Vector3(-0.5735312506428961,0.7071067811865476,0.21462037306834483),
 Vector3(-0.5735312506428962,-0.7071067811865477,0.2146203730683448),
 Vector3(-0.3935231117841831,-2.7755575615628914e-17,-0.46919032437987607)]
Center position:
Vector3(0.5,0.25,0.25)
And orientation:
Quaternion((-0.947296213713065,0.29597311537489573,-0.12259607848609863),0.8244158709535887)

Then, we use 'shape.setVertices()' function to pass the coords of the second element to the first one:
O.bodies[0].shape.setVertices(b)
/********     The first one's geometrical parameters after calling 'setVertices':  *********/
Local coords:
[Vector3(1.540585613069975,-2.7755575615628914e-17,0.03994957824318643),
 Vector3(-0.5735312506428961,0.7071067811865476,0.21462037306834483),
 Vector3(-0.5735312506428962,-0.7071067811865477,0.2146203730683448),
 Vector3(-0.3935231117841831,-2.7755575615628914e-17,-0.46919032437987607)]
Center position:
Vector3(0.25,0.25,0.25)
And orientation:
Quaternion((-0.7692737357538557,0.5902844985873291,-0.24450384497347377),0.9878610573978008)

It seems that the 'setVertices() function only changed the Local coords of the element, leaving Center position and orientation of the element unchanged, which will make the global coordinates of the element go wrong.
Could you please help me find out a solution to correct this? Thank you very much!


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