I’ve fixed some of the bugs I was talking about in the previous post :
- The trajectory : just by increasing the “SegmentSize” property of the curve the bug disappears.
- The borehole : I’ve added a property called “DistanceDirection”. This property uses an averaged direction instead of the real direction when the points are too close.
For example, DistanceDirection = 10.f : if the distance between the p0 and p1 is > 10 => we keep the vector p0p1 as the direction.
the distance between p0 and p1 <10, and if the distance between p0 and p2 <10 too, but the distance between p0 and p3 > 10, then we take the average of p0p1, p0p2, p0p3 as the direction.
Here is the screenshot of the old method :
And here is the new method result :
- The BHA : With the previous dataset all the BHA components were almost aligned so I hadn’t this problem, but now there are some steep angles between two consecutive cylinders, which means there are collisions :
I wrote an algorithm to move cylinders out of each other, without changing the direction of the components :
“P” is the common point to both the cylinders,
V0 is the direction vector from P to the other extremity of the first cylinder.
V1 is the direction vector from P to the other extremity of the second cylinder.
V2 is the normal of the plane containing V0,V1 and P ==> V2 = cross(V0,V1)
V00 is a vector normal to V0 in this plane, its length is the radius of the cylinder 0 : V00 = cross(V0,V2) * Radius_0
V11 is a vector normal to V1 in this plane, its length is the radius of the cylinder 1 : V11 = cross(V1,V2) * Radius_1
Now we want to move each cylinder along its axis of the same distance so that we only have one point of contact left :
t * V0 + V00 = t * V1 + V11
t – t * ( V1 / V0 = (V11 – V00) / V0
t = (V11 – V00) / ( V0 – V1)
We now move the points of each cylinder along their respective axis of “t” times the cylinder direction
Here is the result :
Problems left :
There are still a lot of bugs on the BHA, I think it’s because of the data : some cylinders are very short, and at some points during the drilling operation they are compressed, as a result I get some cylinders like this :
This is impossible to use this to compute the orientation of the component.
This is an accuracy problem, so I can’t really see any solution to that.



