Convert perspective square to perspective cube
- Finds perspective vanishing points
- Uses law of ratios to find correct volume
- Returns 2d-Points of the cube bounds
- Carthage
github "eonist/Cube"
- Manual Open
Cube.xcodeproj
- CocoaPod (Coming soon)
let corners:[CGPoint] = [.init(x:100,y:130),.init(x:220,y:150),.init(x:200,y:220),.init(x:130,y:240)]
let quad:Quad = (corners[0],corners[1],corners[3],corners[2])
let cube:Cube = CubeUtil.cube(quad:quad)
let cubeGraphic:CubeGraphic = .init()
layer.addSublayer(cubeGraphic)
cubeGraphic.drawCube(cube: cube)
- Mapping images to Quadrilaterals https://github.com/paulz/PerspectiveTransform
- Mapping image to Quad pt.2 https://github.com/agens-no/AGGeometryKit
- CATransform3d Cube: google book
- Build a cube using CATransform3D: https://www.cocoanetics.com/2012/08/cubed-coreanimation-conundrum/
- JS Quad mapping: http://jsfiddle.net/dFrHS/3/
- Vanishing point logic: https://www.handprint.com/HP/WCL/perspect4.html
- Vanishing point problem: https://math.stackexchange.com/questions/1418293/determine-cube-orientation-given-one-side-in-a-perspective-projection?rq=1
- AR resources: https://github.com/olucurious/Awesome-ARKit
- GetPerspectiveTransform: http://answers.opencv.org/question/5018/getperspectivetransform-mathematical-explanation/
- Add support for 1 point perspective Quadrilaterals ✅
- Add support for horizontal 1p quads (co-linear, epsilon etc) ✅
- Add support for square w/o perspective ✅
- Optimize the math for performance 👈
- Account for object relation to POV 👈