Friday, March 22, 2002

Area Coordinate Search

Algorithm

Recursive

Name: Search
Variables Received: Elementsearch (first received is the element from which the ideal point was generated)
Variables Returned: Whether or not the ideal point can be found ( Return 1: cannot or Return 0: can )
Containing element for the ideal point ( Elementfound )
Weights for the distribution function values of the containing element's nodes ( PHI1, PHI2, and PHI3 )

Pseudocode

Compute the area of Elementsearch ( Areasearch ).

Compute the area of triangle made by the ideal point and Node 2 and Node 3 of Elementsearch:
Area1 = (Pointn2-Pointideal) x (Pointn3-Pointideal)
Compute the area of triangle made by the ideal point and Node 3 and Node 1 of Elementsearch:
Area2 = (Pointn3-Pointideal) x (Pointn1-Pointideal)
Compute the area of triangle made by the ideal point and Node 1 and Node 2 of Elementsearch:
Area3 = (Pointn1-Pointideal) x (Pointn2-Pointideal)
Compute the minimum of these areas:
Areamin = MIN( Area1, Area2, Area3 )
If Areamin is greater than the negative of the minimum distribution function (-PHImin):
PHI1 = Area1/Areasearch
PHI2 = Area2/Areasearch
PHI3 = Area3/Areasearch
Return 0
If Area1 is negative:
Set Elementsearch to the neighboring element across from Point1.

If this neighbor is not a boundary and hasn't already been searched:
Search the neighbor.

If the containing element is found (i.e. Search Returns 0 ):
Elementfound = Elementsearch
Return 0
Else:
Return 1
Else:
Return 1
If Area2 is negative:
Set Elementsearch to the neighboring element across from Point2.

If this neighbor is not a boundary and hasn't already been searched:
Search the neighbor.

If the containing element is found (i.e. Search Returns 0 ):
Elementfound = Elementsearch
Return 0
Else:
Return 1
Else:
Return 1
If Area3 is negative:
Set Elementsearch to the neighboring element across from Point3.

If this neighbor is not a boundary and hasn't already been searched:
Search the neighbor.

If the containing element is found (i.e. Search Returns 0 ):
Elementfound = Elementsearch
Return 0
Else:
Return 1
Else:
Return 1