문제

I have some code to move a randomly oriented 3D seismic line forwards or backwards similar to the general intersection player. It worked perfectly in Petrel 2011, however it seems to have broken once I updated to 2012. The issue is that the normal direction of the line seems to change by a few decimals when I try to set a new facet. Below is some example code...

SeismicLine3D line = ...;
double distance = ...;
Direction3 direction = ...;
Direction3 normal = ...;

Facet facet = seismicLine3D.Intersection.Facets.ElementAt(0);
Vector3 offset = Vector3.Multiply(distance, direction.NormalizedVector);
Point3 point = Point3.Add(facet.Plane.DefiningPoint, offset);
Plane3 plane = new Plane3(point, normal);
Facet newFacet = new Facet(plane, new Plane3[] {});
IEnumerable<Facet> facets = new Facet[] {newFacet};

using (ITransaction transaction = DataManager.NewTransaction())
{
    transaction.Lock(seismicLine3D);

    try { seismicLine3D.Intersection.Facets = facets; }
    finally { transaction.Commit(); }
}

// BAD!!!
// seismicLine3D.Intersection.Facets.ElementAt(0).Plane.Normal != normal;

Does anyone know what may have changed between Petrel 2011 and 2012 to cause this? Also, does anyone know of a possible work-around?

Edit:
The change in normal orientation is very noticeable when viewing in any toggle window. You will see slight "glitches" in the visualization as the line moves.

도움이 되었습니까?

해결책

The issue is due to rounding during double -> float and float->double conversions. This algorithm modifies slightly its input seismic line at each iteration, causing the computed normal to be slightly different each time because of this rounding issue. Converting the normalized normal to float first increases a bit the precision of the algorithm. But the best work around so far, is to store the first normal and use it at each iteration.

Cheers, Priya

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top