02.05.2014 Views

CoreandServices.book - Ocean - Schlumberger

CoreandServices.book - Ocean - Schlumberger

CoreandServices.book - Ocean - Schlumberger

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Geometry<br />

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

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

bool result = (vt1 == vt2);<br />

//result is false<br />

!= Operator - This operation compares two vector objects for inequality. Returns true if<br />

the instances are not equal. The objects are defined as not equal if any of their X, Y, or Z<br />

properties does not match the same property of the other.<br />

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

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

bool result = (vt1 != vt2);<br />

//result is true<br />

double – This operation implicitly casts a Vector instance to an array of double<br />

values containing the Vector X, Y, and Z properties. The double operator returns an<br />

array of values representing the ordered properties of the vector. An exception will be<br />

thrown if the size of the array does not match the number of properties output by the<br />

double method. The operator is defined as:<br />

public static implicit[ ] operator double(Vector3 arg);<br />

Given a Vector3 defined to contain an X of 10, Y of 20, and Z of 30, the double<br />

representation will be an array of {10, 20, 30}.<br />

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

Double[ ] dblArray = vt1;<br />

//dblArray = { 10.0, 20.0, 30.0 }<br />

Vector Operator (Vector2 or Vector3) – The Vector operator will explicitly cast an array<br />

of doubles to a Vector object. The values in the array will be defined as the X, Y, and Z<br />

properties respectively. The array size must match the dimension of the Vector object,<br />

i.e. two values for a Vector2 and three values for a Vector3. Otherwise an exception is<br />

raised. The operator is defined as:<br />

public static explicit operator Vector3 (double[ ] arg);<br />

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

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

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

Saved successfully!

Ooh no, something went wrong!