diewald_CV_kit.utility
Class Polyline

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

public abstract class Polyline
extends Object

the class Polyline provides some convenient static methods to edit/analyse/etc. polygons.

Author:
thomas diewald (c) 2011

Method Summary
static float AREA(Contour contour)
          returns the surface area of the contour
static float AREA(ConvexHullDiwi convex_hull)
          returns the surface area of the convex_hull
static float AREA(List<Pixel> polyline)
          returns the surface area of the polyline
static float AREA(Pixel[] polyline)
          returns the surface area of the polyline
static double distance(float x1, float y1, float x2, float y2)
          returns the distance between two coordinate pairs
static double distance(Pixel p1, Pixel p2)
          returns the distance between two pixels
static float distancePoint2Line(Pixel p1, Pixel p2, Pixel p3)
          returns the shortest distance of a point(p3) to a line (p1-p2)
static boolean INSIDE(Contour contour, int x, int y)
          check if a given coordinate pair is inside a contour.
static boolean INSIDE(ConvexHullDiwi convex_hull, int x, int y)
          check if a given coordinate pair is inside a convex_hull.
static boolean INSIDE(List<Pixel> polyline, int x, int y)
          check if a given coordinate pair is inside a polyline.
static boolean INSIDE(Pixel[] polyline, int x, int y)
          check if a given coordinate pair is inside a polyline.
static float LENGTH(Contour contour)
          returns the length of the contour
static float LENGTH(ConvexHullDiwi convex_hull)
          returns the length of the convex_hull
static float LENGTH(List<Pixel> polyline)
          returns the length of the polyline
static float LENGTH(Pixel[] polyline)
          returns the length of the polyline
static ArrayList<Pixel> SIMPLIFY(Contour contour, int step, float max_offset)
          returns a new simplified polyline, from a given contour
static ArrayList<Pixel> SIMPLIFY(ConvexHullDiwi convex_hull, int step, float max_offset)
          returns a new simplified polyline, from a given convex_hull
static ArrayList<Pixel> SIMPLIFY(List<Pixel> polyline, int step, float max_offset)
          returns a new simplified polyline, from a given polyline
static ArrayList<Pixel> SIMPLIFY(Pixel[] polyline, int step, float max_offset)
          returns a new simplified polyline, from a given polyline
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

AREA

public static final float AREA(Pixel[] polyline)
returns the surface area of the polyline

Parameters:
polyline - the polyline to get the length from
Returns:
returns the surface area of the polyline

AREA

public static final float AREA(List<Pixel> polyline)
returns the surface area of the polyline

Parameters:
polyline - the polyline to get the length from
Returns:
returns the surface area of the polyline

AREA

public static final float AREA(Contour contour)
returns the surface area of the contour

Parameters:
contour - the polyline to get the length from
Returns:
returns the surface area of the contour

AREA

public static final float AREA(ConvexHullDiwi convex_hull)
returns the surface area of the convex_hull

Parameters:
convex_hull - the polyline to get the length from
Returns:
returns the surface area of the convex_hull

LENGTH

public static final float LENGTH(Pixel[] polyline)
returns the length of the polyline

Parameters:
polyline - the polyline to get the length from
Returns:
returns the length of the polyline

LENGTH

public static final float LENGTH(List<Pixel> polyline)
returns the length of the polyline

Parameters:
polyline - the polyline to get the length from
Returns:
returns the length of the polyline

LENGTH

public static final float LENGTH(Contour contour)
returns the length of the contour

Parameters:
contour - the polyline to get the length from
Returns:
returns the length of the contour

LENGTH

public static final float LENGTH(ConvexHullDiwi convex_hull)
returns the length of the convex_hull

Parameters:
convex_hull - the polyline to get the length from
Returns:
returns the length of the convex_hull

SIMPLIFY

public static final ArrayList<Pixel> SIMPLIFY(Contour contour,
                                              int step,
                                              float max_offset)
returns a new simplified polyline, from a given contour

Parameters:
contour - to simplify
step - the number of vertices in a row, that are checked for the maximum offset
max_offset - maximum offset a vertice can have
Returns:
new simplified polygon

SIMPLIFY

public static final ArrayList<Pixel> SIMPLIFY(ConvexHullDiwi convex_hull,
                                              int step,
                                              float max_offset)
returns a new simplified polyline, from a given convex_hull

Parameters:
convex_hull - to simplify
step - the number of vertices in a row, that are checked for the maximum offset
max_offset - maximum offset a vertice can have
Returns:
new simplified polygon

SIMPLIFY

public static final ArrayList<Pixel> SIMPLIFY(List<Pixel> polyline,
                                              int step,
                                              float max_offset)
returns a new simplified polyline, from a given polyline

Parameters:
polyline - to simplify
step - the number of vertices in a row, that are checked for the maximum offset
max_offset - maximum offset a vertice can have
Returns:
new simplified polygon

SIMPLIFY

public static final ArrayList<Pixel> SIMPLIFY(Pixel[] polyline,
                                              int step,
                                              float max_offset)
returns a new simplified polyline, from a given polyline

Parameters:
polyline - to simplify
step - the number of vertices in a row, that are checked for the maximum offset
max_offset - maximum offset a vertice can have
Returns:
new simplified polygon

INSIDE

public static final boolean INSIDE(Pixel[] polyline,
                                   int x,
                                   int y)
check if a given coordinate pair is inside a polyline. this method uses java.awt.Polygon;


INSIDE

public static final boolean INSIDE(List<Pixel> polyline,
                                   int x,
                                   int y)
check if a given coordinate pair is inside a polyline. this method uses java.awt.Polygon;


INSIDE

public static final boolean INSIDE(Contour contour,
                                   int x,
                                   int y)
check if a given coordinate pair is inside a contour. this method uses java.awt.Polygon;


INSIDE

public static final boolean INSIDE(ConvexHullDiwi convex_hull,
                                   int x,
                                   int y)
check if a given coordinate pair is inside a convex_hull. this method uses java.awt.Polygon;


distance

public static final double distance(Pixel p1,
                                    Pixel p2)
returns the distance between two pixels


distance

public static final double distance(float x1,
                                    float y1,
                                    float x2,
                                    float y2)
returns the distance between two coordinate pairs


distancePoint2Line

public static final float distancePoint2Line(Pixel p1,
                                             Pixel p2,
                                             Pixel p3)
returns the shortest distance of a point(p3) to a line (p1-p2)



Processing library diewald_CV_kit by Thomas Diewald. (C) 2012