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 />

and therefore has a Z component. The following sections detail the constructors,<br />

properties, and methods available.<br />

Each vector type has multiple constructors. The following examples use Vector3. This is<br />

construction by three coordinates (X, Y, and Z respectively):<br />

double x = 10 ;<br />

double y = 20 ;<br />

double z = 30 ;<br />

vector3 v = new Vector3( x, y, z) ;<br />

Here is the copy constructor:<br />

Vector3 V2 = new Vector3 (v);<br />

The public properties for Vector3 class are:<br />

• X - This property gets the x-coordinate of the instance.<br />

• Y - This property gets the y-coordinate of the instance.<br />

• Z - This property gets the z-coordinate of the instance.<br />

• Norm - This property computes the norm of this instance. The norm is the square root<br />

of the dot product of the object with itself.<br />

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

double x = vt.X;<br />

// x = 20<br />

double y = vt.Y ;<br />

// y = 30<br />

double z = vt.Z ;<br />

// z = 40<br />

double norm = vt.Norm<br />

// norm = = 53.8516<br />

Vector2 and Vector3 classes also expose the following static read only public<br />

fields:<br />

4-144 <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!