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

Each direction has multiple constructors. The following examples use Direction3. This<br />

is constructed by three coordinates (X, Y, and Z respectively).<br />

double X = 10;<br />

double Y = 20;<br />

double Z = 30;<br />

Direction3 dir1 = new Direction3(X , Y , Z );<br />

Here is the copy constructor:<br />

Direction3 dir2 = new Direction3(dir1);<br />

Here is the example for instantiation from a Vector3:<br />

Vector3 v = new Vector3(X, Y, Z);<br />

Direction3 dir3 = new Direction3(v);<br />

The public properties for a Direction3 object 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 />

• NormalizedVector- This method gets the unit vector. A unit vector is a vector in the<br />

same direction but with a length of 1.<br />

Direction3 dir1 = new Direction3(10 , 20 , 30 );<br />

double x = dir1.X;<br />

// x = 10<br />

double y = dir1.Y;<br />

// y = 20<br />

double z = dir1.Z;<br />

// z = 30<br />

Vector3 v = dir1.NormalizedVector;<br />

// v.X = 0.267261241912424<br />

// v.Y = 0.534522483824849<br />

// v.Z = 0.801783725737273<br />

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