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.

Geometry<br />

Given an array containing the values {10, 20, 30}, the Vector3 object created will have a<br />

value of 10 for X, 20 for Y, and 30 for Z.<br />

Vector3 vt3 = (Vector3)dblArray;<br />

//vt3 = (10, 20, 30)<br />

Vector2 and Vector3 classes provide the following public methods:<br />

Cross - This method computes the cross product of two vectors.<br />

Vector3 vt1 = new Vector3(10, 20, 30);<br />

Vector3 vt2 = new Vector3(20, 30, 40);<br />

Vector3 vt3 = Vector3.Cross(vt1, vt2);<br />

//vt3 = (-100,200,-100)<br />

The cross product is computed as X = (20 * 40) – (30 * 30) = -100, Y = (30 * 20) – (10 *<br />

40) = 200, and Z = (10 * 30) – (20 * 20) = -100.<br />

Dot - This method computes the dot product of two vectors. A higher precision value is<br />

returned to preserve significant digits in the calculation.<br />

// (X1, Y1, Z1)<br />

Vector3 vt1 = new Vector3(10, 20, 30);<br />

// (X2, Y2, Z2)<br />

Vector3 vt2 = new Vector3(20, 30, 40);<br />

double dblVal = Vector3.Dot(vt1, vt2);<br />

//dblval = = 2000<br />

Equals - This method compares this instance with another object reference for equality.<br />

Returns true if this instance is the same as the other object reference.<br />

GetHashCode - This method gets the hash code for this instance.<br />

GetNormalized - This method gets the normalized vector computed from the input<br />

vector. If the norm of the input vector is 0, then the null vector will be returned.<br />

Vector3 vt1 = new Vector3(10, 20, 30);<br />

Vector3 vt3 = Vector3.GetNormalized(vt1);<br />

//vt3 = (0.267, 0.534, 0.801)<br />

4-148 <strong>Ocean</strong> Application Development Framework 2008.1<br />

<strong>Schlumberger</strong> Private

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

Saved successfully!

Ooh no, something went wrong!