Skip to content

Instantly share code, notes, and snippets.

@MichaelShaw
MichaelShaw / cuboid_cylinder.rs
Created July 19, 2017 06:27
ncollide inconsistency case
use nalgebra as na;
use ncollide as nc;
use nalgebra::{Isometry3, Vector3};
use ncollide::shape::{Cuboid, Cylinder};
let cyl = Cylinder::new(0.925, 0.5);
let cyl_at = Isometry3::new(Vector3::new(10.97, 0.925, 61.02), na::zero());
let cuboid = Cuboid::new(Vector3::new(0.05, 0.75, 0.5));
let cuboid_at = Isometry3::new(Vector3::new(11.50, 0.75, 60.5), na::zero());
@MichaelShaw
MichaelShaw / cuboid_cylinder.rs
Created July 19, 2017 04:41
ncollide: Cuboid Cylinder inconsistent case
use nalgebra as na;
use ncollide as nc;
use nalgebra::{Isometry3, Vector3};
use ncollide::shape::{Cuboid, Cylinder};
let cyl = Cylinder::new(0.925, 0.5);
let cyl_at = Isometry3::new(Vector3::new(10.97, 0.925, 61.02), na::zero());
let cuboid = Cuboid::new(Vector3::new(0.05, 0.75, 0.5));
let cuboid_at = Isometry3::new(Vector3::new(11.52, 0.75, 60.5), na::zero());
@MichaelShaw
MichaelShaw / Segfault.swift
Created February 24, 2016 03:50
Reliable Swift Segfault
public enum MyResult<T, Error: ErrorType> {
case Success(T)
case Failure(Error)
}
func doThing(@noescape block: (() -> Void)) throws {
try block()
}
func throwableToMyResult<T>(block: (() throws -> MyResult<T, NSError>)) -> MyResult<T, NSError> {
@MichaelShaw
MichaelShaw / gist:2917907
Created June 12, 2012 14:35
Basic Skeletal Animation code in Scala
class Skeleton(val name:String) {
val joints = new ArrayBuffer[Joint]()
val jointsByName = new HashMap[String, Joint]() // convenience only
var rootJoint:Option[Joint] = None
}
class Joint {
var name:String = "unnamed joint :-("
val relativeTranslation = new Vector3d() // relative to parent