-
public class PolygonHelperHelper to make it easier to draw polygon on view
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classPolygonHelper.EdgeRepresents edge of polygon with near and far pointsas well as intersecting lines from other edges
pointA handle pointBO========[0]=========O| ^ edgeLine ^ || ||lineA | lineB| || |O====================OpointFarA pointFarB
public classPolygonHelper.LineRepresentation of line
Calculates line by two pointsand finds intersection points with other linesGeneral line formula isa * x + b * y + c = 0
-
Field Summary
Fields Modifier and Type Field Description private introtation
-
Method Summary
Modifier and Type Method Description voidsetRotation(int degrees)Set rotation in degrees for polygon static booleancheckPolygonSize(List<Point> polygon)voidsetImageSize(int width, int height)Set scaled image size that will be drawn on screen voidsetLayout(int left, int top, int right, int bottom)Sets layout of surface inside parent to compensate differencesbetween viewport and preview sizes and draw polygon correctly voidpolygonToLinePoints(List<PointF> polygon, Array<float> points)Calculates lines points from polygon multiplying 0..1 values by view dimensionsand applying rotation matrix. voidpolygonToPoints(List<PointF> polygon, Array<float> points)Calculates points from polygon multiplying 0..1 values by view dimensionsand applying rotation matrix. voidgetDrawingPolygon(List<PointF> polygon, List<PointF> drawingPolygon)Processes original polygon with coordinates 0.. voidgetPolygonFromDrawingPolygon(List<PointF> drawingPolygon, List<PointF> polygon)Processes drawing polygon coordinatesto polygon with coordinates 0.. List<Line2D>scaleLines(List<Line2D> lines)Performs scaling from 0.. -
-
Method Detail
-
setRotation
void setRotation(int degrees)
Set rotation in degrees for polygon
- Parameters:
degrees- usually camera rotation angle is used here
-
checkPolygonSize
static boolean checkPolygonSize(List<Point> polygon)
-
setImageSize
void setImageSize(int width, int height)
Set scaled image size that will be drawn on screen
-
setLayout
void setLayout(int left, int top, int right, int bottom)
Sets layout of surface inside parent to compensate differencesbetween viewport and preview sizes and draw polygon correctly
-
polygonToLinePoints
void polygonToLinePoints(List<PointF> polygon, Array<float> points)
Calculates lines points from polygon multiplying 0..1 values by view dimensionsand applying rotation matrix.Usually used on preview as it has camera rotation
-
polygonToPoints
void polygonToPoints(List<PointF> polygon, Array<float> points)
Calculates points from polygon multiplying 0..1 values by view dimensionsand applying rotation matrix.Usually used on preview as it has camera rotation
-
getDrawingPolygon
void getDrawingPolygon(List<PointF> polygon, List<PointF> drawingPolygon)
Processes original polygon with coordinates 0..1to drawing polygon by multiplying them by view dimensions
-
getPolygonFromDrawingPolygon
void getPolygonFromDrawingPolygon(List<PointF> drawingPolygon, List<PointF> polygon)
Processes drawing polygon coordinatesto polygon with coordinates 0..1 by dividing them by view dimensions
-
scaleLines
List<Line2D> scaleLines(List<Line2D> lines)
Performs scaling from 0..1 values to image pixel values
-
-
-
-