# Pt2

final class Pt2(val x: Double, val y: Double) extends Vec2Like

A 2 dimensional point. Pt2s can be transformed through the 2D geometric transformations. If you wish to encode a relative position then use a Vec2 instead. Thanks to RenÃ© Descartes for this.

Companion
object
trait Vec2Like
trait ApproxDbl
trait Approx[Double]
trait Equals
trait Show2Dbls
trait Dbl2Elem
trait DblNElem
trait SpecialT
trait Show2[Double, Double]
trait Show
class Object
trait Matchable
class Any

## Value members

### Concrete methods

def +(operand: Vec2): Pt2

Add the operand Vec2 2D vector to this Pt2, returns a new Pt2.

Add the operand Vec2 2D vector to this Pt2, returns a new Pt2.

def -(operand: Vec2): Pt2

Subtracts the operand Vec2 2D vector from this 2D point. Returns a new Pt2.

Subtracts the operand Vec2 2D vector from this 2D point. Returns a new Pt2.

def <<(startPt: Pt2): Vec2

Subtracts the operand 2D point from this 2D point to get the relative Vector. Returns a Vec2.

Subtracts the operand 2D point from this 2D point to get the relative Vector. Returns a Vec2.

def >>(operand: Pt2): Vec2

Subtracts this 2D point from the operand 2D point to get the relative Vector. Returns a Vec2.

Subtracts this 2D point from the operand 2D point to get the relative Vector. Returns a Vec2.

def addXY(otherX: Double, otherY: Double): Pt2
def angleFrom(operand: Pt2): Angle

Gives the anlge from the operand point to this point.

Gives the anlge from the operand point to this point.

def angleFromLine(angle: Angle, magnitude: Double): LineSeg

Line segment from this point to along the given angle for the given magnitude to point 2.

Line segment from this point to along the given angle for the given magnitude to point 2.

def angleFromYDown(operand: Pt2): Angle

Gives the anlge from the operand point to this point.

Gives the anlge from the operand point to this point.

def angleTo(operand: Pt2): Angle

Gives the angle from this point to the operand point.

Gives the angle from this point to the operand point.

def angleToLine(angle: Angle, magnitude: Double): LineSeg

Line segment from this point to along the given angle for the given magnitude to point 2.

Line segment from this point to along the given angle for the given magnitude to point 2.

override def approx(that: Any, precision: Double): Boolean
Definition Classes
override def canEqual(other: Any): Boolean
Definition Classes
Equals
def centreSquare(length: Double): PolygonImp
@inline
override def dbl1: Double
Definition Classes
@inline
override def dbl2: Double
Definition Classes
def distTo(operand: Pt2): Double

Gives the positive scalar distance between this and the operand Vec2.

Gives the positive scalar distance between this and the operand Vec2.

def drawCross(armLength: Double, lineColour: Colour, lineWidth: Double): LinesDraw

override def equals(that: Any): Boolean
Definition Classes
Equals -> Any
@inline
def invScale(divisor: Double): Pt2
def invSlate(operand: Pt2): Pt2

Changes the origin of the point to the new point. Subtracting the X and Y components of the operand point from this point.

Changes the origin of the point to the new point. Subtracting the X and Y components of the operand point from this point.

Reverses the y coordinate. Useful for translating between canvases where the y axis measures down and coordinate systems where y is up

Reverses the y coordinate. Useful for translating between canvases where the y axis measures down and coordinate systems where y is up

def lineFrom(pt2: Pt2): LineSeg

Line segment LineSeg from the parameter point to this point.

Line segment LineSeg from the parameter point to this point.

def lineTo(pt2: Pt2): LineSeg

Line segment LineSeg from this point to the parameter point.

Line segment LineSeg from this point to the parameter point.

def linesCross(armLength: Double): Seq[LineSeg]
def midPt(point2: Pt2): Pt2

The average of this and the operand Pt2. The mid point between this point and the operand second point.

The average of this and the operand Pt2. The mid point between this point and the operand second point.

def negX: Pt2

Reflects, mirrors along the Y axis by negating X.

Reflects, mirrors along the Y axis by negating X.

def negY: Pt2

Reflects ,mirrors along the X axis by negating Y.

Reflects ,mirrors along the X axis by negating Y.

def pp(z: Double): Pt3
@inline
def reflect(lineLike: LineLike): Pt2

Reflects or mirrors this Vec2 across a line, returning new Vec2.

Reflects or mirrors this Vec2 across a line, returning new Vec2.

def reflectXLine(line: XLine): Pt2

Reflects, mirrors this Vec2 across an XLine.

Reflects, mirrors this Vec2 across an XLine.

def reflectXParallel(yOffset: Double): Pt2

Reflects, mirrors along the y = yOffset line that is parallel to the X axis.

Reflects, mirrors along the y = yOffset line that is parallel to the X axis.

def reflectYLine(line: YLine): Pt2

Reflects, mirrors this Vec2 across a YLine.

Reflects, mirrors this Vec2 across a YLine.

def reflectYParallel(xOffset: Double): Pt2

Reflects, mirrors along the x = xOffset line, that is parallel to the Y axis by negating X.

Reflects, mirrors along the x = xOffset line, that is parallel to the Y axis by negating X.

def rotate(a: AngleVec): Pt2

Rotates this vector through the given angle around the origin.

Rotates this vector through the given angle around the origin.

@inline

Rotates the vector 180 degrees or Pi radians.

Rotates the vector 180 degrees or Pi radians.

@inline

rotates the vector 90 degrees or Pi/2 radians, clockwise.

rotates the vector 90 degrees or Pi/2 radians, clockwise.

@inline

rotates the vector 90 degrees or Pi/2 radians, anticlockwise.

rotates the vector 90 degrees or Pi/2 radians, anticlockwise.

def rotateAbout(centre: Pt2, a: AngleVec): Pt2

Rotates this vector through the given angle around the centre of rotation passed as the first parameter.

Rotates this vector through the given angle around the centre of rotation passed as the first parameter.

def rotateRadians(r: Double): Pt2
@inline
def scale(factor: Double): Pt2
@inline
override def show1: Double
Definition Classes
@inline
override def show2: Double
Definition Classes
def slate(operand: Vec2Like): Pt2

2D geometric translation transformation on this Pt2 returns a Pt2.

2D geometric translation transformation on this Pt2 returns a Pt2.

def str0: String
def str1: String
def str2: String
def str3: String
def strMod(f: Double => String): String
def subX(adj: Double): Pt2
def subXY(otherX: Double, otherY: Double): Pt2
def subY(adj: Double): Pt2
def textArrow(str: String, angle: Angle, arrowLength: Double, colour: Colour, fontSize: Double): GraphicElems

Creates a TextGraphic and a line segment with an arrow head at the end. The arrow pointing from the TextGraphic to this point. The alignment of the text is determined by the angle parameter. The method is not meant to cover all possible configurations for text arrows. These can easily be constructed from OpenStrat primitives, but to provide a quick default for rapid development.

Creates a TextGraphic and a line segment with an arrow head at the end. The arrow pointing from the TextGraphic to this point. The alignment of the text is determined by the angle parameter. The method is not meant to cover all possible configurations for text arrows. These can easily be constructed from OpenStrat primitives, but to provide a quick default for rapid development.

def textArrowAwayFrom(dirnPt: Pt2, str: String, arrowLength: Double, colour: Colour, fontSize: Double): GraphicElems

Creates a TextGraphic and a line segment with an arrow head at the end. The arrow pointing away from the TextGraphic to this point. The arrow points towards the dirnPt parameter point. The alignment of the text is determined by the angle parameter.

Creates a TextGraphic and a line segment with an arrow head at the end. The arrow pointing away from the TextGraphic to this point. The arrow points towards the dirnPt parameter point. The alignment of the text is determined by the angle parameter.

def textArrowToward(dirnPt: Pt2, str: String, arrowLength: Double, colour: Colour, fontSize: Double): GraphicElems

Creates a TextGraphic and a line segment with an arrow head at the end. The arrow pointing from the TextGraphic to this point. The arrow points towards the dirnPt parameter point. The alignment of the text is determined by the angle parameter.

Creates a TextGraphic and a line segment with an arrow head at the end. The arrow pointing from the TextGraphic to this point. The arrow points towards the dirnPt parameter point. The alignment of the text is determined by the angle parameter.

def textAt(str: String, fontSize: Int, fontColour: Colour): TextGraphic
@inline
def toDist2(factor: Metres): Pt2M
def toLatLong(radius: Double): LatLong

Where xnd y is a map on the surface ofa sphere. Currently not working for angles greater than Pi / 2

Where xnd y is a map on the surface ofa sphere. Currently not working for angles greater than Pi / 2

def toText(fontSize: Int, fontColour: Colour): TextGraphic
def toTuple: (Double, Double)
def toVec: Vec2

Returns the Vec2 2D vector from the origin to this Pt2.

Returns the Vec2 2D vector from the origin to this Pt2.

override def typeStr: String
Definition Classes
def xScale(factor: Double): Pt2
def xShear(operand: Double): Pt2
def xyScale(xOperand: Double, yOperand: Double): Pt2
def xySlate(xOperand: Double, yOperand: Double): Pt2

2D geometric translation transofrmation on this Pt2 returns a Pt2.

2D geometric translation transofrmation on this Pt2 returns a Pt2.

def yScale(factor: Double): Pt2
def yShear(operand: Double): Pt2

### Inherited methods

def dblsApprox(that: Dbl2Elem, delta: Double): Boolean
Inherited from
Dbl2Elem
def dblsEqual(that: Dbl2Elem): Boolean
Inherited from
Dbl2Elem
@inline
def dot(operand: Vec2Like): Double

The dot product of this and the operand vector.

The dot product of this and the operand vector.

Inherited from
Vec2Like
def doublesSeq: Seq[Double]
Inherited from
Vec2Like
Inherited from
Show2
Inherited from
Show2
override def name1: String
Definition Classes
Inherited from
Vec2Like
override def name2: String
Definition Classes
Inherited from
Vec2Like
override def precisionDefault: Double
Definition Classes
Inherited from
ApproxDbl
override def show(way: Way, maxPlaces: Int, minPlaces: Int): String
Definition Classes
Inherited from
ShowProduct
def shows(way: Way, decimalPlaces: Int): Strings
Inherited from
Show2
override def str: String
Definition Classes
Inherited from
ShowProduct
final override def syntaxdepth: Int
Definition Classes
Inherited from
Show2Dbls
def toPair: (Double, Double)
Inherited from
Vec2Like
final override def toString: String
Definition Classes
Show -> Any
Inherited from
Show

val x: Double
val y: Double

## Implicits

### Inherited implicits

final implicit override def showT1: ShowT[Double]
Definition Classes
Inherited from
Show2Dbls
final implicit override def showT2: ShowT[Double]
Definition Classes
Inherited from
Show2Dbls