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

Direction2 and Direction3 classes also expose the following static read only<br />

public fields:<br />

Null - The undefined direction has components that are all undefined.<br />

Direction3.Null = (NaN,NaN,NaN)<br />

Zero - Zero direction points in no direction (all components are 0).<br />

Direction3 dir3 = Direction3.Zero;<br />

// dir3 = (0, 0, 0)<br />

The Direction2 and Direction3 classes provide the following public operators:<br />

- (minus) Operator - This operation returns the instance in the opposite direction. This<br />

multiplies the direction X, Y, and Z properties each by -1.<br />

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

Direction3 dir2 = -dir1;<br />

// dir2 = (-10, -20, -30)<br />

+ Operator – This operation adds a direction. The result returns the same instance.<br />

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

Direction3 dir3 = +dir1;<br />

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

== Operator - Ths operation compares two direction objects for equality. Returns true if<br />

the instances are equal. The objects are equal if the X, Y, Z, and NormalizedVector<br />

properties of one match the corresponding property of the other.<br />

• • • • • •<br />

Note:<br />

Comparing Direction3.Null to any other instance will return false. This<br />

is to maintain consistency with the behavior of the floating point NaN<br />

comparison.<br />

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

Direction3 dir2 = new Direction3(10, 20, 40);<br />

bool result = (dir1 == dir2);<br />

//result is false<br />

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

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

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

Saved successfully!

Ooh no, something went wrong!