metaballs/MetaballsKit/Geometry.swift

54 lines
875 B
Swift
Raw Normal View History

2017-08-05 11:09:03 -07:00
//
// Geometry.swift
// Metaballs
//
// Created by Eryn Wells on 8/5/17.
// Copyright © 2017 Eryn Wells. All rights reserved.
//
import Foundation
public struct Point {
var x: Float
var y: Float
var CGPoint: CGPoint {
return CoreGraphics.CGPoint(x: CGFloat(x), y: CGFloat(y))
}
init() {
self.init(x: 0, y: 0)
}
init(x: Float, y: Float) {
self.x = x
self.y = y
}
}
2017-08-05 13:38:46 -07:00
extension Point: CustomStringConvertible {
public var description: String {
return "(\(x), \(y))"
}
}
2017-08-05 11:09:03 -07:00
public struct Vector {
var dx: Float
var dy: Float
init() {
self.init(dx: 0, dy: 0)
}
init(dx: Float, dy: Float) {
self.dx = dx
self.dy = dy
}
}
2017-08-05 13:38:46 -07:00
extension Vector: CustomStringConvertible {
public var description: String {
return "(\(dx), \(dy))"
}
}