Igis Documentation Beta

Structure Double​Point

public struct DoublePoint : Equatable 

A DoublePoint represents a location in a two-dimensional plane.

%45 DoublePoint DoublePoint Equatable Equatable DoublePoint->Equatable

Conforms To

Equatable

Initializers

init()

public init() 

Creates a new DoublePoint located at (x:0, y:0)

init(x:​y:​)

public init(x:Double, y:Double) 

Creates a new DoublePoint from the specified coordinates

Parameters

x Double

The x coordinate

y Double

The y coordinate

init(x:​y:​)

public init(x:Int, y:Int) 

Creates a new DoublePoint from the specified coordinates

Parameters

x Int

The x coordinate

y Int

The y coordinate

init(_:​)

public init(_ point:Point) 

Creates a new DoublePoint from the specified Point

Parameters

point Point

The source of the x, y coordinates

Properties

x

public var x : Double

The coordinate along the x-axis

y

public var y : Double

The coordinate along the y-axis

zero

static public let zero 

The point (x:0.0, y:0.0)

Methods

distance​Squared(target:​)

public func distanceSquared(target:DoublePoint) -> Double 

Calculates the square of the distance between this point and another

Parameters

target Double​Point

The target point to which to calculate the distance

Returns

The square of the distance to a target point

distance(target:​)

public func distance(target:DoublePoint) -> Double 

Calculates the distance between this point and another

Parameters

target Double​Point

The target point to which to calculate the distance

Returns

The distance to a target point

Double​Points(_:​)

static public func DoublePoints(_ points: [Point]) -> [DoublePoint] 

Converts an array of Points to an array of DoublePoints

Operators

==

static public func == (lhs:DoublePoint, rhs:DoublePoint) -> Bool 

Equivalence operator for two DoublePoints

+

static public func + (left: DoublePoint, right: DoublePoint) -> DoublePoint 

Addition operator for two DoublePoints

+=

static public func += (left: inout DoublePoint, right: DoublePoint) 

Compound addition operator for two DoublePoints

-

static public prefix func - (doublePoint: DoublePoint) -> DoublePoint 

Negation operator for a DoublePoint

-

static public func - (left: DoublePoint, right: DoublePoint) -> DoublePoint 

Subtraction operator for two DoublePoints

-=

static public func -= (left: inout DoublePoint, right: DoublePoint) 

Compound subtration operator for two DoublePoints