reference position of facet

Asked by ytang

Hi all,

I want to know how to find the reference position of a facet.

I use the following code:
###################################
x0=0.2;y0=0.2;z0=0.4
cylinderIDS= O.bodies.append(geom.facetCylinder((x0,y0,0.4),
 radius=0.0125,height=0.05,orientation=Quaternion((1, 0, 0), 0),wallMask=4,segmentsNumber=6, angleRange=None,material=facetMat))
shaftcheck=O.bodies[-2].id

print("cylinder is :",cylinderIDS)
print("shaft is : ",shaftcheck)
print("this is x reference: ",O.bodies[shaftcheck].state.refPos[0])
print("this is y reference: ",O.bodies[shaftcheck].state.refPos[1])
print("this is z reference: ",O.bodies[shaftcheck].state.refPos[2])
print("#####################################################################")
the results are:
('cylinder is :', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11])
('shaft is : ', 10)
('this is x reference: ', 0.2097597050800552)
('this is y reference: ', 0.19525366997093271)
('this is z reference: ', 0.38048058983988964)
#####################################################################
I don't know how to calculate the reference position.

best,
Yong

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Jan Stránský
Solved:
Last query:
Last reply:
Revision history for this message
Jan Stránský (honzik) said :
#1

Hello,

What is the problem?
Does not state.refPos do what you want?

cheers
Jan

Revision history for this message
ytang (ytang116) said :
#2

Hi Jan,

I want to know how we define the reference position of a facet.

For instance, from the cylinder parameters I give, how can I get the reference position (for example, by hand calculation if we know the definition).

best,
Yong

Revision history for this message
Best Jan Stránský (honzik) said :
#3

using utils auxiliary functions, like utils.sphere or utils.facet (usually called without the utils. prefix), reference position (state.refPos) is set the same as given position (state.pos).

In the case of facet, you pass vertices. The state.pos and state.refPos is the center of inscribed circle. So once you know vertices, it just some geometry calculations.

For implementation, see [1,2]

cheers
Jan

[1] https://gitlab.com/yade-dev/trunk/-/blob/master/py/utils.py#L267
[2] https://gitlab.com/yade-dev/trunk/-/blob/master/py/_utils.cpp#L175

Revision history for this message
ytang (ytang116) said :
#4

Thanks Jan Stránský, that solved my question.