02.05.2014 Views

CoreandServices.book - Ocean - Schlumberger

CoreandServices.book - Ocean - Schlumberger

CoreandServices.book - Ocean - Schlumberger

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Coordinate Systems<br />

// Initialize the transformation matrix<br />

if (!(localT.Matrix.MakeRST(lowerLeftXY, lowerLeftIJ,<br />

upperLeftXY, upperLeftIJ,<br />

upperRightXY, upperRightIJ)))<br />

{<br />

Console.WriteLine(“Error setting up local transform matrix.”);<br />

}<br />

// Get the matrix we created to use later.<br />

Matrix4 outMatrix = localT.Matrix;<br />

// Set up forward (X,Y to I,J) and inverse (I,J to X,Y) converters.<br />

ICoordSysConverter xy2ij = localT.ForwardConverter();<br />

ICoordSysConverter ij2xy = localT.InverseConverter();<br />

// Create and convert an X,Y point to I,J and back<br />

Point2 xy = new Point2(150000.0, 150000.0);<br />

Point2 ij = xy2ij.Convert(xy, out status);<br />

// Now convert back<br />

Point2 xyBack = ij2xy.Convert(ij, out status);<br />

This example shows a conversion using the matrix that we have created to transform a<br />

point. Here we initialize the LocalTransform with the matrix and then use the<br />

Convert method to perform the conversion.<br />

// Create the local transform object<br />

LocalTransform localT = new LocalTransform();<br />

...<br />

// Add the previous examples matrix to the transform object<br />

localT.Matrix = ourMatrix;<br />

// Now create a point and convert it.<br />

Point3 xyz = new Point3(120000.0, 75000.0, 1500.0);<br />

Point3 xyzConverted = localT.Convert(xyz, out status);<br />

Translation<br />

LocalTransform may also be used to translate points. Translation is the shifting of a<br />

point’s location by some distance defined by values in X, Y, and Z. The point does not<br />

<strong>Schlumberger</strong> Private<br />

<strong>Ocean</strong> Services 4-223

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!