# Vec2

class Vec2(val x: Double, val y: Double) extends Vec2Like with ApproxDbl

A 2 dimensional vector. This is similar data to Pt2. The purpose of this separate type is to encode the relative nature of the Vec2 as opposed to the absolute nature of a Pt. So usually you will want and need to add the vector to an absolute point to return to the absolute realm of points. Thanks to René Descartes for this great idea.

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

@inline
def *(factor: Double): Vec2
def +(operand: Vec2): Vec2

Adds this Vector to a second 2 dimensional vector.

Adds this Vector to a second 2 dimensional vector.

def -(operand: Vec2): Vec2

Adds the operand 2 dimensional vector from this 2 dimensional vector.

Adds the operand 2 dimensional vector from this 2 dimensional vector.

@inline
def /(divisor: Double): Vec2
def addXY(otherX: Double, otherY: Double): Vec2
def angle

Gives the angle of the vector with respect of the origin.

Gives the angle of the vector with respect of the origin.

Gives the angle of the vector with respect of the origin in radians, between -Pi and Pi.

Gives the angle of the vector with respect of the origin in radians, between -Pi and Pi.

Gives the angle of this vector in radians.

Gives the angle of this vector in radians.

Gives the angle of the vector with respect of the origin for a graphical system where the Y Axis points down in radians, between -Pi and Pi.

Gives the angle of the vector with respect of the origin for a graphical system where the Y Axis points down in radians, between -Pi and Pi.

Gives the angle of the vector with respect of the origin for a graphical system where the Y Axis points down.

Gives the angle of the vector with respect of the origin for a graphical system where the Y Axis points down.

override def approx(that: Any, precision: Double): Boolean
Definition Classes
override def canEqual(other: Any): Boolean
Definition Classes
Equals
@inline
override def dbl1: Double
Definition Classes
@inline
override def dbl2: Double
Definition Classes
override def equals(that: Any): Boolean
Definition Classes
Equals -> Any
def magnitude: Double

The magnitude of this vector2Like.

The magnitude of this vector2Like.

def rotate(a: AngleVec): Vec2

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.

@inline
override def scale(factor: Double): Vec2
Definition Classes
@inline
override def show1: Double
Definition Classes
@inline
override def show2: Double
Definition Classes
def subXY(otherX: Double, otherY: Double): Vec2
override def typeStr: String
Definition Classes
def vv(z: Double): Vec3
def xScale(factor: Double): Vec2
def xyScale(xOperand: Double, yOperand: Double): Vec2
def yScale(factor: Double): Vec2

### 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