t

# Polygon

### Companion object Polygon

#### traitPolygon extends Shape with BoundedElem with Approx[Double] with PolygonLike[Pt2]

A mathematical closed polygon. The general case can be instantiated with PolygonImp, but it provides the interface for particular sub sets of polygons such as triangles and square. Mathematically a closed polygon made up of straight line segments. The default convention is to number the vertices in a clockwise direction, with vertex 1 the first vertex that is clockwise from 12 O'Clock. Sides are numbered in a corresponding manner with then end point of side n sdn at vertex n.

Linear Supertypes
Known Subclasses
Ordering
1. Alphabetic
2. By Inheritance
Inherited
1. Polygon
2. PolygonLike
3. Approx
4. Equals
5. Shape
6. BoundedElem
7. Fillable
8. Drawable
9. GeomElem
10. AnyRef
11. Any
1. Hide All
2. Show All
Visibility
1. Public
2. Protected

### Abstract Value Members

1. abstract def foreachVert[U](f: (Pt2) => U): Unit

Performs the side effecting function on the Pt2 value of each vertex.

Performs the side effecting function on the Pt2 value of each vertex.

Definition Classes
PolygonPolygonLike
2. abstract def foreachVertPairTail[U](f: (Double, Double) => U): Unit

Foreach vertex excluding vertex 1, perform the side effecting function on the Tuple2 of the x and y values of the vertex.

3. abstract def foreachVertTail[U](f: (Pt2) => U): Unit

Performs the side effecting function on the Pt2 value of each vertex, excluding vertex v1.

4. abstract def v1: Pt2

The 1st vertex, will throw on a 0 vertices polygon.

5. abstract def v1x

The X component of the 1st vertex, will throw on a 0 vertices polygon.

6. abstract def v1y

The Y component of the 1st vertex, will throw on a 0 vertices polygon.

7. abstract def vert(index: Int): Pt2

Returns the vertex of the given index.

Returns the vertex of the given index. Throws if the index is out of range, if it less than 1 or greater than the number of vertices.

8. abstract def vertsArray: Array[Double]

The vertices of this Polygon in an Array of Doubles.

9. abstract def vertsArrayX: Array[Double]

The X component of the vertices of this Polygon in an Array of Doubles.

10. abstract def vertsArrayY: Array[Double]

The Y component of the vertices of this Polygon in an Array of Doubles.

11. abstract def vertsNum: Int

The number of vertices and also the number of sides in this Polygon.

12. abstract def xVert(index: Int)

Returns the X component of the vertex of the given number.

Returns the X component of the vertex of the given number. Will throw an exception if the vertex index is out of range.

13. abstract def yVert(index: Int)

Returns the Y component of the vertex of the given number.

Returns the Y component of the vertex of the given number. Will throw an exception if the vertex index is out of range.

### Concrete Value Members

1. final def !=(arg0: Any)
Definition Classes
AnyRef → Any
2. final def ##: Int
Definition Classes
AnyRef → Any
3. final def ==(arg0: Any)
Definition Classes
AnyRef → Any
4. def active(id: Any)
5. def activeChildren(id: Any, children: GraphicElems)
6. def approx(that: Any, precision: Double)
Definition Classes
PolygonApprox
7. final def asInstanceOf[T0]: T0
Definition Classes
Any
8. def attribs: Arr[XANumeric]
Definition Classes
PolygonShape
9. def blBounding: Pt2
Definition Classes
BoundedElem
10. final def boundCen: Pt2

The centre of the bounding rectangle.

The centre of the bounding rectangle. consider also using cenDefault.

Definition Classes
BoundedElem
Annotations
@inline()
11. def boundingHeight
Definition Classes
BoundedElem
12. def boundingRect

Currently throws, not sure if that is the correct behaviour.

Currently throws, not sure if that is the correct behaviour. Creates a bounding rectangle for a collection of 2d points

Definition Classes
PolygonBoundedElem
13. def boundingWidth

The width of the BoundingRect of this object.

The width of the BoundingRect of this object.

Definition Classes
BoundedElem
14. def brBounding: Pt2
Definition Classes
BoundedElem
15. def canEqual(that: Any)

This canEqual override allow the comparison of Shapes.

This canEqual override allow the comparison of Shapes.

Definition Classes
Shape
16. def cenDefault: Pt2

If the geometric element has a defined centre then the cenDefault uses that, else it defaults to the centre of the bounding rectangle.

If the geometric element has a defined centre then the cenDefault uses that, else it defaults to the centre of the bounding rectangle.

Definition Classes
BoundedElem
17. def cenPt: Pt2

The centre point of this Polygon.

The centre point of this Polygon. The default centre for Polygons is the centre of the bounding rectangle.

18. def cenVec: Vec2
19. def clone()
Attributes
protected[lang]
Definition Classes
AnyRef
Annotations
@throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
20. def draw(lineColour: Colour = Black, lineWidth: Double = 2)

Draws this geometric element to produce a GraphElem graphical element, tht can be displayed or printed.

Draws this geometric element to produce a GraphElem graphical element, tht can be displayed or printed.

Definition Classes
PolygonShapeDrawable
21. def drawActive(lineColour: Colour = Black, lineWidth: Double = 2, pointerID: Any)
22. final def eq(arg0: AnyRef)
Definition Classes
AnyRef
23. def equals(arg0: AnyRef)
Definition Classes
AnyRef → Any
24. def fill(fillColour: Colour)

Returns a fill graphic of this geometric object.

Returns a fill graphic of this geometric object.

Definition Classes
PolygonShapeFillable
25. def fillActive(fillColour: Colour, pointerID: Any)
26. def fillActiveDraw(fillColour: Colour, pointerID: Any, lineColour: Colour = Black, lineWidth: Double = 2)

Creates a PolygonCompound graphic that is active with a simple 1 colour fill and has a draw graphic for the Polygon.

Creates a PolygonCompound graphic that is active with a simple 1 colour fill and has a draw graphic for the Polygon. The default values for the draw area line width of 2 and a colour of Black.

27. def fillDraw(fillColour: Colour, lineColour: Colour, lineWidth: Double)

Returns a fill and draw graphic of this geometric object.

Returns a fill and draw graphic of this geometric object.

Definition Classes
PolygonFillable
28. def fillDrawActive(fillColour: Colour, pointerID: Any, lineWidth: Double, lineColour: Colour = Black)
29. def fillDrawText(fillColour: Colour, str: String, fontSize: Int = 24, lineColour: Colour = Black, lineWidth: Double = 2.0)
30. def fillDrawTextActive(fillColour: Colour, pointerID: Any, str: String, fontSize: Int = 24, lineWidth: Double, lineColour: Colour = Black, align: TextAlign = CenAlign)
31. def fillInt(intValue: Int)

Returns a fill graphic of this geometric object from the Int RGBA value.

Returns a fill graphic of this geometric object from the Int RGBA value.

Definition Classes
PolygonShapeFillable
32. def fillText(fillColour: Colour, str: String, fontSize: Int = 10, textColour: Colour = Black, layer: Int = 0)
33. def fillTextActive(fillColour: Colour, pointerEv: Any, str: String, fontSize: Int = 24, fontColour: Colour = Black, align: TextAlign = CenAlign)
34. final def getClass(): Class[_ <: AnyRef]
Definition Classes
AnyRef → Any
Annotations
@native() @HotSpotIntrinsicCandidate()
35. def hashCode(): Int
Definition Classes
AnyRef → Any
Annotations
@native() @HotSpotIntrinsicCandidate()
36. def insVert(insertionPoint: Int, newVec: Pt2)

Insert vertex.

37. def insVerts(insertionPoint: Int, newVecs: Pt2*)

Insert vertices before the specified insertion vertex.

38. final def isInstanceOf[T0]
Definition Classes
Any
39. final def ne(arg0: AnyRef)
Definition Classes
AnyRef
40. def negX

Mirror, reflection transformation of Polygon across the Y axis, returns a Polygon.

Mirror, reflection transformation of Polygon across the Y axis, returns a Polygon.

Definition Classes
PolygonShapeDrawableGeomElem
41. def negY

Mirror, reflection transformation of a Polygon across the X axis, returns a Polygon.

Mirror, reflection transformation of a Polygon across the X axis, returns a Polygon.

Definition Classes
PolygonShapeDrawableGeomElem
42. final def notify(): Unit
Definition Classes
AnyRef
Annotations
@native() @HotSpotIntrinsicCandidate()
43. final def notifyAll(): Unit
Definition Classes
AnyRef
Annotations
@native() @HotSpotIntrinsicCandidate()
44. def parentFillText(pointerID: Any, fillColour: Colour, str: String, fontSize: Int = 10, textColour: Colour = Black, align: TextAlign = CenAlign)
45. def polygonMap(f: (Pt2) => Pt2)
Annotations
@inline()
46. def precisionDefault
Definition Classes
PolygonApprox
47. def prolign(matrix: ProlignMatrix)

Prolign 2d transformations, similar transformations that retain alignment with the axes.

Prolign 2d transformations, similar transformations that retain alignment with the axes.

Definition Classes
PolygonShapeDrawableGeomElem
48. def ptInside(pt: Pt2)

Determines if the parameter point lies inside this Polygon.

49. def reflect(lineLike: LineLike)

Reflect 2D geometric transformation across a line, line segment or ray on a polygon, returns a Polygon.

Reflect 2D geometric transformation across a line, line segment or ray on a polygon, returns a Polygon. The Return type will be narrowed in sub traits / classes.

Definition Classes
PolygonShapeDrawableGeomElem
50. def rotate(angle: AngleVec)

Rotation 2D geometric transformation on a Polygon, taking the rotation as a scalar measured in radians, returns a Polygon.

Rotation 2D geometric transformation on a Polygon, taking the rotation as a scalar measured in radians, returns a Polygon. The Return type will be narrowed in some but not all sub traits / classes.

Definition Classes
PolygonShapeDrawableGeomElem
51. def rotate180

Rotation of 180 degrees, 2D geometric transformation on a Drawable, returns a Drawable.

Rotation of 180 degrees, 2D geometric transformation on a Drawable, returns a Drawable. The return type will be narrowed in sub classes and traits.

Definition Classes
PolygonShapeDrawableGeomElem
52. def rotate270

Rotation positive or anti clockwise 270 degrees, 2D geometric transformation on a Drawable, returns a Drawable.

Rotation positive or anti clockwise 270 degrees, 2D geometric transformation on a Drawable, returns a Drawable. The return type will be narrowed in sub classes and traits.

Definition Classes
PolygonShapeDrawableGeomElem
53. def rotate90

Rotation positive or anti clockwise 90 degrees, 2D geometric transformation on a Drawable, returns a Drawable.

Rotation positive or anti clockwise 90 degrees, 2D geometric transformation on a Drawable, returns a Drawable. The return type will be narrowed in sub classes and traits.

Definition Classes
PolygonShapeDrawableGeomElem
54. def scale(operand: Double)

Uniform scaling against both X and Y axes transformation on a polygon returning a Polygon.

Uniform scaling against both X and Y axes transformation on a polygon returning a Polygon. Use the xyScale method for differential scaling. The return type of this method will be narrowed further in descendant traits / classes.

Definition Classes
PolygonShapeDrawableGeomElem
55. def scaleXY(xOperand: Double, yOperand: Double)

XY scaling 2D geometric transformation on a Polygon returns a Polygon.

XY scaling 2D geometric transformation on a Polygon returns a Polygon. This allows different scaling factors across X and Y dimensions. The return type will be narrowed in some, but not all descendant Polygon types.

Definition Classes
PolygonShapeDrawableGeomElem
56. def shearX(operand: Double)

Shear 2D geometric transformation along the X Axis on a Polygon, returns a Polygon.

Shear 2D geometric transformation along the X Axis on a Polygon, returns a Polygon. The return type will be narrowed in some but not all sub classes and traits.

Definition Classes
PolygonShapeDrawableGeomElem
57. def shearY(operand: Double)

Shear 2D geometric transformation along the Y Axis on a Polygon, returns a Polygon.

Shear 2D geometric transformation along the Y Axis on a Polygon, returns a Polygon. The return type will be narrowed in sub classes and traits.

Definition Classes
PolygonShapeDrawableGeomElem
58. def side(index: Int)
Annotations
@inline()
59. def sideForeach(f: (LineSeg) => Unit): Unit

foreachs over the sides or edges of the Polygon These are of type LineSeg.

60. def sideIForeach(initCount: Int = 0)(f: (LineSeg, Int) => Unit): Unit

foreachs over the sides or edges of the Polygon These are of type LineSeg.

61. def sidesIFlatMap[AA <: ArrImut[_]](initCount: Int = 0)(f: (LineSeg, Int) => AA)(implicit build: ArrTFlatBuilder[AA]): AA

maps with a integer counter over the sides or edges of the Polygon These are of type LineSeg.

62. def sidesIMap[A, AA <: ArrImut[A]](initCount: Int = 0)(f: (LineSeg, Int) => A)(implicit build: ArrTBuilder[A, AA]): AA

maps with a integer counter over the sides or edges of the Polygon These are of type LineSeg.

63. def sidesMap[A, AA <: ArrImut[A]](f: (LineSeg) => A)(implicit build: ArrTBuilder[A, AA]): AA

maps over the sides or edges of the Polygon These are of type LineSeg.

64. def slate(offset: Vec2Like)

Translate geometric transformation on a Polygon returns a Polygon.

Translate geometric transformation on a Polygon returns a Polygon. The return type of this method will be narrowed further in most descendant traits / classes. The exceptions being those classes where the centring of the geometry at the origin is part of the type.

65. def slateXY(xDelta: Double, yDelta: Double)

Translate geometric transformation on a Polygon returns a Polygon.

Translate geometric transformation on a Polygon returns a Polygon. The return type of this method will be narrowed further in most descendant traits / classes. The exceptions being those classes where the centring of the geometry at the origin is part of the type.

Definition Classes
PolygonShapeDrawableGeomElem
66. def sline(index: Int)
67. final def synchronized[T0](arg0: => T0): T0
Definition Classes
AnyRef
68. def tlBounding: Pt2
Definition Classes
BoundedElem
69. def toLineSegs

Converts this closed Polygon to LineSegs.

Converts this closed Polygon to LineSegs. The LineSegs collection is empty of there are less than 2 vertices.

70. def toString()
Definition Classes
AnyRef → Any
71. def trBounding: Pt2
Definition Classes
BoundedElem
72. def vLast: Pt2

The last vertex will throw an exception on a 0 vertices polygon.

73. def vertsFoldLeft[B](initial: B)(f: (B, Pt2) => B): B
74. def vertsIFlatMap[BB <: ArrImut[_]](iInit: Int = 0)(f: (Pt2, Int) => BB)(implicit build: ArrTFlatBuilder[BB]): BB

flatMap with index to an immutable Arr.

75. def vertsMap[A, ArrT <: ArrImut[A]](f: (Pt2) => A)(implicit build: ArrTBuilder[A, ArrT]): ArrT
76. def vertsTrans(f: (Pt2) => Pt2)

A function that takes a 2D geometric transformation on a Pt2 as a parameter and performs the transformation on all the vertices returning a new transformed Polygon

77. final def wait(arg0: Long, arg1: Int): Unit
Definition Classes
AnyRef
Annotations
@throws(classOf[java.lang.InterruptedException])
78. final def wait(arg0: Long): Unit
Definition Classes
AnyRef
Annotations
@throws(classOf[java.lang.InterruptedException]) @native()
79. final def wait(): Unit
Definition Classes
AnyRef
Annotations
@throws(classOf[java.lang.InterruptedException])

### Deprecated Value Members

1. def finalize(): Unit
Attributes
protected[lang]
Definition Classes
AnyRef
Annotations
@throws(classOf[java.lang.Throwable]) @Deprecated
Deprecated