Igis Documentation Beta

Structure Point

public struct Point : Equatable 

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

%19 Point Point Equatable Equatable Point->Equatable

Conforms To

Equatable

Initializers

init()

public init() 

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

init(x:​y:​)

public init(x:Int, y:Int) 

Creates a new Point from the specified coordinates

Parameters

x Int

The x coordinate

y Int

The y coordinate

init(_:​)

public init(_ doublePoint:DoublePoint) 

Creates a new Point from the specified DoublePoint

Parameters

double​Point Double​Point

The source of the new coordinates

Properties

x

public var x : Int

The coordinate along the x-axis

y

public var y : Int

The coordinate along the y-axis

zero

static public let zero 

The point (x:0, y:0)

Methods

distance​Squared(to:​)

public func distanceSquared(to target:Point) -> Int 

Calculates the square of the distance between this point and another

Parameters

target Point

The target point to which to calculate the distance

Returns

The square of the distance to a target point

distance(to:​)

public func distance(to target: Point) -> Double 

Calculates the distance between this point and another

Parameters

target Point

The target point to which to calculate the distance

Returns

The distance to a target point

Points(_:​)

static public func Points(_ doublePoints: [DoublePoint]) -> [Point] 

Converts an array of DoublePoints to an array of Points

Operators

==

static public func == (left: Point, right: Point) -> Bool 

Equivalence operator for two Points

+

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

Addition operator for two Points

+=

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

Compound addition operator for two Points

-

static public prefix func - (point:Point) -> Point 

Negation operator for a Point

-

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

Subtraction operator for two Points

-=

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

Compound subtration operator for two Points