PolygonViewHelper

Helper to make it easier to draw polygon on view

Inheritors

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
open class Edge
Represents edge of polygon with near and far points as well as intersecting lines from other edges pointA handle pointB O========[0]=========O | ^ edgeLine ^ | | | |lineA | lineB | | | | O====================O pointFarA pointFarB
Link copied to clipboard
open class Line
Representation of line Calculates line by two points and finds intersection points with other lines General line formula is a * x + b * y + c = 0

Functions

Link copied to clipboard
open fun checkPolygonSize(polygon: List<Point>): Boolean
Link copied to clipboard
open fun getDrawingPolygon(polygon: List<PointF>, drawingPolygon: List<PointF>)
Processes original polygon with coordinates 0..
Link copied to clipboard
open fun getPolygonFromDrawingPolygon(drawingPolygon: List<PointF>, polygon: List<PointF>)
Processes drawing polygon coordinates to polygon with coordinates 0..
Link copied to clipboard
open fun polygonToLinePoints(polygon: List<PointF>, points: Array<Float>)
Calculates lines points from polygon multiplying 0..1 values by view dimensions and applying rotation matrix.
Link copied to clipboard
open fun polygonToPoints(polygon: List<PointF>, points: Array<Float>)
Calculates points from polygon multiplying 0..1 values by view dimensions and applying rotation matrix.
Link copied to clipboard
open fun setImageSize(width: Int, height: Int)
Set scaled image size that will be drawn on screen
Link copied to clipboard
open fun setLayout(left: Int, top: Int, right: Int, bottom: Int)
Sets layout of surface inside parent to compensate differences between viewport and preview sizes and draw polygon correctly
Link copied to clipboard
open fun setRotation(degrees: Int)
Set rotation in degrees for polygon