diewald_CV_kit.utility
Class ConvexHullDiwi

java.lang.Object
  extended by diewald_CV_kit.utility.ConvexHullDiwi

public final class ConvexHullDiwi
extends Object

the class ConvexHullDiwi calculates the convex-hull of some given points (Pixel).

the list of convex-hull-points is represented as a double-linked-list, which enables very fast adding/removing of points

Author:
thomas diewald (c) 2011

Constructor Summary
ConvexHullDiwi()
          generate a new convex hull.
 
Method Summary
 void clear()
          clear the convex hull (empty the point list).
 DoubleLinkedList<Pixel> get()
          returns the double-linked list, that represents the convex-hull-points.
 float onSide(Pixel a, Pixel b, Pixel c)
          used for calculating the position of a point "c" according to a line "ab"
 boolean remove(float x, float y)
          if the given coordinates are part of the hull, remove this hull-point.
 boolean remove(Pixel pixel)
          if the coordinates of the given pixel are part of the hull, remove this hull-point.
 ConvexHullDiwi update(ConvexHullDiwi convex_hull)
          update the existing convex-hull, on an other convex-hull.
 ConvexHullDiwi update(int x, int y)
          update the existing convex-hull, on a single coordinate.
 ConvexHullDiwi update(List<Pixel> pixels)
          update the existing convex-hull, on a list of pixels.
 ConvexHullDiwi update(Pixel pixel)
          update the existing convex-hull, on a single pixel.
 ConvexHullDiwi update(Pixel[] pixels)
          update the existing convex-hull, on an array of pixels.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConvexHullDiwi

public ConvexHullDiwi()
generate a new convex hull.

Method Detail

get

public final DoubleLinkedList<Pixel> get()
returns the double-linked list, that represents the convex-hull-points.

Returns:
the double-linked list, that represents the convex-hull-points.

clear

public final void clear()
clear the convex hull (empty the point list).


remove

public final boolean remove(Pixel pixel)
if the coordinates of the given pixel are part of the hull, remove this hull-point.

Parameters:
pixel - the pixel to remove
Returns:
true on success

remove

public final boolean remove(float x,
                            float y)
if the given coordinates are part of the hull, remove this hull-point.

Parameters:
x - the x-coordinate
y - the y-coordinate
Returns:
true on success

update

public final ConvexHullDiwi update(ConvexHullDiwi convex_hull)
update the existing convex-hull, on an other convex-hull.

Parameters:
convex_hull -
Returns:
the current convex-hull-instance itself.

update

public final ConvexHullDiwi update(List<Pixel> pixels)
update the existing convex-hull, on a list of pixels.

Parameters:
pixels -
Returns:
the current convex-hull-instance itself.

update

public final ConvexHullDiwi update(Pixel[] pixels)
update the existing convex-hull, on an array of pixels.

Parameters:
pixels -
Returns:
the current convex-hull-instance itself.

update

public final ConvexHullDiwi update(Pixel pixel)
update the existing convex-hull, on a single pixel.

Parameters:
pixel -
Returns:
the current convex-hull-instance itself.

update

public final ConvexHullDiwi update(int x,
                                   int y)
update the existing convex-hull, on a single coordinate.

Parameters:
x -
y -
Returns:
the current convex-hull-instance itself.

onSide

public final float onSide(Pixel a,
                          Pixel b,
                          Pixel c)
used for calculating the position of a point "c" according to a line "ab"

Parameters:
a - start point of line
b - end point of line
c - point to calculate
Returns:
0 --> c is on same vector > 0 --> c is right from ab < 0 --> c is left from ab


Processing library diewald_CV_kit by Thomas Diewald. (C) 2012