This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: A UIKit based Playground for presenting user interface | |
import UIKit | |
import PlaygroundSupport | |
import simd | |
// ------------- | |
let floorVertices = [ | |
// main island |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://www.swtestacademy.com/intersection-convex-polygons-algorithm/ | |
pub mod intersection { | |
use cgmath::*; | |
/// Returns true if the two rectangle | |
pub fn rect_rect_intersects( | |
rect_a: (Point2<f32>, Vector2<f32>), | |
rect_b: (Point2<f32>, Vector2<f32>), | |
) -> bool { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef spring_hpp | |
#define spring_hpp | |
#include <glm/glm.hpp> | |
template <glm::length_t L, typename T, glm::qualifier Q = glm::defaultp> | |
class spring_ { | |
public: | |
spring_(T mass, T force, T damping, glm::vec<L, T, Q> zero = {}) | |
: _mass(mass) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func debounce( delay:NSTimeInterval, #queue:dispatch_queue_t, action: (()->()) ) -> ()->() { | |
var lastFireTime:dispatch_time_t = 0 | |
let dispatchDelay = Int64(delay * Double(NSEC_PER_SEC)) | |
return { | |
lastFireTime = dispatch_time(DISPATCH_TIME_NOW,0) | |
dispatch_after( | |
dispatch_time( | |
DISPATCH_TIME_NOW, |