Back to class indexx | y | zero[static][const] | one[static][const] | unitX[static][const] | unitY[static][const] | nan[static][const] | inf[static][const] | ctor (+3 overloads) | ptr() (+1 overload) | operator[](index) (+1 overload) | At(index) (+1 overload) | operators +,-,*,/(v)[const] (+1 overload) | operators +=,-=,*=,/=(v) | Add/Sub/Mul/Div(v)[const] (+1 overload) | xx/xy/yx/yy()[const] | Swizzled(i,j,k,l)[const] (+2 overloads) | SetFromScalar(scalar) | Set(x,y) | SetFromPolarCoordinates(theta,length) (+1 overload) | ToPolarCoordinates()[const] | AimedAngle()[const] | Length()[const] | LengthSq()[const] | Normalize() | Normalized()[const] | ScaleToLength(newLength) | ScaledToLength(newLength)[const] | IsNormalized(epsilonSq)[const] | IsZero(epsilonSq)[const] | IsFinite()[const] | IsPerpendicular(other,epsilonSq)[const] | Equals(other,epsilon)[const] (+1 overload) | BitEquals(other)[const] | ToString()[const] | SerializeToString()[const] | SerializeToCodeString()[const] | SumOfElements()[const] | ProductOfElements()[const] | AverageOfElements()[const] | MinElement()[const] | MinElementIndex()[const] | MaxElement()[const] | MaxElementIndex()[const] | Abs()[const] | Neg()[const] | Recip()[const] | Min(ceil)[const] (+1 overload) | Max(floor)[const] (+1 overload) | Clamp(floor,ceil)[const] (+1 overload) | Clamp01()[const] | Distance(point)[const] | DistanceSq(point)[const] | Dot(v)[const] | Perp()[const] | PerpDot(rhs)[const] | Rotate90CW() | Rotated90CW()[const] | Rotate90CCW() | Rotated90CCW()[const] | Reflect(normal)[const] | Refract(...)[const] | ProjectTo(direction)[const] | ProjectToNorm(direction)[const] | AngleBetween(other)[const] | AngleBetweenNorm(normalizedVector)[const] | Decompose(...)[const] | Lerp(b,t)[const] | FromScalar(scalar)[static] | FromPolarCoordinates(theta,length)[static] (+1 overload) | FromString(str,outEndStr)[static] (+1 overload) | Lerp(a,b,t)[static] | Orthogonalize(a,b)[static] | AreOrthogonal(a,b,epsilon)[static] | Orthonormalize(a,b)[static] | OrientedCCW(a,b,c)[static] | ConvexHull(...)[static] | ConvexHullInPlace(...)[static] | ConvexHullContains(...)[static] | MinAreaRectInPlace(...)[static] | RandomDir(lcg,length)[static] | RandomBox(...)[static] |
| float2::ConvexHullInPlaceSyntaxint float2::ConvexHullInPlace(float2 *pointArray, int numPoints); [104 lines of code]Computes the 2D convex hull of the given point set, in-place. This function implements the Graham's Scan algorithm for finding the convex hull of a 2D point set. This version of the algorithm works in-place, meaning that when the algorithm finishes, pointArray will contain the list of the points on the convex hull.
The running time is O(nlogn). For details, see "Introduction to Algorithms, 2nd ed.", by Cormen, Leiserson, Rivest, p.824, or a lecture by Shai Simonson: http://www.aduni.org/courses/algorithms/index.php?view=cw , lecture 02-13-01. Note As a convention, the convex hull winds counter-clockwise when graphed in the xy plane where +x points to the right and +y points up. That is, walking along the polylist intArray[0] -> pointArray[1] -> pointArray[2] -> ... -> pointArray[numPoints-1] -> pointArray[0] performs a counter-clockwise tour. Parametersfloat2 *pointArray [in, out] Return ValueThe number of points on the convex hull, i.e. the number of elements used in pointArray after the operation. See Also ConvexHull(). |