This file contains 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
final int PILLAR_ORDER = 12; | |
final int DIAGONALS = PILLAR_ORDER * 2 - 1; | |
final float PILLAR_WIDTH = 20.0; | |
final float PILLAR_HEIGHT = 10.0; | |
final float PILLAR_SPACING = 2.0; | |
final float GRAVITY = -1.0; | |
final float ELASTICITY = -0.5; | |
final float MAX_HEIGHT = 500.0; |
This file contains 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
final int PILLAR_ORDER = 8; | |
final int DIAGONALS = PILLAR_ORDER * 2 - 1; | |
final float PILLAR_WIDTH = 30.0; | |
final float PILLAR_HEIGHT = 15.0; | |
final float PILLAR_SPACING = 2.0; | |
final float GRAVITY = -1.0; | |
final float ELASTICITY = -0.6; | |
final float MAX_HEIGHT = 500.0; |
This file contains 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
final int PILLAR_ORDER = 6; | |
final float PILLAR_WIDTH = 40.0; | |
final float PILLAR_HEIGHT = 20.0; | |
final float PILLAR_SPACING = 2.0; | |
final float GRAVITY = -1.0; | |
final float ELASTICITY = -0.6; | |
final float MAX_HEIGHT = 500.0; |
This file contains 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
final int PILLAR_ORDER = 6; | |
final float PILLAR_WIDTH = 40.0; | |
final float PILLAR_HEIGHT = 20.0; | |
final float PILLAR_SPACING = 2.0; | |
final float GRAVITY = -1.0; | |
final float ELASTICITY = -0.6; | |
final float MAX_HEIGHT = 500.0; |
This file contains 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
final int PILLAR_ORDER = 6; | |
final float PILLAR_WIDTH = 40.0; | |
final float PILLAR_HEIGHT = 20.0; | |
final float PILLAR_SPACING = 2.0; | |
final float GRAVITY = -1.0; | |
final float ELASTICITY = -0.6; | |
final float MAX_HEIGHT = 500.0; |
This file contains 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
syntax = "proto3"; | |
message Packet { | |
float time = 1; | |
sint32 rx = 2; | |
sint32 ry = 3; | |
sint32 rz = 4; | |
} |
This file contains 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
// Slit-scan Camera | |
// ©2016 Joshua Sullivan | |
// | |
// This sketch implements a simple time-slit camera. Each row of the video is offset | |
// in time by one frame more than the previous row. So, the top row is real-time and | |
// the bottom row is 240 frames ago. | |
// | |
// We're using an optimized storage mechanism where we are storing N + 1 samples for each row | |
// of the video frame, where N is the index of the row, from 0 to FRAME_HEIGHT - 1. This means | |
// index[0] holds 1 row of data, index[1] holds 2, and so on until index[239] holds 240. |
This file contains 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
//: # Code Challenge #54 | |
//: ## Lattice Paths | |
//: | |
//: It may not be the most clever or direct solution, but the problem can be modeled | |
//: using Pascal's Triangle (https://en.wikipedia.org/wiki/Pascal's_triangle). For a square grid | |
//: of dimension `N`, the number of paths can be found at the 'central' position of row `2 * N + 1` of | |
//: Pascal's Triangle. | |
import Swift | |
/// The size of the grid, measured in nodes per edge. |
This file contains 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
// | |
// JTSSwiftTweener.swift | |
// JTSSwiftTweener | |
// | |
// Created by Joshua Sullivan on 12/10/16. | |
// Copyright © 2016 Josh Sullivan. All rights reserved. | |
// | |
import UIKit |
This file contains 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
/// The RepeatingSequence accepts a collection and returns the values sequentially until the | |
/// final element is returned, at which point the sequence wraps around to the first element | |
/// of the collection and continues from there. | |
struct RepeatingSequence<T>: Sequence { | |
/// The Collection that we base our sequence on. We use a Collection and not | |
/// another Sequence because Sequences are not guaranteed to be repeatedly iterated. | |
let data: AnyCollection<T> | |
/// We can optionally specify a maximum number of iterations. This is necessary |