Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guided Drawing Techniques #11

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
Binary file added iOS App/.DS_Store
Binary file not shown.
365 changes: 39 additions & 326 deletions iOS App/ARPen.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

78 changes: 78 additions & 0 deletions iOS App/ARPen.xcodeproj/xcshareddata/xcschemes/ARPen.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1130"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DC28B43B200E4353008B77AB"
BuildableName = "ARPen.app"
BlueprintName = "ARPen"
ReferencedContainer = "container:ARPen.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DC28B43B200E4353008B77AB"
BuildableName = "ARPen.app"
BlueprintName = "ARPen"
ReferencedContainer = "container:ARPen.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DC28B43B200E4353008B77AB"
BuildableName = "ARPen.app"
BlueprintName = "ARPen"
ReferencedContainer = "container:ARPen.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Binary file added iOS App/ARPen/.DS_Store
Binary file not shown.
15 changes: 5 additions & 10 deletions iOS App/ARPen/ARManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,15 @@ class ARManager: NSObject, ARSessionDelegate, ARSessionObserver, OpenCVWrapperDe
self.opencvWrapper = OpenCVWrapper()
super.init()
self.opencvWrapper.delegate = self

}

func session(_ session: ARSession, cameraDidChangeTrackingState camera: ARCamera) {
self.delegate?.didChangeTrackingState(cam: camera)

// create a dictionary literal to pass currentFrame and trackingState
let informationPackage: [String : Any] = ["currentFrame": session.currentFrame!, "trackingState": camera.trackingState]
NotificationCenter.default.post(name: .cameraDidChangeTrackingState, object: nil, userInfo: informationPackage)
}

func session(_ session: ARSession, didUpdate frame: ARFrame) {
self.opencvWrapper.findMarker(frame.capturedImage, withCameraIntrinsics: frame.camera.intrinsics, cameraSize: frame.camera.imageResolution)

// create a dictionary literal to pass frame and trackingState
let informationPackage: [String : Any] = ["frame": frame, "trackingState": frame.camera.trackingState]
NotificationCenter.default.post(name: .sessionDidUpdate, object: nil, userInfo: informationPackage)
}

func session(_ session: ARSession, didFailWithError error: Error) {
Expand All @@ -57,6 +50,7 @@ class ARManager: NSObject, ARSessionDelegate, ARSessionObserver, OpenCVWrapperDe

func sessionInterruptionEnded(_ session: ARSession) {
// Reset tracking and/or remove existing anchors if consistent tracking is required

}

// MARK: - OpenCVWrapperDelegate
Expand All @@ -82,8 +76,9 @@ class ARManager: NSObject, ARSessionDelegate, ARSessionObserver, OpenCVWrapperDe
}
scene.markerFound = true
//self.scene.pencilPoint.position = self.scene.markerBox.position(withIds: UnsafeMutablePointer(mutating: ids), count: Int32(ids.count))
let markerBoxNode = scene.markerBox.positionWith(ids: ids)
scene.pencilPoint.transform = markerBoxNode.transform
scene.pencilPoint.position = scene.markerBox.posititonWith(ids: ids)
//scene.directionNode.position = scene.markerBox.posititonMarkerOrigin(ids: ids)
scene.directionNode.position = scene.markerBox.posititonDirectionWith(ids: ids)


self.delegate?.finishedCalculation()
Expand Down
1 change: 0 additions & 1 deletion iOS App/ARPen/ARPen-Bridging-Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@
//

#import "OpenCVWrapper.h"
#import "OCCT.h"
//#import "MarkerBox.h"
2 changes: 1 addition & 1 deletion iOS App/ARPen/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
var userStudyRecordManager: UserStudyRecordManager?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.

application.isIdleTimerDisabled = true
Expand Down
Binary file added iOS App/ARPen/Assets.xcassets/.DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
},
"resources" : [
{
"filename" : "macbookpro-15.arreferenceimage"
},
{
"filename" : "stones.arreferenceimage"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "macbookpro-15.jpg"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"width" : 13.090999999999999,
"unit" : "inches"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "stones.jpg"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"width" : 13.300000000000001,
"unit" : "centimeters"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.

This file was deleted.

Binary file not shown.
21 changes: 0 additions & 21 deletions iOS App/ARPen/Assets.xcassets/Bool(Hole).imageset/Contents.json

This file was deleted.

6 changes: 3 additions & 3 deletions iOS App/ARPen/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
"version" : 1,
"author" : "xcode"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
{
"idiom" : "universal",
"filename" : "Loft.png",
"filename" : "DrawButton.png",
"scale" : "3x"
}
],
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

This file was deleted.

Binary file not shown.
Binary file removed iOS App/ARPen/Assets.xcassets/Loft.imageset/Loft.png
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
"scale" : "2x"
},
{
"filename" : "Move1PluginInstructions.png",
"idiom" : "universal",
"filename" : "Move1PluginInstructions.png",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
"version" : 1,
"author" : "xcode"
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
{
"idiom" : "universal",
"filename" : "Sweep(Path).png",
"filename" : "NextTrialButton.png",
"scale" : "3x"
}
],
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.
Loading