# reference position of facet

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),
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:
Assignee:
No assignee Edit question
Solved by:
Jan Stránský
Solved:
Last query:
 Revision history for this message Jan Stránský (honzik) said on 2020-07-05: #1

Hello,

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

cheers
Jan

 Revision history for this message ytang (ytang116) said on 2020-07-05: #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 Jan Stránský (honzik) said on 2020-07-05: #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

 Revision history for this message ytang (ytang116) said on 2020-07-05: #4

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