PolygonLike

trait PolygonLike[VT]

A Polygon like object, where the points dimensions could be specified in 2D or 3D Length, latitude and longitude etc as well as the regular scalar values of the standard Polygon.

Type parameters:
VT

The type of the vertices in this polygon like trait. For a standard Polygon this will be a Pt2, but for example for a PolygonM3 it would be a PtM3.

class Any
trait Polygon
trait HexReg
class HexRegImp
trait Hexlign
class HexParrX
class HexParrY
trait Rectangle
class PhiRect
class PhiRectY
trait Rect
class RectImp
class Sqlign
trait RectS2S4
class SquareImp
trait Square
trait Triangle
trait PolygonValueN[VT]
trait PolygonDblNs[VT]
trait PolygonDbl2s[VT]
class PolygonM
class PolygonLL
trait PolygonDbl3s[VT]
class PolygonM3
trait PolygonIntNs[VT]
trait PolygonInt2s[VT]
class PolygonHC

Type members

Types

type SideT <: LineSegLike[VT]

Value members

Abstract methods

def sidesForeach[U](f: SideT => U): Unit
def vert(index: Int): VT

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.

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.

def vertsFold[B](init: B)(f: (B, VT) => B): B

Folds over the vertices.

Folds over the vertices.

Type parameters:
B

type of the accumulator return value of this method.

def vertsForeach[U](f: VT => U): Unit

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

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

def vertsIForeach[U](f: (Int, VT) => Any): Unit

Index with foreach on each vertx. Applies the side effecting function on the index with the value of each vertex. Note the function signature follows the foreach based convention of putting the collection element 2nd or last as seen for example in fold methods' (accumulator, element) => B signature.

Index with foreach on each vertx. Applies the side effecting function on the index with the value of each vertex. Note the function signature follows the foreach based convention of putting the collection element 2nd or last as seen for example in fold methods' (accumulator, element) => B signature.

def vertsMap[B, ArrB <: SeqImut[B]](f: VT => B)(implicit builder: ArrBuilder[B, ArrB]): ArrB

Maps the vertices of this polygon to an immutable Array like sequence of type B.

Maps the vertices of this polygon to an immutable Array like sequence of type B.

Type parameters:
ArrB

The type of the immutable Array like sequence of B.

B

The element type of the returned sequence.

Returns:

the immutable sequence collection by applying the supplied function to each vertex.

def vertsNum: Int

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

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

def vertsPrevForEach[U](f: (VT, VT) => U): Unit

This method does nothing if the vertNum < 2. Foreach vertex applies the side effecting function to the previous vertex with each vertex. The previous vertex to the first vertex is the last vertex of the PolygonLike. Note the function signature (previous, vertex) => U follows the foreach based convention of putting the collection element 2nd or last as seen for example in fold methods'(accumulator, element) => B signature.

This method does nothing if the vertNum < 2. Foreach vertex applies the side effecting function to the previous vertex with each vertex. The previous vertex to the first vertex is the last vertex of the PolygonLike. Note the function signature (previous, vertex) => U follows the foreach based convention of putting the collection element 2nd or last as seen for example in fold methods'(accumulator, element) => B signature.

Concrete methods

def map[B <: ElemValueN, BB <: PolygonLike[B]](f: VT => B)(implicit build: PolygonBuilder[B, BB]): BB

Map this collection of data elements to PolygonLike class of type BB.

Map this collection of data elements to PolygonLike class of type BB.

def vertsForAll(f: VT => Boolean): Boolean

This method should be overridden in final classes.

This method should be overridden in final classes.

def vertsMin3: Boolean

Checks this polygon has at least 3 vertices.

Checks this polygon has at least 3 vertices.