Pt2

ostrat.geom.Pt2
See thePt2 companion object
final class Pt2(val x: Double, val y: Double) extends Vec2Like, PointDbl2

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. Vec2s can be added and subtracted from points. Points can not be added to points but they can be used to translate the point.

Attributes

Companion
object
Graph
Supertypes
trait PointDbl2
trait PointDblN
trait Point
trait Vec2Like
trait ApproxDbl
trait Approx[Double]
trait Equals
trait TellElemDbl2
trait Dbl2Elem
trait DblNElem
trait ValueNElem
trait SpecialT
trait TellDbl2
trait Tell2[Double, Double]
trait PersistN
trait TellN
trait Tell
trait Persist
class Object
trait Matchable
class Any
Show all

Members list

Type members

Types

override type LineSegT = LineSeg

The type of LineSegLike that this Point can start or ends.

The type of LineSegLike that this Point can start or ends.

Attributes

override type ThisT = Pt2

The type of this point for the purposes of LineSegT. May not be the final type.

The type of this point for the purposes of LineSegT. May not be the final type.

Attributes

Value members

Concrete methods

def *(operand: Length): PtM2
Implicitly added by Pt2Implicit
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.

Attributes

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.

Attributes

def <<(startPt: Pt2): Vec2

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

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

Attributes

def >/>(operand: Pt2): Vec2

Subtracts this 2D point from the operand 2D point and halves it to get the relative Vector divided by 2. This is a very common operation when calculating the distance along an axis and the distance to the centre point is required. Hence the specific method

Subtracts this 2D point from the operand 2D point and halves it to get the relative Vector divided by 2. This is a very common operation when calculating the distance along an axis and the distance to the centre point is required. Hence the specific method

Attributes

def >>(operand: Pt2): Vec2

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

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

Attributes

def \/(point2: Pt2): Pt2

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

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

Attributes

def addX(adj: Double): Pt2
def addXY(otherX: Double, otherY: Double): Pt2
def addY(adj: 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.

Attributes

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.

Attributes

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.

Attributes

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.

Attributes

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.

Attributes

override def approx(that: Any, precision: Double): Boolean

Attributes

Definition Classes
override def canEqual(other: Any): Boolean

Attributes

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.

Attributes

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

Not sure about this method

Not sure about this method

Attributes

override def equals(that: Any): Boolean

Compares the receiver object (this) with the argument object (that) for equivalence.

Compares the receiver object (this) with the argument object (that) for equivalence.

Any implementation of this method should be an equivalence relation:

  • It is reflexive: for any instance x of type Any, x.equals(x) should return true.
  • It is symmetric: for any instances x and y of type Any, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any instances x, y, and z of type Any if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.

If you override this method, you should verify that your implementation remains an equivalence relation. Additionally, when overriding this method it is usually necessary to override hashCode to ensure that objects which are "equal" (o1.equals(o2) returns true) hash to the same scala.Int. (o1.hashCode.equals(o2.hashCode)).

Value parameters

that

the object to compare against this object for equality.

Attributes

Returns

true if the receiver object is equivalent to the argument; false otherwise.

Definition Classes
Equals -> Any
def invScale(divisor: Double): Pt2
def inverseY: Pt2

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

Attributes

def lineSegFrom(startPt: Pt2): LineSeg

Line segment LineSeg from the parameter point to this point.

Line segment LineSeg from the parameter point to this point.

Attributes

def lineSegTo(endPt: Pt2): LineSeg

Line segment LineSeg from this point to the parameter point.

Line segment LineSeg from this point to the parameter point.

Attributes

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

Reflects, mirrors along the Y axis by negating X.

Reflects, mirrors along the Y axis by negating X.

Attributes

def negY: Pt2

Reflects ,mirrors along the X axis by negating Y.

Reflects ,mirrors along the X axis by negating Y.

Attributes

def origin(operand: Vec2Like): 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.

Attributes

def pp(z: Double): Pt3
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.

Attributes

def reflectXLine(line: XLine): Pt2

Reflects, mirrors this Vec2 across an XLine.

Reflects, mirrors this Vec2 across an XLine.

Attributes

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.

Attributes

def reflectYLine(line: YLine): Pt2

Reflects, mirrors this Vec2 across a YLine.

Reflects, mirrors this Vec2 across a YLine.

Attributes

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.

Attributes

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.

Attributes

def rotate180: Pt2

Rotates the vector 180 degrees or Pi radians.

Rotates the vector 180 degrees or Pi radians.

Attributes

def rotate270: Pt2

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

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

Attributes

def rotate90: Pt2

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

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

Attributes

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.

Attributes

def scale(factor: Double): Pt2
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.

Attributes

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): RArr[GraphicSvgElem]

Creates a TextFixed and a line segment with an arrow head at the end. The arrow pointing from the TextFixed 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 TextFixed and a line segment with an arrow head at the end. The arrow pointing from the TextFixed 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.

Attributes

def textArrowAwayFrom(dirnPt: Pt2, str: String, arrowLength: Double, colour: Colour, fontSize: Double): RArr[GraphicSvgElem]

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

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

Attributes

def textArrowToward(dirnPt: Pt2, str: String, arrowLength: Double, colour: Colour, fontSize: Double): RArr[GraphicSvgElem]

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

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

Attributes

def textAt(str: String, fontSize: Int, fontColour: Colour): TextFixed
def toMetres(factor: Length): PtM2
def toText(fontSize: Int, fontColour: Colour): TextFixed
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.

Attributes

override def typeStr: String

The type of the object to be persisted.

The type of the object to be persisted.

Attributes

Definition Classes
def xScale(factor: Double): Pt2
def xShear(operand: Double): Pt2
def xyOrigin(deltaX: Double, deltaY: Double): 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.

Attributes

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.

Attributes

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

Inherited methods

final override def dbl1: Double

Attributes

Definition Classes
Inherited from:
TellElemDbl2
final override def dbl2: Double

Attributes

Definition Classes
Inherited from:
TellElemDbl2
override def dblBufferAppend(buffer: ArrayBuffer[Double]): Unit

Utility method to append this as an element to an ArrayBuffer[Double]. End users should rarely need to use this method.

Utility method to append this as an element to an ArrayBuffer[Double]. End users should rarely need to use this method.

Attributes

Definition Classes
Inherited from:
Dbl2Elem
override def dblForeach(f: Double => Unit): Unit

Performs the side effecting function on each Double in this Product element.

Performs the side effecting function on each Double in this Product element.

Attributes

Definition Classes
Inherited from:
Dbl2Elem
def dblsApprox(that: Dbl2Elem, delta: Double): Boolean

Attributes

Inherited from:
Dbl2Elem
def dblsEqual(that: Dbl2Elem): Boolean

Attributes

Inherited from:
Dbl2Elem
def dot(operand: Vec2Like): Double

The dot product of this and the operand vector.

The dot product of this and the operand vector.

Attributes

Inherited from:
Vec2Like
def el1Show(style: ShowStyle, maxPlaces: Int): String

Attributes

Inherited from:
Tell2
def el2Show(style: ShowStyle, maxPlaces: Int): String

Attributes

Inherited from:
Tell2

A StrArr Arr of the element type names of this Show Product class.

A StrArr Arr of the element type names of this Show Product class.

Attributes

Inherited from:
Tell2

x <= 0 && y <= 0

x <= 0 && y <= 0

Attributes

Inherited from:
Vec2Like

x >= 0 && y <= 0

x >= 0 && y <= 0

Attributes

Inherited from:
Vec2Like

x >= 0 && y >= 0

x >= 0 && y >= 0

Attributes

Inherited from:
Vec2Like

x <= 0 && y >= 0

x <= 0 && y >= 0

Attributes

Inherited from:
Vec2Like
override def name1: String

1st parameter name.

1st parameter name.

Attributes

Definition Classes
Inherited from:
Vec2Like
override def name2: String

2nd parameter name.

2nd parameter name.

Attributes

Definition Classes
Inherited from:
Vec2Like
override def numParams: Int

Number of parameter constituents of this class.

Number of parameter constituents of this class.

Attributes

Definition Classes
Inherited from:
Persist2
override def opt1: Option[Double]

The optional default value for parameter 1.

The optional default value for parameter 1.

Attributes

Definition Classes
Inherited from:
Tell2Plused
override def opt2: Option[Double]

The optional default value for parameter 2.

The optional default value for parameter 2.

Attributes

Definition Classes
Inherited from:
Tell2Plused
override def paramNames: StrArr

Sequence of the names of parameter constituents of this class.

Sequence of the names of parameter constituents of this class.

Attributes

Definition Classes
Inherited from:
Tell2
override def precisionDefault: Double

Attributes

Definition Classes
Inherited from:
ApproxDbl
override def str: String

The most basic Show method, paralleling the strT method on ShowT type class instances.

The most basic Show method, paralleling the strT method on ShowT type class instances.

Attributes

Definition Classes
TellN -> Tell
Inherited from:
TellN
def str0: String

Show with decimal precision of 0 places.

Show with decimal precision of 0 places.

Attributes

Inherited from:
Tell
def str1: String

Show with decimal precision of 1 place padding with a zero if necessary.

Show with decimal precision of 1 place padding with a zero if necessary.

Attributes

Inherited from:
Tell
def str2: String

Show with decimal precision of 2 places padding with zeros if necessary.

Show with decimal precision of 2 places padding with zeros if necessary.

Attributes

Inherited from:
Tell
def str3: String

Show with decimal precision of 3 places padding with zeros if necessary.

Show with decimal precision of 3 places padding with zeros if necessary.

Attributes

Inherited from:
Tell
override def tell(style: ShowStyle, maxPlaces: Int, minPlaces: Int): String

Intended to be a multiple parameter comprehensive Show method. Intended to be paralleled by show method on Show type class instances.

Intended to be a multiple parameter comprehensive Show method. Intended to be paralleled by show method on Show type class instances.

Attributes

Definition Classes
TellN -> Tell
Inherited from:
TellN
final override def tell1: Double

Element 1 of this Tell2+ element product.

Element 1 of this Tell2+ element product.

Attributes

Definition Classes
Inherited from:
Vec2Like
final override def tell2: Double

Element 2 of this Tell2+ element product.

Element 2 of this Tell2+ element product.

Attributes

Definition Classes
Inherited from:
Vec2Like
final override def tellDepth: Int

The syntactic depth of the tell String for this object.

The syntactic depth of the tell String for this object.

Attributes

Definition Classes
Inherited from:
TellDbl2
override def tellElemStrs(way: ShowStyle, decimalPlaces: Int, minPlaces: Int): StrArr

A StrArr Arr collection of the show methods return values of the elements of this Show Product class.

A StrArr Arr collection of the show methods return values of the elements of this Show Product class.

Attributes

Definition Classes
Inherited from:
Tell2
def tellSemisNames(maxPlaces: Int, minPlaces: Int): String

Attributes

Inherited from:
TellN
def toPair: (Double, Double)

Attributes

Inherited from:
Vec2Like
override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Tell -> Any
Inherited from:
Tell

This property determines if the type can be used with Multiple syntax.

This property determines if the type can be used with Multiple syntax.

MyObj * 7

. for describing sequences succinctly. This is not desirable for some types such as numerical and mathematical vector types as this could be confusing 3 * 4 should resolve to an Int of value 12, not a Multiple(3, 4).

Attributes

Inherited from:
Persist

Concrete fields

val x: Double

The x component of this 2D vector / point.

The x component of this 2D vector / point.

Attributes

val y: Double

The y component of this 2D vector / point.

The y component of this 2D vector / point.

Attributes

Implicits

Inherited implicits

final implicit override def show1: Show[Double]

Attributes

Definition Classes
Inherited from:
TellDbl2
final implicit override def show2: Show[Double]

Attributes

Definition Classes
Inherited from:
TellDbl2