# shape orientation for Potential Block

Asked by Ali Rafiee on 2019-10-31

Hi everyone,

I can't understand the logic of the orientation standards for Potential Block, in particular for blocks with oblique facets.
I respected all the explanations from the answers to this question:

but I see some problems specially for blocks having oblique facets as for third blocks in the simple example, below.

for converting a convex block to PB, I do in this way:
1-compute center of block
2-calculate new vertex coordinates with local center
3-calculate a,b,c,d for all faces
4-(d-chosenR) for all d s

what gives me the output data same as below example, but when I try to create PB, it works without problem for (straight) block, but for blocks with oblique faces, they are misdirected.

I don't know why?

Thanks a lot
Best regards
Ali

################ a simple example
chosenR=0.0001
################################ PB parts
#Number of facets
# center of block
# a ax+by+cz+d=0
# b
# c
# d
6
0.0 3.0 0.0
1.0 -0.0 -1.0 -0.0 -0.0 -0.0
0.0 -1.0 0.0 1.0 -0.0 -0.0
0.0 -0.0 -0.0 -0.0 1.0 -1.0
0.9999 1.9999 0.9999 1.9999 0.9999 0.9999
6
0.0 4.0 3.0
1.0 -0.0 -1.0 -0.0 -0.0 -0.0
0.0 -1.0 0.0 1.0 -0.0 -0.0
0.0 -0.0 -0.0 -0.0 1.0 -1.0
0.9999 0.9999 0.9999 0.9999 1.9999 1.9999
9
0.6733279600737498 3.79366976022725 6.1040638685226245
0.4233422835886639 -0.0 -1.0 -0.0 -0.0 -0.2544435504552162 -0.0 0.2256157225428006 0.7071067811865475
-0.4658182304526213 -1.0 0.0 1.0 -0.0 -0.0 0.2924660204513265 -0.5965652970583126 -0.0
-0.4658182304526213 0.0 -0.0 -0.0 1.0 -0.8250734563293101 -0.12273156061799324 -0.4512314450856012 -0.0
0.9630391247904834 1.20623023977275 1.83734355291125 0.79356976022725 1.1039638685226245 1.2066387820121347 0.3419810759564882 0.7092731583297133 1.5290583284351422
6
0.0 0.0 0.0
1.0 -0.0 -1.0 -0.0 -0.0 -0.0
0.0 -1.0 0.0 1.0 -0.0 -0.0
0.0 -0.0 -0.0 -0.0 1.0 -1.0
1.9999 0.9999 1.9999 0.9999 0.9999 0.9999
###########################################

## Question information

Language:
English Edit question
Status:
Expired
For:
Assignee:
No assignee Edit question
Last query:
2019-11-22
2019-12-08
 Vasileios Angelidakis (vsangelidakis) said on 2019-11-05: #1

Hi Ali,

Last week we made some improvements in the code, including fixing a bug related to the particle orientation.
Can you please compile the latest trunk and let us know if the problem persists?

If the matter is not resolved, please send over a Minimal Working Script (MWS) where you define a PB with oblique faces, along with the vertices you used to construct this PB in the first place, so I can compare.

Kind regards,
Vasileios

 Ali Rafiee (ali-rafiee) said on 2019-11-05: #2

Hi Vasileios,
I just tested this simple example with Yade 20191104-2651 bionic version, but this orientation problem persists still.

I try to send you a simple MWS.

I have the orientation problem with polyhedron such this one having orthogonal and oblique faces:

#############################################
9 ## Number of facets
0.6733279600737498 3.79366976022725 6.1040638685226245 # center of block
0.4233422835886639 -0.0 -1.0 -0.0 -0.0 -0.2544435504552162 -0.0 0.2256157225428006 0.7071067811865475 # a
-0.4658182304526213 -1.0 0.0 1.0 -0.0 -0.0 0.2924660204513265 -0.5965652970583126 -0.0 # b
-0.4658182304526213 0.0 -0.0 -0.0 1.0 -0.8250734563293101 -0.12273156061799324 -0.4512314450856012 -0.0 # c
0.9630391247904834 1.20623023977275 1.83734355291125 0.79356976022725 1.1039638685226245 1.2066387820121347 0.3419810759564882 0.7092731583297133 1.5290583284351422 # d

########################################

Thanks a lot

Best regards
Ali

 Ali Rafiee (ali-rafiee) said on 2019-11-05: #3

Here is a simple example with a single polyhedron.

Thanks again
Ali

################################## simple code
import itertools
import numpy as np
import math
import random

gravel = PolyhedraMat()
gravel.IsSplitable = False
gravel.strength = 7.9e6
gravel.density = 2678#kg/m^3
gravel.young = 5.98e7 #Pa
gravel.poisson =0.3

inputfil="poly-1"
inputfiln=inputfil+".txt"

##################################"

O.engines=[
ForceResetter(),
InsertionSortCollider([PotentialBlock2AABB()],verletDist=0.01),
InteractionLoop(
[Ig2_PB_PB_ScGeom(twoDimension=False, unitWidth2D=1.0)],
[Ip2_FrictMat_FrictMat_KnKsPBPhys(kn_i=1e8, ks_i=1e7, Knormal=1e8, Kshear=1e7, useFaceProperties=False, calJointLength=False, viscousDamping=0.2)],
[Law2_SCG_KnKsPBPhys_KnKsPBLaw(label='law',neverErase=False, allowViscousAttraction=True, traceEnergy=False)]
),
#GlobalStiffnessTimeStepper(),
NewtonIntegrator(damping=0.0,exactAsphericalRot=True,gravity=[0,0,-9.81]),
#PotentialBlockVTKRecorder(fileName='./vtk/Arch-1',iterPeriod=10000,twoDimension=False,sampleX=50,sampleY=50,sampleZ=50,maxDimension=0.2,label='vtkRecorder')
]

###################################

chosenR=0.0001
bbb=Body()
wire=False
color=[0,0.5,1]
highlight=False
bbb.shape=PotentialBlock(k=0.0, r=chosenR, R=0.0, a=[0.4233422835886639,-0.0,-1.0,-0.0,-0.0,-0.2544435504552162,-0.0,0.2256157225428006,0.7071067811865475], b=[-0.4658182304526213,-1.0,0.0,1.0,-0.0,-0.0,0.2924660204513265,-0.5965652970583126,-0.0], c=[-0.4658182304526213,0.0,-0.0,-0.0,1.0,-0.8250734563293101,-0.12273156061799324,-0.4512314450856012,-0.0], d=[0.9630391247904834,1.20623023977275,1.83734355291125,0.79356976022725,1.1039638685226245,1.2066387820121347,0.3419810759564882,0.7092731583297133,1.5290583284351422], id=0)
utils._commonBodySetup(bbb, bbb.shape.volume, bbb.shape.inertia,material='frictionless', pos=[0,0,0], fixed=False)
bbb.state.pos =[0.6733279600737498,3.79366976022725,6.1040638685226245]
bbb.state.ori=bbb.shape.orientation
#bbb.state.ori=Quaternion((0,1,0),pi)
O.bodies.append(bbb)

#create a polyhedron

#################### poly-1.txt file
1 8 9
-1.489228487015 3.0 5.0
-1.489228487015 3.0 7.0
-1.489228487015 5.0 5.0
-0.188776910305 3.349358081818 7.832510948181
2.510771512985 3.0 5.0
2.510771512985 3.0 7.0
2.510771512985 5.0 5.0
2.510771512985 5.0 7.0
1 3 2
7 6 2
7 5 4 6
5 1 0 4
0 2 6 4
5 7 3
1 5 3
3 7 2
0 1 2

 Ali Rafiee (ali-rafiee) said on 2019-11-12: #4

Hi Vasileios,

I see that apparently you have not had time to look at this example.
if you need another example I can do it.
but this problem of orientation is not always solved.

Thanks a lot
Best regards
Ali

 Vasileios Angelidakis (vsangelidakis) said on 2019-11-13: #5

Hi Ali,

Sorry for the late reply. I have checked your MWS and I agree the orientation is not calculated properly in this example.
Thanks for bringing this to my attention.

I will keep you posted when I find the time to track the problem and fix it.
If you feel like having a look in the source code [1], two minds are better than one :)

All the best,
Vasileios

 Launchpad Janitor (janitor) said on 2019-11-20: #6

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

 Ali Rafiee (ali-rafiee) said on 2019-11-22: #7

Hi Vasileios,
I looked at this code in C ++, but I do not have much experience in C ++.
but I think, there is no problem on finding vertex coordinates, but there is a problem on the rotation operation.
I'm counting on you as soon as you find time to try to fix this problem.

Thank you very much
Best regards
Ali

 Launchpad Janitor (janitor) said on 2019-12-08: #8

This question was expired because it remained in the 'Open' state without activity for the last 15 days.