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
-- catmull-rom-spline library | |
-- Resources: | |
-- https://gist.github.com/1383576 | |
-- http://codeplea.com/simple-interpolation | |
-- http://codeplea.com/introduction-to-splines | |
require("tablelib") -- https://gist.github.com/HoraceBury/9307117 | |
require("mathlib") -- https://gist.github.com/HoraceBury/9431861 |
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
using System; | |
using NUnit.Framework; | |
using System.Data; | |
namespace RandomTests | |
{ | |
[TestFixture] | |
public class NumberTests | |
{ | |
public static void Main(string[] args) |
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
-- display lib | |
local newShapeList = { | |
"newCircle", | |
"newContainer", | |
"newEmbossedText", | |
"newEmitter", | |
"newGroup", | |
"newImage", | |
"newImageRect", |
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
require("mathlib") | |
require("graphicslib") | |
require("tablelib") | |
local function asPoint( x, y ) | |
return { x=x, y=y } | |
end | |
local function getPoint( path, index ) | |
return { x=path[index], y=path[index+1] } |
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
-- graphics extension library | |
require("mathlib") -- https://gist.github.com/HoraceBury/9431861 | |
require("displaylib") -- https://gist.github.com/HoraceBury/1e2ce033e3441823038eb88b551ad981 | |
-- https://math.stackexchange.com/questions/2269589/calculate-angle-of-the-next-point-on-a-circle | |
--[[ | |
Generates a table of points containing the outline of a circle with each point 'step' pixels from the previous. | |
Parameters: |
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
local lib = {} | |
function lib.newShadowLayer( shadowgroup ) | |
local function refresh() | |
if (shadowgroup and shadowgroup.numChildren) then | |
for i=1, shadowgroup.numChildren do | |
local shadow = shadowgroup[i] | |
local object = shadowgroup[i].shadowparent | |
if (not shadow.isBodyActive) then |
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
using System; | |
using System.Collections.Generic; | |
using System.Runtime.Caching; | |
namespace CacheServices | |
{ | |
public class Cache | |
{ | |
protected MemoryCache _cache = new MemoryCache("general"); |
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
local widget = require("widget") | |
local function angleOf( ax, ay, bx, by, adjust, positive ) | |
local angle = math.atan2( by-ay, bx-ax ) * 180/math.pi | |
if (adjust) then | |
if (type(adjust) ~= "number") then adjust = -90 end | |
angle = angle - adjust | |
if (angle < -180) then angle=angle+360 end | |
if (angle > 180) then angle=angle-360 end |
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
local function angleOnTarget( e ) | |
local a = math.atan2( e.y-e.target.y, e.x-e.target.x ) * 180 / (4*math.atan(1)) | |
if (a<0) then a=a+360 end | |
return a | |
end | |
local function tap(e) | |
e.target.touchMode = "drag" | |
print("drag mode") | |
e.target.dragtimer = timer.performWithDelay( 400, function() |
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
-- circle lib | |
require("mathlib") | |
display.setDefault( "isAnchorClamped", false ) | |
local min, max = -10000000000000, 10000000000000 | |
local cache = {} | |
local circlelib = {} |