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

!= Operator - This operation returns true if the two boxes have different corner points.<br />

Box3 bt = new Box3(new Point3 (1, 20, 20), new Point3(10, 11, 30));<br />

Box3 bt2 = new Box3(new Point3 (1, 20, 30), new Point3(10, 11, 40));<br />

bool result = bt != bt2;<br />

//result is true. boxes have different corners<br />

In this example the two boxes have different corners so they are not equal. They have the<br />

same X and Y dimension but have a different Z range.<br />

== Operator - This operation returns true if the two boxes have the same corner points.<br />

Box3 bt = new Box3(new Point3 (10, 10, 10), new Point3(20, 20, 20));<br />

Box3 bt2 = new Box3(new Point3 (10, 20, 10), new Point3(20, 10, 20));<br />

bool result = bt == bt2;<br />

//result is true. boxes have the same corners<br />

In this example the two boxes actually have the same corners. They are defined using<br />

different corners, but the resulting corners of the boxes are the same.<br />

Box3 has several public methods:<br />

Equals – This method returns true if min and max are the same for two boxes. If two<br />

boxes have the same min and max corners, then by definition they must be equal.<br />

Box3 bt = new Box3(new Point3 (10, 10, 10), new Point3(20, 20, 20));<br />

Box3 bt2 = new Box3(new Point3 (10, 20, 10), new Point3(20, 10, 20));<br />

bool result = bt.Equals(bt2);<br />

//result is true. boxes have the same corners<br />

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

IsInside – This method returns true if the point is inside the box.<br />

Box3 bt = new Box3(new Point3 (1, 2, 3), new Point3(10, 11, 12));<br />

bool result = bt.IsInside(new Point3 (5, 5, 5));<br />

//result is true<br />

result = bt.IsInside(new Point3 (20, 40, 50));<br />

//result is false<br />

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

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

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

Saved successfully!

Ooh no, something went wrong!